我正在尝试使用Spotipy控制音乐的播放。当我尝试暂停或返回上一曲目时,出现401错误。我怀疑问题是由于Spotify对所需播放范围的授权存在问题?
我尝试将流范围和用户修改播放状态范围包含在授权请求中,但两者均导致错误。
Iallgather
以下是消息:
scope = "streaming user-modify-playback-state user-read-currently-playing"
username = "my username"
clientId = "my client id"
clientSecret = "my client secret"
redirect_url = "https://localhost/"
sp = spotipy.Spotify()
def permission():
token = util.prompt_for_user_token(username, scope, client_id=clientId, client_secret=clientSecret, redirect_uri=redirect_url)
return token
def main():
token = permission()
if token:
sp.previous_track();
main()