Awesome Open Source
Awesome Open Source

Please use https://awesomeopensource.com/project/bustawin/retry-requests

This package is no longer maintained.

get_retries Build Status PyPI PyPI - Python Version

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.

Install

pip install get_retries

Usage

import 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.

License

MIT.


Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Python (1,136,168
Time (1,443
Get (212
Sleep (199
Related Projects