mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-26 16:15:51 +03:00
[GH-ISSUE #429] Valid bearer authentication required for spotify.search() #253
Labels
No labels
api-bug
bug
dependencies
documentation
duplicate
enhancement
external-ide
headless-mode
implicit-grant-flow
invalid
missing-endpoint
pr-welcome
private-api
pull-request
question
spotipy3
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/spotipy#253
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @queengooborg on GitHub (Jan 23, 2020).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/429
Unfortunately it seems that the example on the readme for performing a search is no longer functioning. Whenever attempting to perform a search, the following error occurs:
This may possibly be a Spotify API thing, but I figured to open up an issue here just in case. I'm running the latest
spotipy(2.7.1), however this appears to be an issue in earlier versions (such as 2.4.4) as well.@stephanebruckert commented on GitHub (Jan 23, 2020):
Hi @vinyldarkscratch, there was an issue with the last merge (now reverted), can you please try again with the current version (either master or 2.7.1)?
@queengooborg commented on GitHub (Jan 24, 2020):
I'm still experiencing this issue, sadly. I was already running the latest release (2.7.1) before, as I had upgraded from 2.4.4 to see if the latest release would fix the issue.
@stephanebruckert commented on GitHub (Jan 24, 2020):
Search works on my side, can you please share some code? Do you know if you get the same problem with other endpoints, for example
sp.playlist(id)?@queengooborg commented on GitHub (Jan 24, 2020):
Of course -- here's the code I'm using:
I've double-checked to make sure that the client ID and client secret I'm using match. However it appears that I'm not able to access other endpoints either (running
spotify.playlist('7xRVn4q3S4bsOc4G5x36Ci')results in the same error)...@stephanebruckert commented on GitHub (Jan 24, 2020):
I would just like to double-check, because I've seen that same error on the broken master yesterday. I'm thinking you are running that broken version somehow. Can you please do:
and try again?
@queengooborg commented on GitHub (Jan 24, 2020):
Uninstalling and reinstalling the Pip package didn't seem to help, sadly. As an additional test, I also double-checked the results on my web server, without any luck. I also checked with the latest
master(and uninstalled the pip version while I did just in case), but ended up with the same results...@queengooborg commented on GitHub (Jan 24, 2020):
I was just doing a little bit of digging around, and I may have found something interesting! I set
spotify.traceandspotify.trace_outtoTrue, and it appears that the bearer token isn't stringifying properly:(If it helps, I'm running Python 3.7.6 by the way. I realize I forgot to mention that before, whoops!)
@stephanebruckert commented on GitHub (Jan 24, 2020):
Thanks for that. Yeah it definitely looks like you are having the bug that was since then reverted.
As the token you are receiving a
SpotifyClientCredentials(old code, incorrect & reverted)github.com/plamere/spotipy@87a72a060f/spotipy/util.py (L109)instead of receiving a string (correct in 2.7.1 as well as very latest)
github.com/plamere/spotipy@26db832e24/spotipy/util.py (L109)I'm quite sure you have the incorrect version. Can you do
pip show spotipy, then it should give you the path in which spotipy is installed. Please try to delete that folder and install spotipy again@queengooborg commented on GitHub (Jan 24, 2020):
Ahhhhhh, I finally figured out what it was! And it had come down to my own stupidity. At some point, I had assumed that
client_credentials_managerwas the first kwarg, which is not actually the case. So, I was just putting inspotify = spotipy.Spotify(SpotifyClientCredentials(...))assuming that it would work, when it reality it was setting it to theauthkwarg, thus it wasn't actually calling theget_access_token()function, and just stringifying the object (as per client.py, line 97).Sorry for the hassle on this one! This certainly will serve as a reminder to check kwargs more carefully... 😅
@stephanebruckert commented on GitHub (Jan 24, 2020):
Oh, cool. What a coincidence that your error message was very close to the one I saw yesterday!
Glad you found the solution.