A library to limit async calls using a waterwheel approach to ensure calls maximize the rate limit.
Project description
aioburst
A library to limit async calls using a waterwheel approach to ensure calls maximize the rate limit. The library is extremely light, using only core python packages.
Usage
Install the package using pip:
pip install aioburst
Import the limiter:
from aioburst import aioburst
The package is purely functional, so there is no class to instantiate. aioburst
is used as a context manager:
async with aioburst(semaphore, period):
...
semaphore
is an instance of asyncio.Semaphore
instantiated with a value equal to the number of simultanous calls that are allowed. Pass the semaphore
instance to aioburst
. period
is the period over which the number of calls are evaluated in seconds. For example, if you want to make 4 calls/second, you would pass in semaphore=Semaphore(4)
and period=1
.
Project details
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
File details
Details for the file aioburst-0.1.2.tar.gz
.
File metadata
- Download URL: aioburst-0.1.2.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.2 CPython/3.10.7 Linux/5.4.0-1090-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aab811a5c6be5959005ea71a80bf325b86da8623ef11d6fceca1b1c74a90a2b7 |
|
MD5 | 3f714cf60f01ce6a54897b1c44e22ce1 |
|
BLAKE2b-256 | 2363c1af5a9c099da1a606e1096255c31d210fcb4d82f7887fe503ecb03e8793 |
File details
Details for the file aioburst-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: aioburst-0.1.2-py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.2 CPython/3.10.7 Linux/5.4.0-1090-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6dad318aa1372368b2527012dbbb6034dfcb0c51ecdaaaf8b030c98101bec17 |
|
MD5 | 336b0b15aaaae91fe2ad9edfad099bd6 |
|
BLAKE2b-256 | 3203f2489499a0cb6182bf4f2e6149cbd088e90d7a940d19553f47df1c4b47ae |