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 details)
Built Distribution
File details
Details for the file aiofreqlimit-0.0.16.tar.gz
.
File metadata
- Download URL: aiofreqlimit-0.0.16.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | afb206903fa08b91fb4beba0c0ad617a018f1fb56996917e9b1dfacfaf85f826 |
|
MD5 | 6041ba9c669a9a75f3e18ec5e400f0bb |
|
BLAKE2b-256 | b9f42a828b6dd2973745810eec7f82731c61dfda8d983d4b3e12c3dee5c11ecd |
File details
Details for the file aiofreqlimit-0.0.16-py3-none-any.whl
.
File metadata
- Download URL: aiofreqlimit-0.0.16-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c6f1d948b9f3ca971d1d8642e5a6b6dea8f2885c532120895dbdadbe443e6a2 |
|
MD5 | b349150bcdbc178fcddfa4a32298119f |
|
BLAKE2b-256 | 1df6a40c273e433e8509e08fb2c83c8912a8e34fc8673a242239fd7dc68f47a7 |