Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

aiothrottles

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aiothrottles

Throttles for Python coroutines.

  • 0.2.0
  • PyPI
  • Socket score

Maintainers
1

.. image:: https://img.shields.io/badge/license-BSD-blue.svg :target: https://github.com/KonstantinTogoi/aiothrottles/blob/master/LICENSE

.. image:: https://img.shields.io/pypi/v/aiothrottles.svg :target: https://pypi.python.org/pypi/aiothrottles

.. image:: https://img.shields.io/pypi/pyversions/aiothrottles.svg :target: https://pypi.python.org/pypi/aiothrottles

.. image:: https://readthedocs.org/projects/aiothrottles/badge/?version=latest :target: https://aiothrottles.readthedocs.io/en/latest/

.. index-start-marker1

aiothrottles

aiothrottles synchronization primitives are designed to be extension to asyncio synchronization primitives <https://docs.python.org/3/library/asyncio-sync.html>__.

For more details, see aiothrottles Documentation <https://konstantintogoi.github.io/aiothrottles>_.

Usage

Throttle implements a rate limiting for asyncio task. A throttle can be used to guarantee limited access to a shared resources.

The preferred way to use a Throttle is an async with <https://docs.python.org/3/reference/compound_stmts.html#async-with>__ statement:

.. code-block:: python

throttle = Throttle('3/s')

# ... later
async with throttle:
    # access shared state

which is equivalent to:

.. code-block:: python

throttle  = Throttle('3/s')

# ... later
await throttle.acquire()
try:
    # access shared state
finally:
    throttle.release()

A call rate is determined by the :code:rate argument. Pass the rate in the following formats:

  • :code:"{integer limit}/{unit time}"
  • :code:"{limit's numerator}/{limit's denominator}{unit time}"

:code:rate examples:

  • :code:4/s, :code:5/m, :code:6/h, :code:7/d
  • :code:1/second, :code:2/minute, :code:3/hour, :code:4/day
  • :code:1/3s, :code:12/37m, :code:1/5h, :code:8/3d

Installation

.. code-block:: shell

pip install aiothrottles

or

.. code-block:: shell

python setup.py install

Supported Python Versions

Python 3.6, 3.7, 3.8 and 3.9 are supported.

.. index-end-marker1

Test

Run all tests.

.. code-block:: shell

python setup.py test

Run tests with PyTest.

.. code-block:: shell

python -m pytest [-k TEST_NAME] [-m MARKER]

License

aiothrottles is released under the BSD 3-Clause License.

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc