-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