pyrate_limiter.abstracts.rate module#

Unit classes that deals with rate, item & duration

class pyrate_limiter.abstracts.rate.Duration(value)#

Bases: enum.Enum

Interval 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)#

Bases: object

Rate definition.

Parameters
  • limit (int) – Number of requests allowed within interval

  • interval (Union[int, Duration]) – Time interval, in miliseconds

interval#
limit#
class pyrate_limiter.abstracts.rate.RateItem(name, timestamp, weight=1)#

Bases: object

RateItem is a wrapper for bucket to work with

name#
timestamp#
weight#