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), retryable_rpc_error_codes=(-32603, -32003, -32043, -32005, -32701), retryable_rpc_error_messages={'nonce too low'})[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
exc (Exception) – Exception raised by
requests
or Web3 machinery.retryable_exceptions (Tuple[BaseException]) – Exception raised by
requests
or Web3 machinery.retryable_status_codes (Collection[int]) – HTTP status codes we can retry. E.g. 429 Too Many requests.
retryable_rpc_error_messages (Collection[str]) – See
DEFAULT_RETRYABLE_RPC_ERROR_MESSAGES
.retryable_rpc_error_codes (Collection[int]) –