Easy to use retryable requests sessions.
Project description
retryable-requests
Easy to use retryable requests sessions.
Quickstart
Common case
from retryable_requests import RetryableSession
session = RetryableSession()
session.get('https://httpbin.org/get') # will be retried up to 5 times
Complex, 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,
)
session = RetryableSession(retry_strategy)
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 RetryableBaseUrlSession
session = RetryableBaseUrlSession('https://httpbin.org/')
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)
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
Built Distribution
File details
Details for the file retryable-requests-0.0.3.tar.gz
.
File metadata
- Download URL: retryable-requests-0.0.3.tar.gz
- Upload date:
- Size: 9.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ac2832b6af2018cefcfe69e5fa4b51b65f3f459fd62000cefb51ece59c7da8b |
|
MD5 | 6b213fbfba6d80b65db1612b93909ab8 |
|
BLAKE2b-256 | 41862466a10f4bf14cb7cda99d9b9ee13da0dcd9c60a055dfbd8639b58558062 |
File details
Details for the file retryable_requests-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: retryable_requests-0.0.3-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d6767857df046678257090a543dc1dafd85de10db7ad35596266e37fcdfe6bd |
|
MD5 | a52dcf97eb01a00a43aacc22289cbcd7 |
|
BLAKE2b-256 | 6fae76c8a990db60ff2c89f28cf0d277bab02394c76d64df27a1573d6bd20f9e |