Provides the RateLimiter class, which allows to limit the amount of actions that may be performed within a defined time frame.

class RateLimiter(max_actions: int, period: int, sleep_time: int = 2)#

Bases: object

A thread safe class which allows to enforce rate limits.

apply()#

Creates a record of an action and forces the caller to wait in case the rate limit would be exceeded.

On this page