__version__0.2.7

This commit is contained in:
2026-03-21 11:31:46 -04:00
parent 9737221914
commit 3a44b492e4
5 changed files with 19 additions and 24 deletions

View File

@@ -125,14 +125,14 @@ class Willexecutors:
# )
def send_request(
bal_plugin,method, url, data=None, *, timeout=10, handle_response=None, count_reply=0
method, url, data=None, *, timeout=10, handle_response=None, count_reply=0
):
network = Network.get_instance()
if not network:
raise Exception("You are offline.")
_logger.debug(f"<-- {method} {url} {data}")
headers = {}
headers["user-agent"] = f"BalPlugin v:{bal_plugin.version()}"
headers["user-agent"] = f"BalPlugin v:{BalPlugin.__version__}"
headers["Content-Type"] = "text/plain"
if not handle_response:
handle_response = Willexecutors.handle_response
@@ -162,7 +162,6 @@ class Willexecutors:
_logger.debug(f"timeout({count_reply}) error: retry in 3 sec...")
time.sleep(3)
return Willexecutors.send_request(
bal_plugin,
method,
url,
data,
@@ -200,12 +199,11 @@ class Willexecutors:
class AlreadyPresentException(Exception):
pass
def push_transactions_to_willexecutor(bal_plugin, willexecutor):
def push_transactions_to_willexecutor(willexecutor):
out = True
try:
_logger.debug(f"{willexecutor['url']}: {willexecutor['txs']}")
if w := Willexecutors.send_request(
bal_plugin,
"post",
willexecutor["url"] + "/" + chainname + "/pushtxs",
data=willexecutor["txs"].encode("ascii"),
@@ -226,16 +224,16 @@ class Willexecutors:
return out
def ping_servers(bal_plugin, willexecutors):
def ping_servers(willexecutors):
for url, we in willexecutors.items():
Willexecutors.get_info_task(bal_plugin,url, we)
Willexecutors.get_info_task(url, we)
def get_info_task(bal_plugin,url, willexecutor):
def get_info_task(url, willexecutor):
w = None
try:
_logger.info("GETINFO_WILLEXECUTOR")
_logger.debug(url)
w = Willexecutors.send_request(bal_plugin,"get", url + "/" + chainname + "/info")
w = Willexecutors.send_request("get", url + "/" + chainname + "/info")
if isinstance(w, dict):
willexecutor["url"] = url
willexecutor["status"] = 200
@@ -262,10 +260,9 @@ class Willexecutors:
def download_list(bal_plugin,old_willexecutors):
def download_list(old_willexecutors):
try:
willexecutors = Willexecutors.send_request(
bal_plugin,
"get",
f"https://welist.bitcoin-after.life/data/{chainname}?page=0&limit=100",
)
@@ -283,7 +280,7 @@ class Willexecutors:
_logger.error(f"Failed to download willexecutors list: {e}")
return {}
def get_willexecutors_list_from_json(bal_plugin):
def get_willexecutors_list_from_json():
try:
with open("willexecutors.json") as f:
willexecutors = json.load(f)
@@ -297,11 +294,10 @@ class Willexecutors:
return {}
def check_transaction(bal_plugin,txid, url):
def check_transaction(txid, url):
_logger.debug(f"{url}:{txid}")
try:
w = Willexecutors.send_request(
bal_plugin,
"post", url + "/searchtx", data=txid.encode("ascii")
)
return w