mirror of
https://github.com/FlipsideCrypto/web3.py.git
synced 2026-02-06 10:56:47 +00:00
dirty
This commit is contained in:
parent
a2e9f5d48b
commit
c4bf876f6f
@ -39,8 +39,6 @@ def disconnected_provider(request):
|
||||
provider.thread.kill()
|
||||
except AttributeError:
|
||||
provider.server.shutdown()
|
||||
finally:
|
||||
provider.thread.join()
|
||||
return provider
|
||||
elif request.param == 'rpc':
|
||||
return RPCProvider(port=get_open_port())
|
||||
|
||||
@ -58,8 +58,6 @@ class RPCProvider(HTTPProvider):
|
||||
port=8545,
|
||||
path="/",
|
||||
ssl=False,
|
||||
connection_timeout=10,
|
||||
network_timeout=10,
|
||||
**kwargs):
|
||||
netloc = "{0}:{1}".format(host, port)
|
||||
endpoint_uri = urlunparse((
|
||||
@ -70,13 +68,8 @@ class RPCProvider(HTTPProvider):
|
||||
'',
|
||||
''
|
||||
))
|
||||
request_kwargs = {
|
||||
'connection_timeout': connection_timeout,
|
||||
'network_timeout': network_timeout,
|
||||
}
|
||||
request_kwargs.update(kwargs)
|
||||
|
||||
super(RPCProvider, self).__init__(endpoint_uri, request_kwargs)
|
||||
super(RPCProvider, self).__init__(endpoint_uri, kwargs)
|
||||
|
||||
|
||||
class KeepAliveRPCProvider(RPCProvider):
|
||||
@ -87,18 +80,10 @@ class KeepAliveRPCProvider(RPCProvider):
|
||||
host="127.0.0.1",
|
||||
port=8545,
|
||||
path="/",
|
||||
ssl=False,
|
||||
connection_timeout=10,
|
||||
network_timeout=10,
|
||||
concurrency=10,
|
||||
**kwargs):
|
||||
super(KeepAliveRPCProvider, self).__init__(
|
||||
host,
|
||||
port,
|
||||
path,
|
||||
ssl,
|
||||
connection_timeout,
|
||||
network_timeout,
|
||||
concurrency=10,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
@ -67,6 +67,9 @@ def make_post_request(endpoint_uri, data, **kwargs):
|
||||
raise ValueError("Unsupported scheme: '{0}'".format(url_parts.scheme))
|
||||
|
||||
kwargs.setdefault('ssl', url_parts.scheme == 'https')
|
||||
kwargs.setdefault('connection_timeout', 10)
|
||||
kwargs.setdefault('network_timeout', 10)
|
||||
kwargs.setdefault('concurrency', 10)
|
||||
|
||||
client = _get_client(host, port, **kwargs)
|
||||
response = client.post(url_parts.path, body=data)
|
||||
|
||||
@ -2,6 +2,7 @@ import requests
|
||||
|
||||
|
||||
def make_post_request(endpoint_uri, data, *args, **kwargs):
|
||||
kwargs.setdefault('timeout', 10)
|
||||
response = requests.post(endpoint_uri, data=data, *args, **kwargs)
|
||||
response.raise_for_status()
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user