Skip to main content

asynciolimiter

A simple yet efficient Python AsyncIO rate limiter.

GitHub branch checks state PyPI PyPI - Python Version codecov

Installation

pip install asynciolimiter

Sample Usage

# Limit to 10 requests per 5 second (equiv to 2 requests per second)
>>> limiter = asynciolimiter.Limiter(10/5)
>>> async def main():
...     await limiter.wait() # Wait for a slot to be available.
...     pass # do stuff

>>> limiter = Limiter(1/3)
>>> async def request():
...     await limiter.wait()
...     print("Request")  # Do stuff
...
>>> async def main():
...     # Schedule 1 request every 3 seconds.
...     await asyncio.gather(*(request() for _ in range(10)))

Available Limiter flavors

  • Limiter: Limits by requests per second and takes into account CPU heavy tasks or other delays that can occur while the process is sleeping.
  • LeakyBucketLimiter: Limits by requests per second according to the leaky bucket algorithm. Has a maximum capacity and an initial burst of requests.
  • StrictLimiter: Limits by requests per second, without taking CPU or other process sleeps into account. There are no bursts and the resulting rate will always be a less than the set limit.

Documentation

Full documentation available on Read the Docs.

License

Licensed under the MIT License.

Contribution

See contributing.md.

Release files for asynciolimiter 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for asynciolimiter 1.2.0
File Size Uploaded
asynciolimiter-1.2.0.tar.gz 8.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for asynciolimiter 1.2.0
File Interpreter ABI Platform
asynciolimiter-1.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 16.7 kB

Release files / asynciolimiter-1.2.0.tar.gz

Download URL asynciolimiter-1.2.0.tar.gz
Size 8.3 kB
Tags Source
SHA-256 checksum
How to use checksums
ac1a237c3dbd3c33041c9f9fc1a687c8e6b5268af69da84399967173a344b265
BLAKE2b-256 checksum
How to use checksums
5b95e419550994947b564302c6d6641462d1c154e535df7e6a4bedc2801ec6d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 18, 2025.

Transparency log

Release files / asynciolimiter-1.2.0-py3-none-any.whl

Download URL asynciolimiter-1.2.0-py3-none-any.whl
Size 8.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0d255de14459f961c8baee7f91e114a6ffb9ce5615e9b19c0049e8ae7e2ac84c
BLAKE2b-256 checksum
How to use checksums
ee912fd273f5c9d041e987cb03f487722355527c412870ece6f803fe2799f2a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 18, 2025.

Transparency log
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page