使用Spotipy并尝试' current_user_recently_played'
token = util.prompt_for_user_token(username, scope = scope, client_id=client_id, client_secret=client_secret, redirect_uri=redirect_uri)
sp = spotipy.Spotify(auth = token)
saved = sp.current_user_saved_tracks()
print(saved)
recent = sp.current_user_recently_played()
print(recent)
sp.current_user_saved_tracks()运行得很好,sp.current_user_recently_played()显然不存在,即使它显然在文档https://spotipy.readthedocs.io/en/latest/#more-examples中。
跑步 - v2.4.4 - 2017年1月4日
提前谢谢。
Traceback (most recent call last):
File "C:\Users\Martin\Google Drive\Python\Spotify\try_req.py", line 19, in <module>
recent = sp.current_user_recently_played()
AttributeError: 'Spotify' object has no attribute 'current_user_recently_played'
答案 0 :(得分:4)
您必须手动获取代码。 The installation via pip is outdated.
导航到您安装Spotipy的位置(对我来说是C:\Users\[myName]\AppData\Local\Programs\Python\Python36-32\Lib\site-packages\spotipy
),打开client.py
并将代码替换为找到的新代码here。
答案 1 :(得分:0)