mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-27 00:25:54 +03:00
[GH-ISSUE #772] Error 401 while trying to use 'recommendations' function #472
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#472
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 @royanglister on GitHub (Jan 15, 2022).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/772
Hello,
I have been trying to use this function:
recommendations(seed_artists=None, seed_genres=None, seed_tracks=None, limit=20, country=None, **kwargs)(syntax taken from Spotipy website), but Error 401 keeps popping up while saying that I did not provide any token. I've tried bothSpotifyClientCredentialsandSpotifyOAuth(which I am currently using) for authentication but still got no luck. It appears that there is no visible way for me to manually pass the access token through the function call as well. What am I missing?Would appreciate any help from you guys.
Best,
Roy.
@stephanebruckert commented on GitHub (Jan 16, 2022):
@royanglister how did you fix it? your solution could be useful for others in the future
@royanglister commented on GitHub (Jan 17, 2022):
@stephanebruckert I've looked at previous issues regarding this error (Error 401: no token provided) and noticed that in 99% of the times, the error popped up because there was something wrong with the structure of the arguments delivered in the request function, and not actually because of the token itself.
Then I started experiencing with different parameters in this request simulator by Spotify in order to try figuring out what the problem is.
In my case, I found out that my mistake was passing the seed artists list as a list of artist URIs, as I should've passed it as a list of artist IDs. Another mistake of mine was to think that every seed list (artists, genres, and tracks) can contain up to 5 values, while the total sum of the values should've been up to 5. For example: 2 artists, 2 genres, and 1 track, and not up to 5 values in each list.