2016-11-09 2 views
1

Spotify API를 사용하려고하는데 클라이언트 자격 증명이 필요합니다. 나는 spotipy를 통합했으며, 사용자 정보 (즉, 아티스트의 트랙 이름 만 다운로드)를 요청할 필요가 없지만 오디오 기능에 액세스하려고 할 때 제대로 작동합니다.API 자격 증명을위한 환경 변수는 어디에 두어야합니까?

어떤 파일/스크립트에서 어떻게 자격 증명을 포함합니까?

이 그들이 oauth2.py 파일에 말할 것입니다 : 내가 here - Authorized Requests을 시작할 것

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

답변

1

. 그런 다음이 예를 간단하게 사용할 수 있습니다.

token = util.prompt_for_user_token(username) 
if token: 
    sp = spotipy.Spotify(auth=token) 

필요한 것을 시작하고 필요한 것을 얻으려면 다음과 같이하십시오.

전체 설명서는 this page을 참조하십시오. SpotifyClientCredentials을 사용하는 자세한 내용은 here을 참조하십시오.

관련 문제