spotipy: Breaking change in minor version?

Hi,

Super glad to see this maintained after a long halt.

I’ve noticed after upgrading from 2.4.4. to 2.19.0 that some endpoints like search no longer work when the Spotipy object is initialized with a auth param.

My old code (now returns an error):

credentials = oauth2.SpotifyClientCredentials(
        client_id=SPOTIFY_CLIENT_ID,
        client_secret=SPOTIFY_SECRET_ID,
    )
token = credentials.get_access_token()
spotipy_obj = spotipy.Spotify(auth=token)
artist_on_spotify = spotipy_obj.search(q="X", type="artist", limit=1)

The new code:

spotipy_obj = spotipy.Spotify(client_credentials_manager=credentials)
artist_on_spotify = spotipy_obj.search(q="X", type="artist", limit=1)

Meanwhile, user-related endpoints continue to work with token.

Is this expected? I couldn’t find anything in the release notes regarding this. Maybe I didn’t look hard enough.

Also: am I correct in saying that the cache system is only for the application’s access token, not those of the application’s users?

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

Since 2.4.4, was added a new parameter as_dict.

https://github.com/plamere/spotipy/blob/06551cd0553d6e030f3f4ee7da5fac12c424bac7/spotipy/oauth2.py#L213

Looks like it should be False by default instead of True for things to remain backward-compatible

Thank you for taking the time to look into this. I guess for now if I don’t find additional issues I’ll just do:

spotipy_obj = spotipy.Spotify(client_credentials_manager=credentials)
artist_on_spotify = spotipy_obj.search(q="X", type="artist", limit=1)

By the way, is the spotipy.Spotify object designed to a be a singleton? Because in some parts of my code I repetitively initialize it en-masse, and I’m wondering if that’s what’s leading to high memory usage.