Simple wrapper around PyrateLimiter based on Requests-ratelimiter
Project description
httpx-ratelimit
Simple wrapper around PyrateLimiter based on Requests-ratelimiter that adds integration with httpx library
Read more full documentation at Requests-ratelimiter documentation
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=2)) as c:
start = time()
for i in range(7):
print(f'[t + {time() - start: .2f}] got response: {c.get("https://cataas.com/c")}')
Disclaimer
I just took code from Requests-ratelimiter and changed it in order to be compatible with httpx. I didn't really did much, all credits to original author.
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.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | acb8c18b9a8acb3ff6252c537f3b944a75fd8030e1a3e1e1ee35c792425174cc |
|
MD5 | 5fa0b74469eabeb10edd480f1fe9b316 |
|
BLAKE2b-256 | 8d4bf4f5649c37a1e5d3ee236dc6cb8843b21cb47270aa78805a2e81c9cb2c1a |