Throttler is a zero-dependency Python package designed for easy rate limiting and concurrency control, with robust support for asyncio. It provides flexible context managers and decorators to manage the frequency and simultaneity of operations. The library is actively maintained, with version 1.2.3 being the latest, and receives updates to support newer Python versions and improve performance.
pip install throttlerVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates using the `Throttler` context manager to rate-limit asynchronous tasks to 3 executions per second. The `asyncio.run()` function is used to execute the main asynchronous function.
Upgrade to Python 3.8+ or pin `throttler` to a version prior to 1.2.3.
Ensure usage is within an `async` function and an `asyncio` event loop (e.g., using `asyncio.run()`, `await`).
Understand the sliding window behavior; if a strict fixed window is required, consider implementing custom logic or exploring other libraries.
Upgrade to `throttler>=1.2.1` to benefit from improved argument validation and more graceful error handling.
pip install throttler
throttler_instance = Throttler(rate_limit=10, period=1)
async with throttler_instance:
# your async code herefrom throttler import Throttler
No dependency data recorded yet.