Always getting Error 401 "No token provided" in Spotipy

Viewed 18
spotify = spotipy.Spotify(auth_manager=SpotifyOAuth(
            client_id=client_id,
            client_secret=client_secret,
            redirect_uri=redirect_uri,
            cache_path="token.txt",
            scope="playlist-modify-public",
            show_dialog=True
        )
        )

This is my code and I am able to successfully generate a token. But when I use the search function

result = spotify.search(q=f"track:{self.songs[0]} artist:{self.artists[0]} year:{self.year}", type=["track"],limit="1",market="ES")

I get the error { "error": { "status": 401, "message": "No token provided" } } When I search for the song using the search tool in https://developer.spotify.com/console/get-search-item/?q=&type=&market=&limit=&offset=&include_external=

I am able to get the song with the same token that I generated in my code. Why is this and how can I solve it?

0 Answers
Related