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
Close
Hashes for retryable_requests-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d6767857df046678257090a543dc1dafd85de10db7ad35596266e37fcdfe6bd |
|
MD5 | a52dcf97eb01a00a43aacc22289cbcd7 |
|
BLAKE2b-256 | 6fae76c8a990db60ff2c89f28cf0d277bab02394c76d64df27a1573d6bd20f9e |