4

我正在尝试使用 Spotipy 库来提取用户曲目并制作播放列表。每个函数单独工作(getTracks、makePlaylist);但是,它们需要不同的范围。

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

这将返回错误“AttributeError: 'tuple' object has no attribute 'split'” 当我尝试将两个范围作为列表发送时,我也会收到错误。有想法该怎么解决这个吗?

4

1 回答 1

7

scope应该是单个字符串,而不是元组。

scope='user-library-read playlist-modify-private'
于 2018-11-09T02:19:47.497 回答