Code: Select all
parameters = {
"grant_type":"authorization_code",
"code": code,
"redirect_uri":SPOTIFY_URI
}
auth_string = base64.urlsafe_b64encode(f"{SPOTIFY_ID}:{SPOTIFY_SECRET}".encode("utf-8"))
headers = {
"Content-Type": "application/x-www-form-urlencoded",
"Authorization": f"Basic {auth_string.decode('utf-8')}",
}
response = requests.post(
"https://accounts.spotify.com/api/token", params=parameters,
headers=headers
)
response.raise_for_status()
print(response)
< /code>
Und hier ist die Erhöhung der Fehlermeldung: < /p>
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: