Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sp.recommendations() randomly stopped working for no clear reason? #1090

Closed
KENSICKC opened this issue Apr 26, 2024 · 4 comments
Closed

sp.recommendations() randomly stopped working for no clear reason? #1090

KENSICKC opened this issue Apr 26, 2024 · 4 comments
Labels

Comments

@KENSICKC
Copy link

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

@dieser-niko
Copy link
Member

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

@JosepVargasf
Copy link

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

@KENSICKC
Copy link
Author

KENSICKC commented 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.

@dieser-niko
Copy link
Member

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,
    ...
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants