[Python] Why is the Spotify Get_Recommendations endpoint not working?

Discussão em 'Python' iniciado por Stack, Abril 22, 2025.

  1. Stack

    Stack Membro Participativo

    Here is my code to try to try and access the endpoint for available genre seeds.

    import requests

    token = ""

    headers = {
    "Authorization": f"Bearer {token}"
    }

    url = "https://api.spotify.com/v1/recommendations/available-genre-seeds"
    response = requests.get(url, headers=headers)

    print("Status:", response.status_code)
    print("Response:", response.json())


    I am using Spotipy to access the Spotify API.

    It keeps getting error 404, though the endpoint exists (I get error 401 for no token provided when I try to access the site on my browser). I've also tried directly using curl, wget and httpie and bypassing Spotipy, but I still arrive at error 404.

    I have logged in, and I've made sure my token is valid by trying sp.me() and also to print songs from my private playlist, both of which are working. (I get my account details and songs from the playlist respectively).

    However, it does not work to generate recommendations, and also does not work for audio_features. I also cannot get it to print songs from public playlists for some reason.

    Continue reading...

Compartilhe esta Página