Frequency limit for asyncio
Project description
About
Frequency limit context manager for asyncio.
Installation
aiofreqlimit requires Python 3.8 or greater and is available on PyPI. Use pip to install it:
pip install aiofreqlimit
Using aiofreqlimit
Pass a value of any hashable type to acquire or do not specify any parameter:
import asyncio
from aiofreqlimit import FreqLimit
limit = FreqLimit(1 / 10)
async def job():
async with limit.acquire('some_key'):
await some_call()
async def main():
await asyncio.gather(job() for _ in range(100))
asyncio.run(main())
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
aiofreqlimit-0.0.10.tar.gz
(3.6 kB
view hashes)
Built Distribution
Close
Hashes for aiofreqlimit-0.0.10-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7c58b90a385e25879d42af5fe8daaae4a552a27803acf058dcb1984b54e4d5e |
|
MD5 | d18f1a7440cce3543cc8007b6e896996 |
|
BLAKE2b-256 | efe91b4b13a12a4b3da40e2a3c15f8d97e7ddc95675c3d33bc2f39e7ab3a6a2e |