Python Can';t跳过Spotify API上的下一首歌曲(通过Spotipy)
我正在用Python Can';t跳过Spotify API上的下一首歌曲(通过Spotipy),python,spotify,spotipy,Python,Spotify,Spotipy,我正在用spotipy实现一个简单的应用程序 我想跳过下一个曲目,但输出中出现以下错误: spotipy.client.SpotifyException:http状态:403,代码:-1-: 不适用于当前用户 我的代码: import os import spotipy import spotipy.util as util from json.decoder import JSONDecodeError # Set data client, redirect URL and usernam
spotipy
实现一个简单的应用程序我想跳过下一个曲目,但输出中出现以下错误: spotipy.client.SpotifyException:http状态:403,代码:-1-: 不适用于当前用户 我的代码:
import os
import spotipy
import spotipy.util as util
from json.decoder import JSONDecodeError
# Set data client, redirect URL and username
username = 'xxxx'
client_id = 'xxxxxxxx'
client_secret = 'xxxxxxxx'
redirect_uri = 'https://www.xxxxx.it/'
scope = 'user-modify-playback-state'
# Erase cache and prompt for user permission
try:
token = util.prompt_for_user_token(username, scope, client_id, client_secret, redirect_uri)
except (AttributeError, JSONDecodeError):
os.remove(f".cache-{username}")
token = util.prompt_for_user_token(username, scope, client_id, client_secret, redirect_uri)
# Configure Spotify
sp = spotipy.Spotify(auth=token)
current = sp.next_track()
您只能为高级用户跳过歌曲。
检查以下物品:
403禁止
客户端错误状态响应代码指示
服务器理解该请求,但拒绝对其进行授权
此状态类似于重新身份验证,但在本例中为重新身份验证
不会有什么不同。永久禁止和限制进入
应用程序逻辑,例如对资源的权限不足
谢谢你的帮助@亚历山德罗米尔维尼欢迎来到StackOverflow!我建议你读书