Skip to content

mharrisb1/httpx-retry

Repository files navigation

RESPX

HTTPX Retry - Middleware for implementing retry policies with HTTPX


Caution

This project is no longer maintained as of 2025-04-23. Everyone should migrate to httpx-retries

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.

About

Middleware for implementing retry policies with HTTPX

Topics

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •  

Languages