小编Ces*_*son的帖子

如何解决:使用 Spotipy 在 Python 中客户端范围不足

当我尝试在 Spotipy 中运行 cretin 模块时,我收到客户端范围不足的错误消息。Spotify 给出 403 客户端错误,提示“未提供令牌”

尝试了多个模块,只有少数工作,例如 current_user() 模块,但其他模块却吐出客户端范围不足的错误。

尝试了多个模块,只有少数工作,例如 current_user() 模块,但其他模块却吐出客户端范围不足的错误。

import spotipy
import os
import json
import sys
import webbrowser
import spotipy.util as util
from json.decoder import JSONDecodeError


username = sys.argv[0]

try:
    token = util.prompt_for_user_token(username)

except:
    os.remove(f".cache-{username}")
    token = util.prompt_for_user_token(username)


spotify = spotipy.Spotify(auth=token)

albums = spotify.current_user_saved_albums(limit= 100, offset = 0)
userplaylist = spotify.current_user_playlists()
spuser= spotify.current_user()


class spotifyUser:

    def __init__(self, userid, followers, playlist):
        self.userid = userid
        self.followers = followers
        self.playlist = playlist
        self.albums


#list all user playlists …
Run Code Online (Sandbox Code Playgroud)

python authentication oauth spotify spotipy

5
推荐指数
1
解决办法
1万
查看次数

标签 统计

authentication ×1

oauth ×1

python ×1

spotify ×1

spotipy ×1