我正在尝试使用 Spotify API,它需要客户端凭据。我已经集成了 spotipy,当我不需要请求用户信息(即只从艺术家那里下载轨道名称)但我希望访问音频功能时,它工作正常。
在什么文件/脚本中以及如何包含凭据?
这是他们在 oauth2.py 文件中所说的:
You can either provid a client_id and client_secret to the
constructor or set SPOTIPY_CLIENT_ID and SPOTIPY_CLIENT_SECRET
environment variables
https://github.com/plamere/spotipy/blob/master/examples/audio_features.py
请您参考如下方法:
我会开始here - Authorized Requests .然后你可以简单地使用这个例子:
token = util.prompt_for_user_token(username)
if token:
sp = spotipy.Spotify(auth=token)
开始做事,然后捕获你需要的东西。
