spotipy/examples/my_playlists.py
Sebastien (Work) 0eeeeb4a50 Remove unused imports
All imported modules that were note used in examples
    have been removed.
2017-10-23 22:50:05 +01:00

25 lines
533 B
Python

# Shows the top artists for a user
import sys
import spotipy
import spotipy.util as util
if len(sys.argv) > 1:
username = sys.argv[1]
else:
print("Usage: %s username" % (sys.argv[0],))
sys.exit()
scope = ''
token = util.prompt_for_user_token(username, scope)
if token:
sp = spotipy.Spotify(auth=token)
sp.trace = False
results = sp.current_user_playlists(limit=50)
for i, item in enumerate(results['items']):
print("%d %s" %(i, item['name']))
else:
print("Can't get token for", username)