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.12.tar.gz
(5.1 kB
view hashes)
Built Distribution
Close
Hashes for aiofreqlimit-0.0.12-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 35456a6b2a28b5c0d8ddebf327553bee0a89900d85cbf5eec21942f6ef03c4c3 |
|
MD5 | b7a68c099c708f34db5c172ba84e2c65 |
|
BLAKE2b-256 | c477738f842faada706558ece98d5e5637af89b97e69a00290e65ad6df4ef205 |