wait_limit_rate#

CallLimiter.wait_limit_rate(max_calls: int = 5, period: float = 1, scope: str = 'default')[source]#

지정된 시간 간격 동안 최대 호출 횟수를 초과하지 않도록 기다립니다.

호출 윈도우를 관리하여 max_calls 및 period를 기반으로 호출이 허용될 때까지 대기합니다. ‘scope’에 따라 다른 API 또는 함수 호출에 대해 다른 제한을 설정할 수 있습니다.

Parameters:
  • max_calls (int) – 지정된 시간 동안 허용되는 최대 호출 횟수.

  • period (float) – 호출 제한을 적용할 시간 간격(초).

  • scope (str) – 호출 제한을 적용할 범위 또는 이름.

Examples

>>> call_limiter = CallLimiter()
>>> call_limiter.wait_limit_rate(10, 60, 'api_calls')