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.8.tar.gz
(3.6 kB
view hashes)
Built Distribution
Close
Hashes for aiofreqlimit-0.0.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e5a52ea432ddac03647011c9982f0ef6159f8f54473ddba612a6c9813010a11 |
|
MD5 | 552c9f5a91b603acbde5abf43e98fd57 |
|
BLAKE2b-256 | b5d07c4054667101a9516dff072348c44e2a0cb5fd7c57be4669cb0fc51ca10d |