From 7cfa87ba6a7d1b5e5fb5b07d1065615339210af2 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Fri, 6 Jun 2025 15:18:17 +0300 Subject: [PATCH] class HTTPClient: `proto` -> `network_proto` --- mmgen/http.py | 10 +++++----- mmgen/proto/rune/params.py | 2 +- mmgen/proto/rune/rpc/remote.py | 8 ++++---- mmgen/swap/proto/thorchain/thornode.py | 4 ++-- .../fakemods/mmgen/swap/proto/thorchain/thornode.py | 6 +++--- test/overlay/fakemods/mmgen/tx/tx_proxy.py | 6 +++--- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/mmgen/http.py b/mmgen/http.py index ae194089..68b5a50c 100755 --- a/mmgen/http.py +++ b/mmgen/http.py @@ -16,7 +16,7 @@ import requests class HTTPClient: - proto = 'https' + network_proto = 'https' host = None timeout = 60 http_hdrs = { @@ -26,10 +26,10 @@ class HTTPClient: verify = True text_mode = True - def __init__(self, cfg, *, proto=None, host=None): + def __init__(self, cfg, *, network_proto=None, host=None): self.cfg = cfg - if proto: - self.proto = proto + if network_proto: + self.network_proto = network_proto if host: self.host = host self.session = requests.Session() @@ -44,7 +44,7 @@ class HTTPClient: }) def call(self, name, path, err_fs, timeout, *, data=None): - url = self.proto + '://' + self.host + path + url = self.network_proto + '://' + self.host + path kwargs = { 'url': url, 'timeout': timeout or self.timeout, diff --git a/mmgen/proto/rune/params.py b/mmgen/proto/rune/params.py index 134734cd..41d7cdbb 100755 --- a/mmgen/proto/rune/params.py +++ b/mmgen/proto/rune/params.py @@ -71,7 +71,7 @@ class regtest(testnet): # regtest is deprecated testnet rpc_remote_params = { 'server_domain': Hostname('localhost')} rpc_remote_rest_params = { - 'proto': 'http', + 'network_proto': 'http', 'host': Hostname('localhost:18800'), 'verify': False} rpc_remote_rpc_params = rpc_remote_rest_params diff --git a/mmgen/proto/rune/rpc/remote.py b/mmgen/proto/rune/rpc/remote.py index 5c3d1dee..44cfbe83 100755 --- a/mmgen/proto/rune/rpc/remote.py +++ b/mmgen/proto/rune/rpc/remote.py @@ -31,10 +31,10 @@ class ThornodeRemoteRESTClient(HTTPClient): http_hdrs = {'Content-Type': 'application/json'} timeout = 5 - def __init__(self, cfg, *, proto=None, host=None): - for k, v in cfg._proto.rpc_remote_rest_params.items(): + def __init__(self, cfg, proto, *, network_proto=None, host=None): + for k, v in proto.rpc_remote_rest_params.items(): setattr(self, k, v) - super().__init__(cfg, proto=proto, host=host) + super().__init__(cfg, network_proto=network_proto, host=host) class THORChainRemoteRPCClient(RemoteRPCClient): server_proto = 'THORChain' @@ -44,7 +44,7 @@ class THORChainRemoteRPCClient(RemoteRPCClient): setattr(self, k, v) super().__init__(cfg, proto) self.caps = ('lbl_id',) - self.rest_api = ThornodeRemoteRESTClient(cfg) + self.rest_api = ThornodeRemoteRESTClient(cfg, proto) def get_balance(self, addr, *, block=None): res = process_response( diff --git a/mmgen/swap/proto/thorchain/thornode.py b/mmgen/swap/proto/thorchain/thornode.py index cbce8cf7..f5887f3c 100755 --- a/mmgen/swap/proto/thorchain/thornode.py +++ b/mmgen/swap/proto/thorchain/thornode.py @@ -30,8 +30,8 @@ class ThornodeRPCClient(HTTPClient): host = 'thornode.ninerealms.com' timeout = 5 - def __init__(self, tx, *, proto=None, host=None): - super().__init__(tx.cfg, proto=proto, host=host) + def __init__(self, tx, *, network_proto=None, host=None): + super().__init__(tx.cfg, network_proto=network_proto, host=host) class Thornode: diff --git a/test/overlay/fakemods/mmgen/swap/proto/thorchain/thornode.py b/test/overlay/fakemods/mmgen/swap/proto/thorchain/thornode.py index c569a534..d069d0cb 100755 --- a/test/overlay/fakemods/mmgen/swap/proto/thorchain/thornode.py +++ b/test/overlay/fakemods/mmgen/swap/proto/thorchain/thornode.py @@ -2,10 +2,10 @@ from .thornode_orig import * class overlay_fake_ThornodeRPCClient: - proto = 'http' - host = 'localhost:18800' + network_proto = 'http' + host = 'localhost:18800' verify = False -ThornodeRPCClient.proto = overlay_fake_ThornodeRPCClient.proto +ThornodeRPCClient.network_proto = overlay_fake_ThornodeRPCClient.network_proto ThornodeRPCClient.host = overlay_fake_ThornodeRPCClient.host ThornodeRPCClient.verify = overlay_fake_ThornodeRPCClient.verify diff --git a/test/overlay/fakemods/mmgen/tx/tx_proxy.py b/test/overlay/fakemods/mmgen/tx/tx_proxy.py index 446c1f5d..4ef156e6 100755 --- a/test/overlay/fakemods/mmgen/tx/tx_proxy.py +++ b/test/overlay/fakemods/mmgen/tx/tx_proxy.py @@ -1,10 +1,10 @@ from .tx_proxy_orig import * class overlay_fake_EtherscanTxProxyClient: - proto = 'http' - host = 'localhost:28800' + network_proto = 'http' + host = 'localhost:28800' verify = False -EtherscanTxProxyClient.proto = overlay_fake_EtherscanTxProxyClient.proto +EtherscanTxProxyClient.network_proto = overlay_fake_EtherscanTxProxyClient.network_proto EtherscanTxProxyClient.host = overlay_fake_EtherscanTxProxyClient.host EtherscanTxProxyClient.verify = overlay_fake_EtherscanTxProxyClient.verify