Added an explanation for rate/request limits to FAQ (#1133)

This commit is contained in:
Niko authored and GitHub committed 2024-06-24 23:43:54 +02:00
1 parent ef282e2423
commit 5e09c78ccf
2 files changed
+23

No files matched your search

+1
View File
@@ -14,6 +14,7 @@ Add your changes below.
- Updated order of instructions for Python and pip package manager installation in TUTORIAL.md - Updated order of instructions for Python and pip package manager installation in TUTORIAL.md
- Updated TUTORIAL.md instructions to match current layout of Spotify Developer Dashboard - Updated TUTORIAL.md instructions to match current layout of Spotify Developer Dashboard
- Added test_artist_id, test_artist_url, and test_artists_mixed_ids to non_user_endpoints test.py - Added test_artist_id, test_artist_url, and test_artists_mixed_ids to non_user_endpoints test.py
- Added rate/request limit to FAQ
### Fixed ### Fixed
- Audiobook integration tests - Audiobook integration tests
+22
View File
@@ -52,3 +52,25 @@ If you cannot open a browser, set `open_browser=False` when instantiating Spotif
prompted to open the authorization URI manually. prompted to open the authorization URI manually.
See the [headless auth example](examples/headless.py). See the [headless auth example](examples/headless.py).
### My application is not responding
This is still speculation, but it seems that Spotify has two limits. A rate limit and a request limit.
- The rate limit prevents a script from requesting too much from the API in a short period of time.
- The request limit limits how many requests you can make in a 24 hour window.
The limits appear to be endpoint-specific, so each endpoint has its own limits.
If your application stops responding, it's likely that you've reached the request limit.
There's nothing Spotipy can do to prevent this, but you can follow Spotify's [Rate Limits](https://developer.spotify.com/documentation/web-api/concepts/rate-limits) guide to learn how rate limiting works and what you can do to avoid ever hitting a limit.
#### *Why* is the application not responding?
Spotipy (or more precisely `urllib3`) has a backoff-retry strategy built in, which is waiting until the rate limit is gone.
If you want to receive an error instead, then you can pass `retries=0` to `Spotify` like this:
```python
sp = spotipy.Spotify(
retries=0,
...
)
```
The error raised is a `spotipy.exceptions.SpotifyException`