fuzeman / trakt.py

Python interface for the Trakt.tv API
http://traktpy.readthedocs.org
MIT License
153 stars 34 forks source link

Rate limiting #86

Open burkasaurusrex opened 3 years ago

burkasaurusrex commented 3 years ago

FYI, just got the following email from Trakt

As of October 27, 2020, we’re enforcing rate limiting for all API apps. You’ve created a Trakt API app, and we wanted to let you know directly. If you have any questions, please continue the discussion in the GitHub API project.

WHY ARE RATE LIMITS BEING ENFORCED? Over the past several months, Trakt performance has been negatively impacted by a huge increase in API traffic and poorly coded apps. In order to stabilize the API and increase performance for everyone, we’re turning on rate limiting. The Trakt API is free to use, and rate limiting will help us keep it that way.

WHAT UPDATES DOES MY APP NEED? Your app will need to handle the 429 HTTP status code and headers that are sent when the rate limit is exceeded. This might be built into your API library, or you might need to customize your code to handle it. The API docs have more details.

WHAT ARE THE LIMITS? /sync/history/* 2 calls every second All API methods 1,000 calls every 5 minutes

All limits are per user.

MOVING FORWARD We plan on adjusting limits until we find a balance of good performance with minimal app impact. The goal is to prevent API abuse, but allow users to use apps normally. We’ll keep the API docs updated with the current rate limits. If you have any questions, please continue the discussion in the GitHub API project.

It would be awesome if this client helped throttle API calls when a 429 response is received

aburke20 commented 3 years ago

Any updates on this ?

Still trying to figure out how to fix by myself, but I have very little idea what to actually do.

fuzeman commented 3 years ago

I think the best solution would be to implement a queue mechanism (enabled with a configuration option) that will ensure requests are processed at the allowed endpoint rate.

I'll take a look at this when I have some time available.