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.11.tar.gz
(3.7 kB
view hashes)
Built Distribution
Close
Hashes for aiofreqlimit-0.0.11-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fef6394c4263d094e2626395f0b8c25cee6b3d75c8ebfd9641a6d9de748143db |
|
MD5 | 1850f81497457381a166034013e9ac21 |
|
BLAKE2b-256 | 8b0ddefc7863334f24a6a4b59c0d6844621b61f70901f68ffcf76c97d4c9c084 |