Skip to content

Commit 5e09c78

Browse files
authored
Added an explanation for rate/request limits to FAQ (#1133)
1 parent ef282e2 commit 5e09c78

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Add your changes below.
1414
- Updated order of instructions for Python and pip package manager installation in TUTORIAL.md
1515
- Updated TUTORIAL.md instructions to match current layout of Spotify Developer Dashboard
1616
- Added test_artist_id, test_artist_url, and test_artists_mixed_ids to non_user_endpoints test.py
17+
- Added rate/request limit to FAQ
1718

1819
### Fixed
1920
- Audiobook integration tests

FAQ.md

+23-1
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,26 @@ must be specified: `search("abba", market="DE")`.
5151
If you cannot open a browser, set `open_browser=False` when instantiating SpotifyOAuth or SpotifyPKCE. You will be
5252
prompted to open the authorization URI manually.
5353

54-
See the [headless auth example](examples/headless.py).
54+
See the [headless auth example](examples/headless.py).
55+
56+
### My application is not responding
57+
58+
This is still speculation, but it seems that Spotify has two limits. A rate limit and a request limit.
59+
60+
- The rate limit prevents a script from requesting too much from the API in a short period of time.
61+
- The request limit limits how many requests you can make in a 24 hour window.
62+
The limits appear to be endpoint-specific, so each endpoint has its own limits.
63+
64+
If your application stops responding, it's likely that you've reached the request limit.
65+
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.
66+
67+
#### *Why* is the application not responding?
68+
Spotipy (or more precisely `urllib3`) has a backoff-retry strategy built in, which is waiting until the rate limit is gone.
69+
If you want to receive an error instead, then you can pass `retries=0` to `Spotify` like this:
70+
```python
71+
sp = spotipy.Spotify(
72+
retries=0,
73+
...
74+
)
75+
```
76+
The error raised is a `spotipy.exceptions.SpotifyException`

0 commit comments

Comments
 (0)