首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何从Spotipy中解决此客户端ID错误?

如何从Spotipy中解决此客户端ID错误?
EN

Stack Overflow用户
提问于 2020-08-13 23:55:41
回答 1查看 383关注 0票数 0

我正在尝试用python做一个Spotify项目,我得到了这个错误。"No client_id。请传递它或设置spotipy_client_id环境变量。“

下面是我的代码:

代码语言:javascript
复制
import spotipy
from spotipy.oauth2 import SpotifyClientCredentials

surfaces_url = 'https://open.spotify.com/artist/4ETSs924pXMzjIeD6E9b4u'

spotify = spotipy.Spotify(client_credentials_manager=SpotifyClientCredentials())

results = spotify.artist_albums(surfaces_url, album_type='album')
albums = results['items']

while results['next']:
    results = spotify.next(results)
    albums.extend(results['items'])

for album in albums:
    print(album['name'])
EN

回答 1

Stack Overflow用户

发布于 2020-08-14 00:01:18

不使用环境变量进行身份验证的正确方法是使用SpotifyOAuth并提供以下凭据:

代码语言:javascript
复制
spotify = spotipy.Spotify(auth_manager = SpotifyOAuth(client_id = '',
                                                      client_secret = '',
                                                      redirect_uri = '',
                                                      user = ''))
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63398858

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档