Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

obeservation spotipy user_playlists.py example #591

Closed
lfg6000 opened this issue Oct 20, 2020 · 2 comments · Fixed by #595
Closed

obeservation spotipy user_playlists.py example #591

lfg6000 opened this issue Oct 20, 2020 · 2 comments · Fixed by #595
Labels

Comments

@lfg6000
Copy link
Contributor

lfg6000 commented Oct 20, 2020

First i want to say thanks for contributing to Spotipy, it is really awesome.

Observation

Question

  • so i am wondering if it would be helpful to have the user_playlists.py example include the scope param?

Hopefully i have not wasted your time with by asking a question that has a really obvious answer,
Louie

original example code - the returned playlists is empty

import spotipy
from spotipy.oauth2 import SpotifyOAuth
sp = spotipy.Spotify(auth_manager=SpotifyOAuth())
playlists = sp.current_user_playlists()
for playlist in playlists['items']:
    print(playlist['name'])

modified example code - the returned playlists is populated

import spotipy
from spotipy.oauth2 import SpotifyOAuth
scope = 'playlist-read-private '
sp = spotipy.Spotify(auth_manager=SpotifyOAuth(scope=scope))
playlists = sp.current_user_playlists()
for playlist in playlists['items']:
    print(playlist['name'])

@stephanebruckert
Copy link
Member

stephanebruckert commented Oct 20, 2020

@lfg6000 nice catch, you are right according to https://developer.spotify.com/documentation/web-api/reference/playlists/get-a-list-of-current-users-playlists/.

If you know how to, it would be highly appreciated if you could open a pull request to update the example accordingly 🙏

@lfg6000
Copy link
Contributor Author

lfg6000 commented Oct 21, 2020 via email

stephanebruckert added a commit that referenced this issue Oct 23, 2020
…aylists using the spotipy api: current_user_playlists() (fixes #591) (#595)

* - Added scope, 'playlist-read-private', to examples that access user playlists using the spotipy api: current_user_playlists() (fixes #591)

* Fix example to use user_playlists again

Co-authored-by: Stephane Bruckert <stephane.bruckert@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants