Skip to main content

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


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.14.tar.gz (5.1 kB view hashes)

Uploaded Source

Built Distribution

aiofreqlimit-0.0.14-py3-none-any.whl (3.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page