Simple wrapper around PyrateLimiter based on Requests-ratelimiter
Project description
httpx-ratelimit
Simple wrapper around PyrateLimiter that adds integration with httpx library
Usage
Using transport
Example:
from time import time
from httpx import Client
from httpx_ratelimiter import LimiterTransport
# Apply a rate limit of 2 requests per second to all requests
with Client(transport=LimiterTransport(per_second=5, max_delay=600)) as c:
start = time()
for _i in range(100):
print(
f'[t + {time() - start: .2f}] got response: {c.get("https://httpbin.org/status/200,429")}'
)
Thanks
Thank to original Requests-ratelimiter author for idea and backbone of a project.
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
Built Distribution
Close
Hashes for httpx_ratelimiter-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8123d7f9f861fe0e9bc50e0fd7006edc43c7a99d015a3995c410b1433a6fd244 |
|
MD5 | 3eb6a29f0fc912ac6a95484a291d89f9 |
|
BLAKE2b-256 | 14cd6ef2c551cf5144b8da64f4f02700292cbe4ec7edd281a974324e93c1789a |