http_retry_request_with_sleep_middleware

Documentation for eth_defi.middleware.http_retry_request_with_sleep_middleware function.

http_retry_request_with_sleep_middleware(make_request, web3)

A HTTP retry middleware with sleep and backoff.

MIGRATED: In web3.py v7+, this function is deprecated in favor of ExceptionRetryConfiguration on the provider. However, for backwards compatibility, this function still works but may not be called if v7 provider retry configuration is used instead.

If you want to customise timeouts, supported exceptions and such you can directly create your own middleware using exception_retry_middleware().

Usage:

web3.middleware_onion.clear()
web3.middleware_onion.inject(http_retry_request_with_sleep_middleware, layer=0)
Parameters
  • make_request (Callable[[web3.types.RPCEndpoint, Any], Any]) – Part of middleware call signature

  • web3 (web3.main.Web3) – Part of middleware call signature

Returns

Web3.py middleware

Return type

Callable[[web3.types.RPCEndpoint, Any], Any]