简体   繁体   English

Spotipy 设置 redirect_uri

[英]Spotipy set redirect_uri

This is what I'm using right now to authenticate:这就是我现在用来进行身份验证的内容:

scope = "user-library-read"

SpotifyOAuth(client_id="9af97dea1d454457ae063fd20cb00740", client_secret="91baf6b3e5c44c71be017a136ac16a5f")
sp = spotipy.Spotify(auth_manager=SpotifyOAuth(scope=scope))

But it gives me this error:但它给了我这个错误:

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: SpotifyOauthError: No redirect_uri. discord.ext.commands.errors.CommandInvokeError:命令引发异常:SpotifyOauthError:没有redirect_uri。 Pass it or set a SPOTIPY_REDIRECT_URI environment variable.传递它或设置一个 SPOTIPY_REDIRECT_URI 环境变量。

I tried setting the redirect_uri as an argument, but it says it's an unexpected keyword argument.我尝试将redirect_uri设置为参数,但它说这是一个意外的关键字参数。 Is there any way I can set the redirect_uri (without environment variables)?有什么办法可以设置redirect_uri (没有环境变量)?

Here is a part of my code I use I know works:这是我使用的我知道有效的代码的一部分:

import spotipy
from spotipy.oauth2 import SpotifyOAuth
scope = "user-library-read"
sp = spotipy.Spotify(auth_manager=SpotifyOAuth(client_id="abcdef1234567890",client_secret="fedcba0987654321",redirect_uri="http://localhost:8080",scope=scope))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM