update to use new authorize method

This commit is contained in:
David Todd 2018-04-24 23:37:46 -05:00
parent a469ce59e9
commit 2c394bc45a
1 changed files with 5 additions and 9 deletions

View File

@ -10,13 +10,9 @@ else:
print "Usage: %s username" % (sys.argv[0],)
sys.exit()
token = util.prompt_for_user_token(username, scope)
sp = util.authorize_api(username, scope, 'server')
if token:
sp = spotipy.Spotify(auth=token)
results = sp.current_user_saved_tracks()
for item in results['items']:
track = item['track']
print track['name'] + ' - ' + track['artists'][0]['name']
else:
print "Can't get token for", username
results = sp.current_user_saved_tracks()
for item in results['items']:
track = item['track']
print track['name'] + ' - ' + track['artists'][0]['name']