Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/enricobacis/limit
python decorator that limits the calling rate of a function
https://github.com/enricobacis/limit
decorator python rate-limit
Last synced: 2 months ago
JSON representation
python decorator that limits the calling rate of a function
- Host: GitHub
- URL: https://github.com/enricobacis/limit
- Owner: enricobacis
- License: mit
- Created: 2017-02-12T16:52:28.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-14T16:15:41.000Z (almost 8 years ago)
- Last Synced: 2024-10-14T01:11:57.518Z (3 months ago)
- Topics: decorator, python, rate-limit
- Language: Python
- Size: 239 KB
- Stars: 17
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
limit
=====*python decorator that limits the calling rate of a function*
Description
-----------.. image:: https://raw.githubusercontent.com/enricobacis/limit/master/.screenshot/limit.gif
:target: https://asciinema.org/a/4f621lbwvpgf91neshex89nrm
:align: centerThis decorator limits the calling rate of the decorated function. This is
useful in conjuction with web API calls, where you often get banned if you
perform more calls than the ones specified in the terms of services.The rate is ``limit`` over ``every``, where limit is the number of invocation
allowed every ``every`` seconds. ``limit(4, 60)`` creates a decorator that
limits the function calls to *4 per minute*. If not specified, ``every``
defaults to ``1`` second... code:: python
@limit(4, 60)
def function(...):
"""never invoke this function more than 4 times per minute."""
...Installation
------------The package has been uploaded to `PyPI`_, so you can install it with pip:
pip install limit
.. _PyPI: https://pypi.python.org/pypi/limit