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.0.tar.gz
(10.1 kB
view details)
Built Distribution
File details
Details for the file retryable-requests-0.1.0.tar.gz
.
File metadata
- Download URL: retryable-requests-0.1.0.tar.gz
- Upload date:
- Size: 10.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e21e5a21a5b12462fcff04bed457cc85218391666fb77cc86320e5572b3af3f2 |
|
MD5 | 60245349944ecb5e20f4e7c59bc5eb63 |
|
BLAKE2b-256 | 599fb052010e98ccc8678c61d8824207d368b421940381bfde21591755f80e68 |
File details
Details for the file retryable_requests-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: retryable_requests-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 650ae0ac12ecf2f189c152f82df5c24d942c311433c7375e708902d1356b60df |
|
MD5 | 6d6622de962a50d6255bf219b35bb6ff |
|
BLAKE2b-256 | da684b9a59a41ad63d20b972a35e8870e1ef7b2c816c6ab827e3c5ae499fe94b |