Loup
10/30/2024, 5:11 PMLoup
10/30/2024, 5:15 PM@task
def request(self, endpoint: str, params: dict = {}) -> dict:
# rate_limit("tmdb-api")
self.api_key = self._get_next_api_key()
url = f"{self.base_url}/{endpoint}"
params["api_key"] = self.api_key
response = requests.get(url, params=params)
response.raise_for_status()
data = response.json()
if "success" in data and not data["success"]:
raise ValueError(f"Failed to get data from TMDB: {data}")
return data
How can I do the prevent hitting the rate limit of TMDB API ? (which is 50 requests per secondLoup
10/30/2024, 5:16 PMLoup
10/30/2024, 6:14 PMrate_limit("tmdb-api")
my script is very fast, 14s for making 150 api requests which is way below the rate limit. But with rate_limit enable what ever the value I set its around 40s, just why ?Loup
10/30/2024, 6:14 PMLoup
01/14/2025, 8:41 PM