[GH-ISSUE #844] Spotipy hangs, no errors #520

Closed
opened 2026-02-27 23:23:06 +03:00 by kerem · 4 comments
Owner

Originally created by @deramirez1 on GitHub (Aug 10, 2022).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/844

Describe the bug
There is an issue with logging and exception handling.

Your code
To recreate this I just used one of the examples from the documents:
image
Simply passing in some valid credentials and seeing if I can get albums from an artist. I ran this in a loop 10-20 times in a short period of time, with my app in developer mode.

After much digging, I was able to track the problem down by stepping through some functions until I got to the actual GET HTTP request. I looked at the payload, extracted the token, and checked if it was valid. It was not.
image

I'm in developer mode, without a quota extension. I believe the issue is actually stemming from this rate limit. I've waited a couple days, the problem resolved itself but then after a few calls it came back. Is there an error with the callback that's not returning the 429 error expected here?

Expected behavior
I expected to get a list of albums from this artist but that didn't happen.

Output
Probably the most frustrating of all is that it just hangs. There's no callback saying the token is invalid, or a rate limit has been exceeded, it just spins and spins. The warning expected from Spotify would actually be very helpful. It'll say how long we need to wait until we should execute another HTTP request.

Environment:

  • OS: Windows 10
  • Python version: 3.8.3
  • spotipy version: 2.20
  • your IDE: originally Jupyter Notebook, but then VS Code has the same problem
Originally created by @deramirez1 on GitHub (Aug 10, 2022). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/844 **Describe the bug** There is an issue with logging and exception handling. **Your code** To recreate this I just used one of the examples from the documents: ![image](https://user-images.githubusercontent.com/16377930/183942990-9c3e06df-643f-4853-bf81-cc293ee90280.png) Simply passing in some valid credentials and seeing if I can get albums from an artist. I ran this in a loop 10-20 times in a short period of time, with my app in developer mode. After much digging, I was able to track the problem down by stepping through some functions until I got to the actual GET HTTP request. I looked at the payload, extracted the token, and checked if it was valid. It was not. ![image](https://user-images.githubusercontent.com/16377930/183942139-a54ba617-3a87-4248-b717-19362f1e8433.png) I'm in developer mode, without a quota extension. I believe the issue is actually stemming from this rate limit. I've waited a couple days, the problem resolved itself but then after a few calls it came back. Is there an error with the callback that's not returning the 429 error expected [here](https://developer.spotify.com/documentation/web-api/guides/rate-limits/)? **Expected behavior** I expected to get a list of albums from this artist but that didn't happen. **Output** Probably the most frustrating of all is that it just hangs. There's no callback saying the token is invalid, or a rate limit has been exceeded, it just spins and spins. The warning expected from Spotify would actually be very helpful. It'll say how long we need to wait until we should execute another HTTP request. **Environment:** - OS: Windows 10 - Python version: 3.8.3 - spotipy version: 2.20 - your IDE: originally Jupyter Notebook, but then VS Code has the same problem
kerem 2026-02-27 23:23:06 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@OleHalvor commented on GitHub (Sep 20, 2022):

I'm having the same issue. No errors, the code just hangs when doing spotipy calls.
OS: Windows 10
python version: 3.8.3
spotipy version: 2.23.0
IDE: Pycharm

<!-- gh-comment-id:1252631418 --> @OleHalvor commented on GitHub (Sep 20, 2022): I'm having the same issue. No errors, the code just hangs when doing spotipy calls. OS: Windows 10 python version: 3.8.3 spotipy version: 2.23.0 IDE: Pycharm
Author
Owner

@nickwan commented on GitHub (Sep 22, 2022):

i'm also having the same issue in Google Colab

link to notebook
https://colab.research.google.com/drive/1mWRiGMRXU13PQFSLTtuLlnRNdXO2G7-D?usp=sharing


Update: i was previously using SpotifyOAuth so i tried SpotifyClientCredentials and it ended up working. didn't change anything else. same notebook as above.

<!-- gh-comment-id:1254466452 --> @nickwan commented on GitHub (Sep 22, 2022): i'm also having the same issue in Google Colab link to notebook https://colab.research.google.com/drive/1mWRiGMRXU13PQFSLTtuLlnRNdXO2G7-D?usp=sharing --- Update: i was previously using `SpotifyOAuth` so i tried `SpotifyClientCredentials` and it ended up working. didn't change anything else. same notebook as above.
Author
Owner

@jkulak commented on GitHub (Nov 2, 2022):

Check if you are not getting a 429 error (too many requests per Spotify client ID).

<!-- gh-comment-id:1301429209 --> @jkulak commented on GitHub (Nov 2, 2022): Check if you are not getting a 429 error (too many requests per Spotify client ID).
Author
Owner

@stephanebruckert commented on GitHub (Mar 30, 2023):

Let's continue this discussion in https://github.com/spotipy-dev/spotipy/issues/913

<!-- gh-comment-id:1491018685 --> @stephanebruckert commented on GitHub (Mar 30, 2023): Let's continue this discussion in https://github.com/spotipy-dev/spotipy/issues/913
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotipy#520
No description provided.