Rate limiter for Async IO
Project description
asynciolimiter
A simple yet efficient Python AsyncIO rate limiter.
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file asynciolimiter-1.2.0.tar.gz.
File metadata
- Download URL: asynciolimiter-1.2.0.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac1a237c3dbd3c33041c9f9fc1a687c8e6b5268af69da84399967173a344b265
|
|
| MD5 |
6720a87f7a5dcfdfd2e4d15a444f00c4
|
|
| BLAKE2b-256 |
5b95e419550994947b564302c6d6641462d1c154e535df7e6a4bedc2801ec6d5
|
Provenance
The following attestation bundles were made for asynciolimiter-1.2.0.tar.gz:
Publisher:
release.yml on bharel/asynciolimiter
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
asynciolimiter-1.2.0.tar.gz -
Subject digest:
ac1a237c3dbd3c33041c9f9fc1a687c8e6b5268af69da84399967173a344b265 - Sigstore transparency entry: 184010540
- Sigstore integration time:
-
Permalink:
bharel/asynciolimiter@588b3675aa42c55f36fad5ff40fba92457d4090e -
Branch / Tag:
refs/tags/1.2.0 - Owner: https://github.com/bharel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@588b3675aa42c55f36fad5ff40fba92457d4090e -
Trigger Event:
release
-
Statement type:
File details
Details for the file asynciolimiter-1.2.0-py3-none-any.whl.
File metadata
- Download URL: asynciolimiter-1.2.0-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d255de14459f961c8baee7f91e114a6ffb9ce5615e9b19c0049e8ae7e2ac84c
|
|
| MD5 |
e991a03acb226ad4ca8fba3dce98ef67
|
|
| BLAKE2b-256 |
ee912fd273f5c9d041e987cb03f487722355527c412870ece6f803fe2799f2a7
|
Provenance
The following attestation bundles were made for asynciolimiter-1.2.0-py3-none-any.whl:
Publisher:
release.yml on bharel/asynciolimiter
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
asynciolimiter-1.2.0-py3-none-any.whl -
Subject digest:
0d255de14459f961c8baee7f91e114a6ffb9ce5615e9b19c0049e8ae7e2ac84c - Sigstore transparency entry: 184010542
- Sigstore integration time:
-
Permalink:
bharel/asynciolimiter@588b3675aa42c55f36fad5ff40fba92457d4090e -
Branch / Tag:
refs/tags/1.2.0 - Owner: https://github.com/bharel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@588b3675aa42c55f36fad5ff40fba92457d4090e -
Trigger Event:
release
-
Statement type: