[GH-ISSUE #591] obeservation spotipy user_playlists.py example #352

Closed
opened 2026-02-27 23:22:09 +03:00 by kerem · 2 comments
Owner

Originally created by @lfg6000 on GitHub (Oct 20, 2020).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/591

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'])

Originally created by @lfg6000 on GitHub (Oct 20, 2020). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/591 First i want to say thanks for contributing to Spotipy, it is really awesome. Observation ------------------- - I took this example for a spin: user_playlists.py (https://github.com/plamere/spotipy/blob/master/examples/user_playlists.py) but received an empty list so i added a scope param to the oAuth call and was able to get my playlists. - admittedly all my playlists are private - below i have the original example code and the modified example code with a scope param 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']) ``` -------------------------------------------------------------------------------------------------
kerem 2026-02-27 23:22:09 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@stephanebruckert commented on GitHub (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 🙏

<!-- gh-comment-id:713149983 --> @stephanebruckert commented on GitHub (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 🙏
Author
Owner

@lfg6000 commented on GitHub (Oct 21, 2020):

ok, i will open a pull request (it will be my first so it may be a few days
as work thru it).

On Tue, Oct 20, 2020 at 5:27 PM Stéphane Bruckert notifications@github.com
wrote:

@lfg6000 https://github.com/lfg6000 nice catch, that makes sense. If
you know how to, it would be highly appreciated if you could open a pull
request to update the example accordingly 🙏


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/plamere/spotipy/issues/591#issuecomment-713149983,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ACBTRWK7CQXOIYGBUD5HXELSLX6F5ANCNFSM4SYZMIOA
.

<!-- gh-comment-id:713700739 --> @lfg6000 commented on GitHub (Oct 21, 2020): ok, i will open a pull request (it will be my first so it may be a few days as work thru it). On Tue, Oct 20, 2020 at 5:27 PM Stéphane Bruckert <notifications@github.com> wrote: > @lfg6000 <https://github.com/lfg6000> nice catch, that makes sense. If > you know how to, it would be highly appreciated if you could open a pull > request to update the example accordingly 🙏 > > — > You are receiving this because you were mentioned. > Reply to this email directly, view it on GitHub > <https://github.com/plamere/spotipy/issues/591#issuecomment-713149983>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/ACBTRWK7CQXOIYGBUD5HXELSLX6F5ANCNFSM4SYZMIOA> > . >
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotipy#352
No description provided.