asynciolimiter is a simple yet efficient Python library providing various rate limiting algorithms for AsyncIO applications. It offers different limiter flavors like `Limiter`, `LeakyBucketLimiter`, and `StrictLimiter` to control the rate of asynchronous operations. The current version is 1.2.0, actively maintained with regular releases addressing features and bug fixes.
pip install asynciolimiterVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use the basic `Limiter` to constrain the execution rate of asynchronous tasks. It creates a limiter allowing 2 requests per second (10 requests over 5 seconds) and then schedules 10 tasks, each waiting for the limiter before proceeding.
Upgrade to `asynciolimiter>=1.1.2` to ensure correct behavior of `LeakyBucketLimiter`.
Upgrade to `asynciolimiter>=1.1.1` to avoid assertions and instead receive a warning for fast event loop scenarios.
Always pass the desired rate as a floating-point number representing calls per second. For example, to allow 10 requests in 5 seconds, use `Limiter(10/5)`, which evaluates to `Limiter(2.0)`.
If you intend to use `asynciolimiter`, import its specific limiter classes, such as `Limiter`, `LeakyBucketLimiter`, or `StrictLimiter`. For example: `from asynciolimiter import Limiter`.
Ensure you are using `asynciolimiter` version `1.1.2` or higher. Upgrade using `pip install --upgrade asynciolimiter`.
Recalculate your desired rate as `total_calls / total_seconds`. For example, if you want 30 calls in 60 seconds, your rate should be `30/60 = 0.5`. Initialize the limiter as `Limiter(0.5)`.
No dependency data recorded yet.