[GH-ISSUE #1090] sp.recommendations() randomly stopped working for no clear reason? #648

Closed
opened 2026-02-28 00:00:31 +03:00 by kerem · 4 comments
Owner

Originally created by @KENSICKC on GitHub (Apr 26, 2024).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/1090

scope = "user-library-read user-top-read user-read-private user-read-email" 
sp = spotipy.Spotify(auth_manager=SpotifyOAuth(scope=scope)) 
recommendations = sp.recommendations(seed_genres=['pop'], limit=1)
print(recommendations)

This code was working perfectly earlier, but it randomly stopped working. I have SPOTIPY_CLIENT_ID, SPOTIPY_CLIENT_SECRET, and SPOTIPY_REDIRECT_URI all defined as environment variables. When I run functions such as sp.current_user_top_tracks(), sp.artist(), and others, they all work fine.

When I run sp.recommendations(), nothing gets returned or printed; I get no error message, the program just hangs indefinitely. I have to restart visual studio to be able to run anything again. Again, I was having no issues with sp.recommendations() a few hours ago. I genuinely do not know what happened.
Thanks in advance

Originally created by @KENSICKC on GitHub (Apr 26, 2024). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/1090 ``` scope = "user-library-read user-top-read user-read-private user-read-email" sp = spotipy.Spotify(auth_manager=SpotifyOAuth(scope=scope)) recommendations = sp.recommendations(seed_genres=['pop'], limit=1) print(recommendations) ``` This code was working perfectly earlier, but it randomly stopped working. I have SPOTIPY_CLIENT_ID, SPOTIPY_CLIENT_SECRET, and SPOTIPY_REDIRECT_URI all defined as environment variables. When I run functions such as sp.current_user_top_tracks(), sp.artist(), and others, they all work fine. When I run sp.recommendations(), nothing gets returned or printed; I get no error message, the program just hangs indefinitely. I have to restart visual studio to be able to run anything again. Again, I was having no issues with sp.recommendations() a few hours ago. I genuinely do not know what happened. Thanks in advance
kerem 2026-02-28 00:00:31 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@dieser-niko commented on GitHub (Apr 27, 2024):

How often do you run that function? Might be a ratelimit

<!-- gh-comment-id:2081185874 --> @dieser-niko commented on GitHub (Apr 27, 2024): How often do you run that function? Might be a ratelimit
Author
Owner

@JosepVargasf commented on GitHub (May 9, 2024):

Wow i have this same issue with the function "sp.track(track_id)" have you found a solution?

<!-- gh-comment-id:2102976186 --> @JosepVargasf commented on GitHub (May 9, 2024): Wow i have this same issue with the function "sp.track(track_id)" have you found a solution?
Author
Owner

@KENSICKC commented on GitHub (May 9, 2024):

Wow i have this same issue with the function "sp.track(track_id)" have you found a solution?

I did not find a solution unfortunately. I think it is a rate limit like dieser-niko said. If I stop running the function for 30-60 mins it starts working again.

<!-- gh-comment-id:2103086463 --> @KENSICKC commented on GitHub (May 9, 2024): > Wow i have this same issue with the function "sp.track(track_id)" have you found a solution? I did not find a solution unfortunately. I think it is a rate limit like dieser-niko said. If I stop running the function for 30-60 mins it starts working again.
Author
Owner

@dieser-niko commented on GitHub (May 21, 2024):

I'm closing the issue as it seems that you found the problem. If you want to get an error message instead, just do the following:

sp = spotipy.Spotify(
    retries=0,
    ...
)
<!-- gh-comment-id:2123443646 --> @dieser-niko commented on GitHub (May 21, 2024): I'm closing the issue as it seems that you found the problem. If you want to get an error message instead, just do the following: ```python3 sp = spotipy.Spotify( retries=0, ... ) ```
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#648
No description provided.