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

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.2.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

retryable_requests-0.1.2-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file retryable-requests-0.1.2.tar.gz.

File metadata

  • Download URL: retryable-requests-0.1.2.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for retryable-requests-0.1.2.tar.gz
Algorithm Hash digest
SHA256 f4d08923de1fe4a4805ec2677004ece16fa59fac2827a094011a4feeba2b3d48
MD5 8b8c384bbd60ce4ecd4781486768f405
BLAKE2b-256 37097cad4599ef773378870639c765fcc9035845beb8efcac46fe96b46e124f3

See more details on using hashes here.

Provenance

File details

Details for the file retryable_requests-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for retryable_requests-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ce70858edc571c964260ca5b4fc1cd6e5fe0193b546430988531e212654fef0f
MD5 dadf535e53bb84a502d8a5ef71a44c3a
BLAKE2b-256 4704a08e1df9c8a95a16b770c61379d61d18d0bb6821e364c694e9625165f2cb

See more details on using hashes here.

Provenance

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