event_reader.fast_json_rpc
Documentation for eth_defi.event_reader.fast_json_rpc Python module.
JSON-RPC decoding optimised for web3.py.
Monkey-patches JSON decoder to use ujson.
Functions
Get last HTTP reply headers of the JSON-RPC API call. |
|
|
Monkey-patch web3.py provider for faster JSON decoding and additional logging. |
|
Monkey-patch web3.py provider for faster JSON decoding and additional logging. |
Exceptions
IPCProvider expects JSONDecodeErrors, not value errors. |
- exception PartialHttpResponseException
Bases:
json.decoder.JSONDecodeErrorIPCProvider expects JSONDecodeErrors, not value errors.
- __init__(msg, doc, pos)
- __new__(**kwargs)
- add_note()
Exception.add_note(note) – add a note to the exception
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- patch_provider(provider)
Monkey-patch web3.py provider for faster JSON decoding and additional logging.
- Parameters
provider (web3.providers.base.JSONBaseProvider) –
- patch_web3(web3)
Monkey-patch web3.py provider for faster JSON decoding and additional logging.
This greatly improves JSON-RPC API access speeds, when fetching multiple and large responses.
Example:
from eth_defi.event_reader.fast_json_rpc import patch_web3 patch_web3(web3)
- Parameters
web3 (web3.main.Web3) –
- get_last_headers()
Get last HTTP reply headers of the JSON-RPC API call.
Debug for RPC providers
Gives insight for routing of proxy providers like dRPC so you can disable faulty market place providers
Example output:
{'Date': 'Wed, 09 Apr 2025 14:56:48 GMT', 'Content-Type': 'application/json', 'Content-Length': '112', 'Connection': 'keep-alive', 'access-control-allow-origin': '*', 'Content-Encoding': 'gzip', 'vary': 'Accept-Encoding', 'x-drpc-owner-id': '2580e13b-d8a6-48a3-bdaa-67bc5972c7f5', 'x-drpc-owner-tier': 'paid', 'x-drpc-provider-id': 'drpc-core-free', 'x-drpc-trace-id': '3ac007d0de35bae3d390789476db31cd', 'strict-transport-security': 'max-age=31536000; includeSubDomains', 'cf-cache-status': 'DYNAMIC', 'Server': 'cloudflare', 'CF-RAY': '92dada6e5a7aed3f-SJC'}- Returns
Last HTTP reply headers from the JSON-RPC call.
- Return type