Metadata-Version: 2.4
Name: httpx2-limiter
Version: 1.0.0
Summary: An httpx2 based fork of the httpx-limiter package that provides rate-limited httpx2 transports.
Project-URL: Homepage, https://github.com/zach-overflow/httpx2-limiter
Project-URL: Documentation, https://github.com/zach-overflow/httpx2-limiter
Project-URL: Source Code, https://github.com/zach-overflow/httpx2-limiter
Project-URL: Bug Tracker, https://github.com/zach-overflow/httpx2-limiter/issues
Project-URL: Download, https://pypi.org/project/httpx2-limiter/#files
Author: Zach Gottesman
License-Expression: Apache-2.0
License-File: LICENSE
Keywords: httpx2,leaky bucket,limiter,rate-limit
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: httpx2>=2.9.0
Requires-Dist: typing-extensions~=4.6; python_version < '3.11'
Provides-Extra: aiolimiter
Requires-Dist: aiolimiter~=1.2; extra == 'aiolimiter'
Provides-Extra: pyrate
Requires-Dist: pyrate-limiter~=4.0; extra == 'pyrate'
Description-Content-Type: text/markdown

# HTTPX2 Limiter

A lightweight package that provides rate-limited [httpx2](https://github.com/pydantic/httpx2) transports.

This package is a fork of [httpx-limiter](https://github.com/Midnighter/httpx-limiter)
version `0.6.1`, migrated from httpx to httpx2.

## Installation

The package is published on [PyPI](https://pypi.org/project/httpx2-limiter/). Install it,
for example, with the aiolimiter backend:

```sh
pip install 'httpx2-limiter[aiolimiter]'
```

There is also a pyrate-limiter backend available:

```sh
pip install 'httpx2-limiter[pyrate]'
```

## Usage

Apply a rate limit to all requests made through a client by wrapping the transport.
If you want to be able to make twenty requests per second, for example:

```python
import httpx2
from httpx2_limiter import AsyncRateLimitedTransport, Rate
from httpx2_limiter.aiolimiter import AiolimiterAsyncLimiter


async def main():
    limiter = AiolimiterAsyncLimiter.create(Rate.create(magnitude=20))
    async with httpx2.AsyncClient(
        transport=AsyncRateLimitedTransport.create(limiter=limiter),
    ) as client:
        response = await client.get("https://httpbin.org/get")
```

More advanced use cases, such as applying multiple rate limits or different rate
limits per domain, are described in the [documentation](./docs/index.md).

## Copyright

-   Original httpx-limiter Copyright &copy; 2024, 2025 Moritz E. Beber.
-   httpx2-limiter Copyright &copy; 2026 Zach Gottesman.
-   Free software distributed under the [Apache Software License 2.0](./LICENSE).
