【问题标题】:Python spotipy Oauth : Bad requestPython spotipy Oauth:错误请求
【发布时间】:2017-11-19 01:16:06
【问题描述】:

这是我的代码

 UserScope = 'user-library-read'
util.prompt_for_user_token(username='vulrev1',scope=UserScope,client_id="533adb3f925b488za9d3772640ec6403",client_secret='66054b185c7541fcabce67afe522449b',redirect_uri="http://127.0.0.1/callback")
lz_uri = 'spotify:artist:36QJpDe2go2KgaRleHCDTp'

spotify = spotipy.Spotify()
results = spotify.artist_top_tracks(lz_uri)

for track in results['tracks'][:10]:
    print ('track    : ' + track['name'])

我收到了

spotipy.oauth2.SpotifyOauthError: Bad Request

我不太确定这里发生了什么,我需要对主机文件做些什么吗?因为http://127.0.0.1拒绝连接

【问题讨论】:

    标签: python oauth spotify


    【解决方案1】:
    token = util.prompt_for_user_token(username='vulrev1',scope=UserScope,client_id="533adb3f925b488za9d3772640ec6403",client_secret='66054b185c7541fcabce67afe522449b',redirect_uri="http://127.0.0.1/callback")
    
    spotify = spotipy.Spotify(auth=token)
    

    您必须将令牌作为身份验证发送。而且我认为您必须将您的用户 ID 更改为您可以在您的个人资料链接中找到的特定数字。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-07-11
      • 2014-02-11
      • 1970-01-01
      • 2013-07-21
      • 1970-01-01
      • 2018-04-26
      • 2016-11-14
      • 1970-01-01
      相关资源
      最近更新 更多