I'm using the Spotify API with the Spotipy Python library, and I'm facing an issue where some methods work perfectly while others return a 404 error. This suggests that my API credentials and authentication setup are correct.
For example, retrieving the tracks from an album works fine:
nevermind = 'spotify:album:2UJcKiJxNryhL050F5Z1Fk'
canciones = sp.album_tracks(nevermind, limit=50, offset=0, market=None)
lista = canciones['items']
for dic in lista:
nombre = dic['name']
print("Nombre: {}".format(nombre))
However, when I try to get related artists for Nirvana, I receive a 404 error:
nirvana = 'spotify:artist:6olE6TJLqED3rqDCT0FyPh'
recomendacion = sp.artist_related_artists(nirvana)
Error message:
HTTP Error for GET to with Params: {} returned 404 due to Not Found
I don't understand why some endpoints work while others fail. The artist ID is correct, and other API calls are functioning, so the issue shouldn't be related to authentication. Could this be a problem with the API itself, Spotipy, or something else I'm missing?
Any help would be greatly appreciated!
Tracks from an album
Related artist for Nirvana
I tried calling different Spotipy methods to retrieve data from the Spotify API. Some methods, like sp.album_tracks(), work correctly and return the expected data, but others, like sp.artist_related_artists(), return a 404 error.
I expected all valid API calls to return the corresponding data, assuming my authentication was correct. Instead, only some methods work, while others fail with a "Not Found" error, even though the artist ID exists. This inconsistency is confusing, and I’m unsure if it’s an issue with Spotipy, the API, or something else.
I'm using the Spotify API with the Spotipy Python library, and I'm facing an issue where some methods work perfectly while others return a 404 error. This suggests that my API credentials and authentication setup are correct.
For example, retrieving the tracks from an album works fine:
nevermind = 'spotify:album:2UJcKiJxNryhL050F5Z1Fk'
canciones = sp.album_tracks(nevermind, limit=50, offset=0, market=None)
lista = canciones['items']
for dic in lista:
nombre = dic['name']
print("Nombre: {}".format(nombre))
However, when I try to get related artists for Nirvana, I receive a 404 error:
nirvana = 'spotify:artist:6olE6TJLqED3rqDCT0FyPh'
recomendacion = sp.artist_related_artists(nirvana)
Error message:
HTTP Error for GET to https://api.spotify/v1/artists/6olE6TJLqED3rqDCT0FyPh/related-artists with Params: {} returned 404 due to Not Found
I don't understand why some endpoints work while others fail. The artist ID is correct, and other API calls are functioning, so the issue shouldn't be related to authentication. Could this be a problem with the API itself, Spotipy, or something else I'm missing?
Any help would be greatly appreciated!
Tracks from an album
Related artist for Nirvana
I tried calling different Spotipy methods to retrieve data from the Spotify API. Some methods, like sp.album_tracks(), work correctly and return the expected data, but others, like sp.artist_related_artists(), return a 404 error.
I expected all valid API calls to return the corresponding data, assuming my authentication was correct. Instead, only some methods work, while others fail with a "Not Found" error, even though the artist ID exists. This inconsistency is confusing, and I’m unsure if it’s an issue with Spotipy, the API, or something else.
Share Improve this question asked Jan 31 at 17:13 Tomas TsangoulasTomas Tsangoulas 191 silver badge1 bronze badge 01 Answer
Reset to default 0This is because Related Artists is deprecated in the Spotify API as of November 27, 2024.