【问题标题】:Spotify web API gives 500 errors oftenSpotify Web API 经常出现 500 个错误
【发布时间】:2014-08-19 16:07:46
【问题描述】:

我正在构建一个使用 python 包“spotipy”与 spotify Web API 交互的应用。

但是,我会随机收到 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 错误...

【问题讨论】:

    标签: python django spotify python-requests


    【解决方案1】:

    用于获取用户播放列表的端点昨天有点无聊,但今天它似乎工作正常。我会再试一次。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-24
      • 2020-02-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多