Kyle
07/10/2023, 5:02 AMclient = Redis()
rate_limiter1 = RateLimit(client, "api1", max_calls=500, expire=10)
rate_limiter2 = RateLimit(client, "api2", max_calls=100, expire=10)
while True:
if rate.check():
api_call()
rate.incr() # increment redis key
break
else:
print("Rate limit exceeded. Sleeping for 10 seconds...")
time.sleep(10) # sleep for 10 seconds
^ have NOT tested this. just a general idea. but something along these lines though.
maybe this: https://github.com/evoluxbr/python-redis-rate-limit or this https://limits.readthedocs.io/en/latest/quickstart.html