aiothrottles
Documentation: https://konstantintogoi.github.io/aiothrottles
Source Code: https://github.com/KonstantinTogoi/aiothrottles
aiothrottles synchronization primitives are designed to be extension to asyncio synchronization primitives.
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 statement:
which is equivalent to:
throttle = Throttle('3/s')
# ... later
await throttle.acquire()
try:
# access shared state
finally:
throttle.release()
A call rate is determined by the rate argument.
Pass the rate in the following formats:
"{integer limit}/{unit time}""{limit's numerator}/{limit's denominator}{unit time}"
rate examples:
4/s,5/m,6/h,7/d1/second,2/minute,3/hour,4/day1/3s,12/37m,1/5h,8/3d
Installation
or
Supported Python Versions
Python 3.6, 3.7, 3.8 and 3.9 are supported.