requests-ratelimiter
Rate-limiting for the requests library
What it is and what it does
requests-ratelimiter is a thin wrapper around pyrate-limiter that integrates rate-limiting directly into the requests library workflow. It implements the leaky bucket algorithm and lets you enforce rate limits by requests per second, minute, hour, day, or month. The package tracks limits separately per host by default, so requests to different APIs don't interfere with each other's quotas.
You can use it three ways: as a drop-in replacement for requests.Session (LimiterSession), as a transport adapter mounted on an existing session (LimiterAdapter), or as a mixin for custom session classes. It supports in-memory tracking by default, with optional SQLite or Redis backends for persistence across threads and processes. Rate limits can be uniform across all hosts or customized per host or URL prefix.
Use it for:
- Scraping or polling multiple APIs with different rate limits by mounting different adapters to each host
- Building a web service that must respect upstream API quotas while handling concurrent requests across threads
- Enforcing tenant-specific rate limits in a multi-tenant application using custom bucket tracking
- Testing HTTP clients under controlled rate-limit conditions without hitting real API limits
- Protecting downstream services by rate-limiting outbound requests from a client application
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Adds rate-limiting to the requests library by wrapping pyrate-limiter, allowing you to enforce per-second, per-minute, per-hour, per-day, or per-month request limits on HTTP calls.
Yes. The package is actively maintained, has no known vulnerabilities, low install friction, and a permissive MIT license. It solves a common problem (rate-limiting HTTP requests) with a clean API that integrates naturally with requests. Use it when you need to respect API quotas or protect services from being overwhelmed by outbound traffic.
Install
requests-ratelimiter on PyPI
pip
pip install requests-ratelimiteruv
uv add requests-ratelimiterpoetry
poetry add requests-ratelimiterInstalling requests-ratelimiter
Before you install
Low friction: pure Python wheel with only two runtime dependencies (pyrate-limiter and requests). Actively maintained with recent commits and a stable release history since 2021.
License in practice
MIT license permits unrestricted use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.
Quickstart
from requests_ratelimiter import LimiterSession
# Create a session with a 5 requests-per-second limit
session = LimiterSession(per_second=5)
# Use it like a normal requests.Session
response = session.get('https://api.example.com/data')
print(response.json())
Requires Python 3.10 or later. For multi-threaded or multi-process environments, use a persistent backend (SQLiteBucket or Redis) to share rate limits across threads/processes.
Verify before relying
- Whether per-host rate limit tracking works correctly across concurrent requests in multi-threaded environments without a persistent backend
- Performance characteristics when handling thousands of concurrent rate-limited requests
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — pyrate-limiter, requests |
| Maintenance | actively maintained — 114 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 857,308/month — #4,883 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: requests_ratelimiter-0.10.0-py3-none-any.whl
Keywords: leaky-bucket, rate-limiting, requests
Tags
More WWW/HTTP packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
h11h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
httpxHTTPX is a fully featured HTTP client library…
permissive · top 100 on PyPI
httpcoreA minimal low-level HTTP client library that…
permissive · top 100 on PyPI
aiohttpaiohttp is an async HTTP client and server…
permissive · top 100 on PyPI
fastapi-limiterAdds request rate limiting to FastAPI routes…
permissive · top 5,000 on PyPI
httpx-limiterProvides rate-limited HTTP transports for httpx…
permissive · top 15,000 on PyPI
pyrate-limiterPyrateLimiter implements the Leaky-Bucket…
permissive · top 5,000 on PyPI
asynciolimiterProvides rate limiting for async Python code by…
permissive · top 5,000 on PyPI
django-ratelimitProvides a Django decorator to rate-limit views…
permissive · top 5,000 on PyPI
httpxthrottlecacheWraps HTTPX with built-in rate limiting and…
unclear · top 15,000 on PyPI
slowapiAdds rate limiting to Starlette and FastAPI…
permissive · top 1,000 on PyPI
Flask-LimiterFlask-Limiter adds rate limiting to Flask…
permissive · top 1,000 on PyPI
rushrush provides rate-limiting algorithms…
permissive · top 15,000 on PyPI
ratelimRatelim enforces rate limits on function calls…
permissive · top 5,000 on PyPI