Spotipy: Authorisation with Heroku

Created on 18 Jul 2015  路  2Comments  路  Source: plamere/spotipy

Hi there,

I have built an app locally using spotipy (thanks for your awesome code!) and I'm trying to push it online with Heroku. I use the util.prompt_for_user_token() function to authorise the user_playlist_create function. Since the util function requires a command line raw input I can't understand how it will work when I push it online - can you a suggest a way that I can by pass this problem?

Many thanks!

Issy

headless-mode question

Most helpful comment

I had the same problem in https://github.com/arska/srf2spotify#usage:

  1. run locally once to do the authentication
  2. copy the contents of .cache-spotifyusername into a config variable and a local .env file for testing, e.g. SPOTIPY_CACHE='{"access_token": ...}'
  3. create a small launch script that does:

!/bin/sh

echo $SPOTIPY_CACHE > .cache-spotifyusername
python yourapp.py

All 2 comments

I had the same problem in https://github.com/arska/srf2spotify#usage:

  1. run locally once to do the authentication
  2. copy the contents of .cache-spotifyusername into a config variable and a local .env file for testing, e.g. SPOTIPY_CACHE='{"access_token": ...}'
  3. create a small launch script that does:

!/bin/sh

echo $SPOTIPY_CACHE > .cache-spotifyusername
python yourapp.py

Follow this example to use spotipy in an API https://github.com/plamere/spotipy/blob/master/examples/app.py

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gawaineo picture gawaineo  路  3Comments

fortyTwo102 picture fortyTwo102  路  4Comments

sheheryarbutt picture sheheryarbutt  路  5Comments

IzHoBX picture IzHoBX  路  4Comments

Inspectiver picture Inspectiver  路  4Comments