mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-27 00:25:54 +03:00
[GH-ISSUE #694] Key Error ['items'] #412
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#412
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 @Srijha09 on GitHub (Jun 23, 2021).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/694
Hi, since I'm new to APIs, I'm trying to get accustomed to using Spotify API for creating a Flask Application. I got a key error when i was trying to extract a user's recently played tracks.

I am not able to identify why this error occured. Could you please let me the the cause of the error?
Below is the code
Flask app
@Peter-Schorn commented on GitHub (Jun 23, 2021):
This endpoint does not exist. That's your first problem. Why don't you use the spotipy library instead of making the requests manually?
Spotify does not return the user id during the authentication process.
@Srijha09 commented on GitHub (Jun 23, 2021):
Oh okay. Yes sure, i'll do that. Also, is there a way where I can retrieve any user's recently played songs when they login through my Flask application?
@Peter-Schorn commented on GitHub (Jun 23, 2021):
Use this method to retrieve the user's recently played tracks:
github.com/plamere/spotipy@06551cd055/spotipy/client.py (L1432)See this example for how to use spotipy with flask.
@Srijha09 commented on GitHub (Jun 23, 2021):
Thanks alot!
@Srijha09 commented on GitHub (Jun 24, 2021):
Hi, is it possible to get recently played tracks from other user by using their user id when the login through my application?
Since this API endpoint is only for the current user https://api.spotify.com/v1/me/player/recently-played?limit={limit} ?
@Peter-Schorn commented on GitHub (Jun 24, 2021):
No, you can only get the recently played tracks for the current user. The spotipy documentation describes all of the available endpoints. You should also read the Spotify web API reference. If you don't see what you're looking for on those pages, then it's not possible.
@Srijha09 commented on GitHub (Jun 24, 2021):
Oh okay. Thanks