Relative Content

Tag Archive for pythonspotifyspotipy

Spotify: Intermittent HTTPError 401 when searching for tracks

I have a script that searches for tracks using the spotify API everyhour. I have noticed that the script throws HTTPError 401 on some search requests. The script requests for new access token in every run. The following is how the authorization function works:

How to handle Spotify API fetching different track IDs over time?

I am currently working on a project that stores files as Spotify playlists. I coincidentally already had a playlist with almost exactly the right amount of tracks, so I used Spotify to fetch all 8192 (2^13) track IDs and made a lookup dictionary between each track ID and a corresponding 13bit string of binary. My program reads the binary and adds the corresponding track IDs to a playlist to write the file to the playlist, and to read the file from the playlist I fetch all the IDs from the playlist and uses the lookup dictionary to convert it back to binary.

spotipy API base-62 error for adding track to playlist

I’m running into an error using the spotipy package. It seems to say that the playlist ID or track ID isn’t valid, but I can visit the link to both and they work. Unsure what I’m doing wrong. Any help is appreciated. I’m sure I’m missing something obvious.

p.recommendations() randomly stopped working for no clear reason? (spotipy)

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 […]