oauth 2.0 - Spotipy (Spotify's Web API Python wrapper) examples failing -
i cloned , installed paul lamere's python wrapper spotify web api via python setup.py install can't seem run of examples correctly.
specifically, when try run user_playlists_contents.py or user_starred_playlist.py, browser launched , i'm directed spotify login page. after logging in, spotify error within browser says: "oops! went wrong." script asks url redirected to, entering in both url of login page , url of error page (obviously) trigger error within terminal: spotipy.oauth2.spotifyoautherror: bad request
at first using facebook-connected spotify account , logging in spotify through facebook when prompted, thought might issue. after creating new email-only spotify account , running scripts on new email-only username got same results.
i tried registering new app in spotify developer account , using client_id, client_secret, , redirect_uri in examples/util.py didn't seem anything. seems unlikely anyways modifying examples/util.py necessary.
thinking might browser issue reset browser (chrome) , after didn't work tried switching safari default browser did nothing.
both these scripts depend on prompt_for_user_token() defined in examples/util.py, , seems things going wrong.
what doing wrong? have missed painfully obvious? in advance.
prompt_for_user_token method looks below:
def prompt_for_user_token(username, scope=none): ''' prompts user login if necessary , returns user token suitable use spotipy.spotify constructor ''' client_id = os.getenv('client_id', 'your_client_id') client_secret = os.getenv('client_secret', 'your_client_secret') redirect_uri = os.getenv('redirect_uri', 'your_redirect_uri') . . which requires set client_id, client_secret , redirect_uri environment variables before executing example. these values creating app @ my applications section of spotify developer site
in unix, can set environment variables in command line follows:
export client_id={yourclient} export client_secret={yoursecret} export redirect_uri={your redirect uri} then need copy , paste full url redirected on browser proceed.
Comments
Post a Comment