Skip to main content

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

httpx_ratelimiter-0.0.2.tar.gz (6.6 kB view hashes)

Uploaded Source

Built Distribution

httpx_ratelimiter-0.0.2-py3-none-any.whl (5.7 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