Skip to main content

Easy to use retryable requests sessions.

Project description

retryable-requests

PyPI

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

retryable-requests-0.0.3.tar.gz (9.7 kB view hashes)

Uploaded Source

Built Distribution

retryable_requests-0.0.3-py3-none-any.whl (6.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page