【发布时间】:2020-02-21 21:47:04
【问题描述】:
我正在尝试在 Python 中使用 Spotify API 之一,你可以找到这个 here
在我尝试使用 start_playback() 函数播放一些音乐之前,一切正常(除了开始部分,我没有做太多事情)。
在文档中,据说范围必须是用户读取播放状态,但即使使用此范围,这也不起作用。
这是我写的:
scope = 'user-read-playback-state'
token = util.prompt_for_user_token(username,
scope,
client_id=clientID,
client_secret=clientsecret,
redirect_uri="http://google.com/")
# création of spotify object
spotifyObject = spotipy.Spotify(auth=token)
# the url of one of my playlist
iden = "6a0PMD9AsNoK3XD5Nnheig"
# here, I want to play a music of the paylist i've just chosen
spotifyObject.start_playback(context_uri = iden)
# and the problem is here
问题是:https://api.spotify.com/v1/me/player/play: 缺少权限
我不明白为什么,而且我还很新,所以可能是新手错误或其他原因 感谢您未来的帮助:)
【问题讨论】:
-
如果您设法修复它,您应该发布您的解决方案作为答案。然后,您应该能够接受该答案,并将问题标记为已解决。