Spotify网页API经常返回500错误
我正在开发一个应用程序,它通过使用名为'spotipy'的Python库与Spotify的网络接口进行交互。
不过,我会偶尔遇到500错误,像这样:
http status: 500, code:-1 - the requested resource could not be found: https://api.spotify.com/v1/users/[USERNAME]/playlists
这是我的工作流程(去掉了我的API密钥信息)
client_id = ''
client_secret = ''
redirect_uri = 'http://127.0.0.1:8000/spotify/'
scope = 'playlist-read-private user-read-private playlist-modify-private'
auth = oauth2.SpotifyOAuth(client_id, client_secret, redirect_uri, scope = scope)
def spotify_auth(request):
auth_url = auth.get_authorize_url()
return HttpResponseRedirect(auth_url)
在用户完成身份验证后,他们会被重定向到以下视图:
def spotify(request):
token_code = request.GET.get('code')
token = auth.get_access_token(token_code)
sp = spotipy.Spotify(auth=token['access_token'])
user = sp.me()
playlists = sp.user_playlists(user['id'])
在这个时候,我经常会遇到500错误(但不是每次都会)……
1 个回答
1
昨天获取用户播放列表的接口有点问题,但今天看起来已经正常了。我建议你再试一次。