Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/303.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Can';t跳过Spotify API上的下一首歌曲(通过Spotipy)_Python_Spotify_Spotipy - Fatal编程技术网

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()

您只能为高级用户跳过歌曲。
检查以下物品:

仅供参考,是授权错误:

HTTP
403禁止
客户端错误状态响应代码指示 服务器理解该请求,但拒绝对其进行授权

此状态类似于重新身份验证,但在本例中为重新身份验证 不会有什么不同。永久禁止和限制进入 应用程序逻辑,例如对资源的权限不足


谢谢你的帮助@亚历山德罗米尔维尼欢迎来到StackOverflow!我建议你读书