Skip to content
An efficient implementation of a rate limiter for asyncio.
Branch: master
Clone or download
dependabot-preview Update flake8-bugbear requirement from ^19.8.0 to ^20.1.0
Updates the requirements on [flake8-bugbear]( to permit the latest version.
- [Release notes](
- [Commits](PyCQA/flake8-bugbear@19.8.0...20.1.0)

Signed-off-by: dependabot-preview[bot] <>
Latest commit 57326ef Jan 1, 2020
Type Name Latest commit message Commit time
Failed to load latest commit information.
.azure-pipelines Remove stray copy-pasta in CD pipeline. Dec 12, 2019
.github/workflows Automatically accept dependabot pull requests. Nov 30, 2019
changelog.d Release v1.0.0b1 Dec 1, 2019
src/aiolimiter Make pyproject.toml the source of version truth. Nov 30, 2019
tests Make pyproject.toml the source of version truth. Nov 30, 2019
.license_header.txt New project: aiolimiter Nov 29, 2019
.readthedocs.yml Release v1.0.0b1 Dec 1, 2019
LICENSE.txt Azure pipelines (#3) Nov 30, 2019 Manage changelog (#5) Dec 1, 2019
pyproject.toml Update flake8-bugbear requirement from ^19.8.0 to ^20.1.0 Jan 2, 2020


Azure Pipelines status for master branch status for master branch Latest PyPI package version Latest Read The Docs


An efficient implementation of a rate limiter for asyncio.

This project implements the Leaky bucket algorithm, giving you precise control over the rate a code section can be entered:

from aiolimiter import AsyncLimiter

# allow for 100 concurrent entries within a 30 second window
rate_limit = AsyncLimiter(100, 30)

async def some_coroutine():
    async with rate_limit:
        # this section is *at most* going to entered 100 times
        # in a 30 second period.
        await do_something()

It was first developed as an answer on Stack Overflow.



$ pip install aiolimiter

The library requires Python 3.6 or newer.


  • Python >= 3.6


aiolimiter is offered under the MIT license.

Source code

The project is hosted on GitHub.

Please file an issue in the bug tracker if you have found a bug or have some suggestions to improve the library.

Developer setup

This project uses poetry to manage dependencies, testing and releases. Make sure you have installed that tool, then run the following command to get set up:

poetry install -E docs && poetry run doit devsetup

Apart from using poetry run doit devsetup, you can either use poetry shell to enter a shell environment with a virtualenv set up for you, or use poetry run ... to run commands within the virtualenv.

Tests are run with pytest and tox. Releases are made with poetry build and poetry publish. Code quality is maintained with flake8, black and mypy, and pre-commit runs quick checks to maintain the standards set.

A series of doit tasks are defined; run poetry run doit list (or doit list with poetry shell activated) to list them. The default action is to run a full linting, testing and building run. It is recommended you run this before creating a pull request.

You can’t perform that action at this time.