is_retryable_http_exception

Documentation for eth_defi.middleware.is_retryable_http_exception function.

is_retryable_http_exception(exc, retryable_exceptions=(<class 'requests.exceptions.ConnectionError'>, <class 'requests.exceptions.HTTPError'>, <class 'requests.exceptions.Timeout'>, <class 'requests.exceptions.TooManyRedirects'>, <class 'web3.exceptions.BlockNotFound'>, <class 'requests.exceptions.ChunkedEncodingError'>), retryable_status_codes=(429, 500, 502, 503, 504, 525, 520, 410), retryable_rpc_error_codes=(-32603, -32003, -32043, -32005, -32701), retryable_rpc_error_messages={'execution aborted (timeout = 5s)', 'header not found', 'nonce too low'}, method=None, params=None)[source]

Helper to check retryable errors from JSON-RPC calls.

Retryable reasons are connection timeouts, API throttling and such.

We support various kind of exceptions and HTTP status codes we know we can try.

Parameters