stravalib.util.limiter.SleepingRateLimitRule#

class stravalib.util.limiter.SleepingRateLimitRule(priority: Literal['low', 'medium', 'high'] = 'high')[source]#

A rate limit rule that can be prioritized and can dynamically adapt its limits based on API responses. Given its priority, it will enforce a variable “cool-down” period after each response. When rate limits are reached within their period, this limiter will wait until the end of that period. It will NOT raise any kind of exception in this case.

__init__(priority: Literal['low', 'medium', 'high'] = 'high') None[source]#

Constructs a new SleepingRateLimitRule.

Parameters:

priority (Literal["low", "medium", "high"]) – The priority for this rule. When ‘low’, the cool-down period after each request will be such that the long-term limits will not be exceeded. When ‘medium’, the cool-down period will be such that the short-term limits will not be exceeded. When ‘high’, there will be no cool-down period.

Methods

__init__([priority])

Constructs a new SleepingRateLimitRule.