skillfed

requests-ratelimiter

Rate-limiting for the requests library

requests-ratelimiter v0.10.0 857.3K downloads/30d#4,883 on PyPI118
Permissive license MIT Active released

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-ratelimiter

uv

uv add requests-ratelimiter

poetry

poetry add requests-ratelimiter

Installing 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

Development Status :: 4 - BetaIntended Audience :: DevelopersProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.15Typing :: Typed

Tags

rate limit http requestsrequests library rate limitingleaky bucket algorithmthrottle api callsper-host rate limitingrequests adapter rate limithttp request throttling
http-clientrate-limitingapi-integration

More WWW/HTTP packages