Skip to main content

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

httpx_ratelimiter-0.0.1.tar.gz (6.5 kB view hashes)

Uploaded Source

Built Distribution

httpx_ratelimiter-0.0.1-py3-none-any.whl (5.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page