• Stars
    star
    479
  • Rank 91,752 (Top 2 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 5 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An efficient implementation of a rate limiter for asyncio.

aiolimiter

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

Introduction

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.

Documentation

https://aiolimiter.readthedocs.io

Installation

$ pip install aiolimiter

The library requires Python 3.7 or newer.

Requirements

  • Python >= 3.7

License

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 --with 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.

More Repositories

1

adventofcode

Advent of Code solutions 2015-2023
Jupyter Notebook
147
star
2

RummikubConsole

Rummikub solver console with multi-game support and persistence.
Python
19
star
3

rtfunicode

Encoder for unicode to RTF 1.5 command sequences
Python
18
star
4

collective.transmogrifier

A configurable pipeline, aimed at transforming content for import and export
Python
14
star
5

formatflowed

RFC 3676 format=flowed text processing
Python
6
star
6

setuptools_subversion

Setuptools revision control system plugin for Subversion
Python
5
star
7

plone.app.celery

Cerely integration for Plone
Python
4
star
8

SO-userscripts

User scripts for use on Stack Exchange websites
TypeScript
3
star
9

mjpieters.github.com

Personal homepage, GitHub style
JavaScript
3
star
10

quodlibet_plugins

Python
3
star
11

rod.recipe.rabbitmq

Git-svn mirror of rod.recipe.rabbitmq from http://code.google.com/p/rodrecipes
Python
2
star
12

pixiedust

Python interpreter for the PixieDust esoteric language
Python
2
star
13

plone.app.archive

Archive Plone content
Python
2
star
14

plone.app.transmogrifier

This package contains several blueprints for collective.transmogrifier pipelines, commonly used to import content into a Plone site.
Python
2
star
15

collegial

Framework for building sane asyncio applications
Python
1
star
16

collective.captcha

Stateless captcha generation and verification
Python
1
star
17

homebrew-tap

Personal homebrew tap for things I need building.
Ruby
1
star
18

plone.logcontrol

Fine-grained logging adjustment in a running Zope or Plone server.
1
star
19

plone.app.async

Integration package for zc.async allowing asynchronous operations in Plone.
Python
1
star
20

experimental.btree

C
1
star
21

act-container

Docker container to run GitHub actions locally with act
Dockerfile
1
star
22

experimental.catalogqueryplan

C
1
star