i trying access spotify
playlists using spotipy
, pbl
libraries. see http://pbl.readthedocs.io/en/latest/ latter.
i have this:
import sys pbl import * import spotipy import spotipy.util util def fetch(): #pbl methods here classic_rock = sample(playlistsource('rock classics'), sample_size=10) new_music = sample(playlistsource('new music tuesday'), sample_size=5) combined = shuffler(concatenate([classic_rock, new_music])) show_source(combined) scope = 'playlist-modify-public' if len(sys.argv) > 1: username = sys.argv[1] else: print "usage: %s username" % (sys.argv[0],) sys.exit() token = util.prompt_for_user_token(username, scope, client_id='a_valid_id', client_secret='a_valid_secret', redirect_uri='http://localhost:8888/callback') if token: sp = spotipy.spotify(auth=token) fetch()
if bypass snippet relative pbl methods , pbl
function call above , proceed, granted access.
results = sp.current_user_saved_tracks() item in results['items']: track = item['track'] print track['name'] + ' - ' + track['artists'][0]['name'] else: print "can't token for", username
otherwise access denied, , spotipy.oauth2.spotifyoautherror: no client id
what going on here? please help.