stravalib.util.limiter.SleepingRateLimitRule#
- class stravalib.util.limiter.SleepingRateLimitRule(priority='high', short_limit=10000, long_limit=1000000, force_limits=False)[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='high', short_limit=10000, long_limit=1000000, force_limits=False)[source]#
Constructs a new SleepingRateLimitRule. :param priority: 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. :type priority: str :param short_limit: (Optional) explicit short-term limit :type short_limit: int :param long_limit: (Optional) explicit long-term limit :type long_limit: int :param force_limits: If False (default), this rule will set/update its limits based on what the Strava API tells it. If True, the provided limits will be enforced, i.e. ignoring the limits given by the API.
Methods
__init__([priority, short_limit, ...])Constructs a new SleepingRateLimitRule.