pyrate_limiter.abstracts.rate module¶
Unit classes that deals with rate, item & duration
- class pyrate_limiter.abstracts.rate.Duration(*values)¶
Bases:
EnumInterval helper class
- DAY = 86400000¶
- HOUR = 3600000¶
- MINUTE = 60000¶
- SECOND = 1000¶
- WEEK = 604800000¶
- static readable(value)¶
- Return type:
str
- class pyrate_limiter.abstracts.rate.Rate(limit, interval, burst=None)¶
Bases:
objectRate definition.
- Parameters:
limit (
int) – Number of requests allowed withinintervalinterval (
int|Duration) – Time interval, in milisecondsburst (
int|None) – How many units may be spent at once. Only the constant-state algorithms (GCRA,TokenBucket) read it; the window algorithms admit up tolimitper window regardless. Defaults tolimit, which is classic token-bucket behaviour - a full bucket at rest.burst=1makes the output perfectly smooth.
- burst¶
- interval¶
- limit¶