我收到了我的
OAuth token
,范围如下:
用户库读取 播放列表阅读私人 播放列表阅读协作 播放列表-修改-私有 播放列表修改公开
我所有的 api 调用都有效,除了
Get User's Saved Tracks
返回 500
。我在 30 分钟内尝试了多次呼叫,但响应没有任何变化。下面是我的代码,如果我的代码中有任何要修复的东西,或者它真的在 Spotify 端,谁能确认它是否真的存在?
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': 'Bearer {0}'.format(oauth_token),
}
params = (
('market', 'US'),
('limit', '50'),
('offset', '0')
)
int_response = 429
while int_response == 429:
response = requests.get('https://api.spotify.com/v1/me/tracks', headers=headers, params=params)
print('get response: ', response)
int_response = response.status_code
if int_response == 429:
print('Retry-After: {0}'.format(response.headers['Retry-After']))
print('ˆˆˆˆˆˆˆˆˆˆˆˆˆ')
time.sleep(int(response.headers['Retry-After'])+1)
json_response = json.loads(response.content)
try:
json_items = json_response['items']
except:
print(json.dumps(json_response, indent=3, sort_keys=True))