TunedWeb3Factory
Documentation for eth_defi.event_reader.web3factory.TunedWeb3Factory Python class.
- class TunedWeb3Factory[source]
Create a Web3 connections.
A factory that allows us to pass web3 connection creation method across thread and process bounderies.
Disable AttributedDict middleware and other middleware that slows us down
Enable graceful retries in the case of network errors and API throttling
Use faster ujson instead of stdlib json to decode the responses
Methods summary
__init__
(json_rpc_url[, http_adapter, ...])Set up a factory.
Sum API call counts across all threads
- __init__(json_rpc_url, http_adapter=None, thread_local_cache=False, api_counter=False)[source]
Set up a factory.
- Parameters
json_rpc_url (str) – Node JSON-RPC server URL.
http_adapter (Optional[requests.adapters.HTTPAdapter]) –
Connection pooling for HTTPS.
Parameters for requests library. Default to pool size 10.
thread_local_cache –
Construct the web3 connection only once per thread.
If you are using thread pooling, recycles the connection across different factory calls.
api_counter – Enable API counters