mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-27 00:25:54 +03:00
[GH-ISSUE #700] KeyError 'total' #414
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#414
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 @sk0903 on GitHub (Jun 30, 2021).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/700
I am creating a user dashboard using plotly and flask to display the top tracks and top artists preferred by a user. My code has been working fine but suddenly I got this error.

These are the code blocks
@Peter-Schorn commented on GitHub (Jun 30, 2021):
You probably got an error because the access token expired. Why are you making the requests manually? That doesn't make any sense. Automatically refreshing the access token is something spotipy does for you. spotipy supports all Spotify web API endpoints. See
Spotify.current_user_top_artistsandSpotify.current_user_top_tracks.@sk0903 commented on GitHub (Jun 30, 2021):
Oh okay. Yes I understand, Since I am new to using it, I'm initially familiarizing myself with the APIs and then work on in using spotipy.
Thanks
@sk0903 commented on GitHub (Jun 30, 2021):
Hi, also just a quick doubt, I was able to create a new playlist on spotify by extracting my past playlists through recommendations by using the spotify API directly but wasnt able to extract the user top tracks. Does that still have to do with an expired access token? I may have to read more on this but it would be great if you can help me on that.
@Peter-Schorn commented on GitHub (Jun 30, 2021):
It's hard to say because you haven't provided enough information. In particular, I don't know how you're retrieving the authorization header. Once again, this is something spotipy can do for you. Using both spotipy and manual requests is likely going to cause more issues. Furthermore, if you receive a key error when trying to access a key in a dictionary, you need to print the entire dictionary to the console in order to see what data Spotify is returning. It it likely returning an error response that will provide you with more information.
@sk0903 commented on GitHub (Jul 1, 2021):
Oh alright. I am posting my auth code so that you get an idea where the error could have occured . Again, I do understand that spotipy does it in an easier way but for learning purpose I incorporated the manual request as well. And, yes I will try to debug it in my console as well.
@dieser-niko commented on GitHub (May 1, 2024):
Do you still have an issue to resolve or can we close this?
@dieser-niko commented on GitHub (May 21, 2024):
It appears that @sk0903 has no other activity on his account besides this issue. Closing.