Easy to use retryable requests sessions.
Project description
retryable-requests
Easy to use retryable requests sessions.
Quickstart
Common case
from retryable_requests import RetryableSession
with RetryableSession() as session:
session.get('https://httpbin.org/get') # will be retried up to 5 times
Only retry on 429 errors
from requests.packages.urllib3.util.retry import Retry
from retryable_requests import RetryableSession
retry_strategy = Retry(
total=5,
status_forcelist=[429],
backoff_factor=0.1,
)
with RetryableSession(retry_strategy=retry_strategy) as session:
session.get('https://httpbin.org/get') # will be retried up to 5 times, only for 429 errors
Automatically use a base URL for every request
from retryable_requests import RetryableSession
with RetryableSession('https://httpbin.org/') as session:
session.get('get') # 'https://httpbin.org/get' will be retried up to 5 times
session.post('post') # 'https://httpbin.org/post' won't be retried (POST request)
Features
- Automatic backing off retries for failed requests that can be safely retried
- Quick timeouts for non-responsive requests
See also
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
retryable-requests-0.1.1.tar.gz
(10.2 kB
view hashes)
Built Distribution
Close
Hashes for retryable_requests-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba80161e059c8881a56091e94cf68bc83d50088f24080e230cd32fe00a164624 |
|
MD5 | d1d4313a00b78a5948b8e9fe5a936688 |
|
BLAKE2b-256 | 3b2ed1ece034563cfa9c360239b042e7779cf91f0ac8077f4bdad669af3e17f9 |