Skip to content

Middleware for implementing retry policies with HTTPX

License

Notifications You must be signed in to change notification settings

mharrisb1/httpx-retry

Repository files navigation

RESPX

HTTPX Retry - Middleware for implementing retry policies with HTTPX


Usage

Retries are defined at the transport layer.

import httpx

from httpx_retry import RetryTransport, RetryPolicy

exponential_retry = (
    RetryPolicy()
      .with_attempts(3)
      .with_min_delay(100)
      .with_multiplier(2)
      .with_retry_on(lambda code: code >= 500)
)

client = httpx.Client(transport=RetryTransport(policy=exponential_retry))
res = client.get("https://example.com")

Examples

There are examples of implementing common retry policies in /tests

Installation

PyPI version PyPI - Python Version PyPI - Downloads

Available in PyPI

pip install httpx-retry

License

PyPI - License

See LICENSE for more info.

Contributing

Open Issues Stargazers

See CONTRIBUTING.md for info on PRs, issues, and feature requests.

Changelog

See CHANGELOG.md for summarized notes on changes or view releases for more details information on changes.

About

Middleware for implementing retry policies with HTTPX

Topics

Resources

License

Stars

Watchers

Forks

Languages