Please use https://github.com/bustawin/retry-requests
This package is no longer maintained.
Adding retries to Requests.get() with exponential backoff.
Retry unsuccessful GET requests after waiting for a specific time interval. With each unsuccessful request, the time interval increases exponentially (it doubles). The undertaking is declared ultimately unsuccessful when the time interval gets bigger than a maximum backoff value.
pip install get_retriesimport get_retries
# max_backoff: maximum interval to wait in seconds
response = get_retries.get('https://wikipedia.com', max_backoff=32)
if response:
print(response.status_code)For more information check out the code.
MIT.