Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using multiple scopes with spotipy

I'm trying to use the Spotipy library to pull user tracks and make a playlist. Each function works individually (getTracks, makePlaylist); however, they require different scopes.

def generate_token(scope):
token = util.prompt_for_user_token(
    username='al321rltkr20p7oftb0i801lk',
    scope=('user-library-read','playlist-modify-private'),
    client_id='0e7ea227ef7d407b8bf47a4c545adb3c',
    client_secret='267e96c4713f46d4885a4ea6a099ead4',
    redirect_uri='http://www.google.com')
return token

This returns the error "AttributeError: 'tuple' object has no attribute 'split'" I also get errors when I try to send the two scopes as a list. Any ideas on how to fix this?

like image 308
Sophie Avatar asked Mar 05 '23 02:03

Sophie


1 Answers

scope should be a single string, not a tuple.

scope='user-library-read playlist-modify-private'
like image 86
mjhm Avatar answered Mar 15 '23 20:03

mjhm