4
我一直在試圖與spotipy驗證,使播放列表等Spotipy嘗試驗證通過OAuth
import spotipy
import spotipy.util as util
class buildPlayList():
def __init__(self,name):
scope = 'playlist-modify-public'
self.username=name
token = util.prompt_for_user_token(self.username, scope,client_id='', client_secret='',redirect_uri='http://example.com/callback/')
self.sp = spotipy.Spotify(auth=token)
print self.sp.current_user()
def make_and_build(self):
pass
x=buildPlayList("myname")
我運行它,然後我得到這個:
User authentication requires interaction with your
web browser. Once you enter your credentials and
give authorization, you will be redirected to
a url. Paste that url you were directed to to
complete the authorization.
我去該網址,這是一個錯誤,我把它發回到命令行,它的錯誤。我不知道爲什麼這個庫這樣做,所有其他人通常會做用戶名,密碼,客戶端ID和客戶端密碼。出於某種原因,這一個讓你走了一步。一些幫助將不勝感激。我正在使用所有正確的信息。我不確定這個重定向url是什麼,也許這是導致問題的原因?
嘗試了這一點,我得到了一個頁面,用於說明錯誤,我將網址粘貼回去,它說不好的請求。你必須有一個高級賬戶才能訪問api或其他東西嗎? – Eigenvalue
不,我不。你是否設置了本地服務器?(localhost) – woryzower
我不確定你的意思。爲什麼你需要一個本地服務器? – Eigenvalue