Я реализую простое приложение с spotipy
.
Я хочу пропустить следующий трек, но у меня есть эта ошибка в выводе:
spotipy.client.SpotifyException: http статус: 403, код: -1 - https://api.spotify.com/v1/me/player/next: Недоступно для текущего пользователя
Мой код:
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()