Skip to content

gleb-chipiga/aiofreqlimit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Frequency limit context manager for asyncio

Latest PyPI package version License Downloads count

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())

About

Frequency limit context manager for asyncio

Topics

Resources

License

Stars

Watchers

Forks