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
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=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.4.tar.gz
.
File metadata
- Download URL: retryable-requests-0.0.4.tar.gz
- Upload date:
- Size: 9.8 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 | b495e73fcb74f994a12ac0683381d85c1e032e0a298615aad355f7becafac223 |
|
MD5 | cd622c4e826a7c8f47c85ca655f3bddf |
|
BLAKE2b-256 | 5a6abf805b27efe369d5cfae03a151db5834f0a3beb415eedfc148954ba3dd00 |
File details
Details for the file retryable_requests-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: retryable_requests-0.0.4-py3-none-any.whl
- Upload date:
- Size: 7.0 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 | ded5726ffe48c5ddebc751f2b683faa5567eb67ed3190cc491205227496f1356 |
|
MD5 | 727624c8f093fcefc520eaf0706f561c |
|
BLAKE2b-256 | 1c73935a875fdaa696876231328ea0b27ad7f1e7f7b1b56cb3a782115a83d62a |