
By proxying every API request to the request method, we can keep track of all API requests.

Is there any way or library that I can use to limit the rate globally in python?Īfter all, I implemented my own Throttler class. And, this will violate the one time per second restriction. So, y will be called right after the execution of x without waiting another second. However, if I execute the above two functions sequentially, it looses track of the number of API calls in global scope because they are unaware of each other. y():īy decorating the functions with the limiter, I'm able to limit the rate against the two functions. And, suppose I have functions x and y in which two API calls are made. Rate_limiter = RateLimiter(max_calls=10, period=1)īecause I have several functions, which make API calls, in different places, I want to limit the API calls in global scope.įor example, suppose I want to limit the APIs call to one time per second. However, this library can only limit the rate in local scope.

I already found a nice python library ratelimiter=1.0.2.post0 I'm trying to restrict the API calls in my code.
