-1
我正尝试在Flask应用中使用Spotify Web API授权。我能够访问授权页面,但是一旦我登录,我就会被导向KeyError
。请求使用Python/Flask中的Spotify API从请求令牌获取令牌
这是我的代码:
# Refresh and Request
refresh = {
"grant_type": "refresh_token"
"refresh_token": "refresh_token"
}
refresh_post_request = requests.post(SPOTIFY_TOKEN_URL, data=refresh,
headers=headers)
refresh_data = json.loads(refresh_post_request.text)
the_refresh_token = refresh_data["access_token"]
user.spotify_refresh_token = the_refresh_token
db.session.commit()
SPOTIFY_TOKEN_URL
和报头前面定义。我正在使用Spotify Web Auth guidelines,但我的KeyError
一直指向“access_token”。
试着打印'refresh_data'。 'access_token'你认为它在哪里? – davidism