Frequency limit for asyncio
Project description
Installation
aiofreqlimit requires Python 3.11 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.16.tar.gz
(5.2 kB
view hashes)
Built Distribution
Close
Hashes for aiofreqlimit-0.0.16-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c6f1d948b9f3ca971d1d8642e5a6b6dea8f2885c532120895dbdadbe443e6a2 |
|
MD5 | b349150bcdbc178fcddfa4a32298119f |
|
BLAKE2b-256 | 1df6a40c273e433e8509e08fb2c83c8912a8e34fc8673a242239fd7dc68f47a7 |