pyfy icon indicating copy to clipboard operation
pyfy copied to clipboard

Rate limiting

Open haykkh opened this issue 6 years ago • 2 comments

I keep on getting 429 errors using this for my app, is there any built in rate limiting for outgoing requests using the sync client?

haykkh avatar Nov 25 '19 12:11 haykkh

Unfortunately, there isn't. We can use an exponential backoff strategy on any 429 errors as recommended by Spotify here: https://developer.spotify.com/documentation/web-api/#rate-limiting We can use this lib: https://pypi.org/project/backoff/ I'm open for pull requests if you're willing to fix this issue.

omarryhan avatar Nov 25 '19 18:11 omarryhan

I ended up using a try/except and retrying the api call after the Retry-After time. Will check backoff out, thanks!

haykkh avatar Nov 25 '19 21:11 haykkh