Skip to content

Latest commit

 

History

History
71 lines (49 loc) · 2.45 KB

README.md

File metadata and controls

71 lines (49 loc) · 2.45 KB

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_max_retries(3)
    .with_min_delay(0.1)
    .with_multiplier(2)
    .with_retry_on(lambda status_code: status_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.