Created
January 21, 2020 02:48
-
-
Save laixintao/1aa72167c65e1ba28767e2cad21da0cc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from ratelimit import limits, sleep_and_retry | |
from time import time | |
count = 0 | |
@sleep_and_retry | |
@limits(calls=3, period=5) | |
def call_api(): | |
print(f"called! on {time()=} {count=}") | |
while 1: | |
call_api() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://github.com/tomasbasham/ratelimit