mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-27 00:25:54 +03:00
[GH-ISSUE #17] user_playlist_add_track error #5
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#5
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 @kevlu93 on GitHub (Jul 24, 2014).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/17
Hey I'm just starting to get familiar with the api, and I'm just trying out a simple task. I'm trying to add the top 3 tracks of a given artist to a playlist.
I know authentication worked because I can access the playlists, and I set my scope to playlist-modify-private and public.
I use the following command:
sp.user_playlist_add_tracks(user, playlist_id, song['uri'])
This is the value of song['uri']:
song_uri
Out[20]: u'spotify:track:2Zb7wnGUnNPCas2E0wWSQ5'
Here's the error message:
http status: 400, code:-1 - the requested resource could not be found: https://api.spotify.com/v1/users/121142162/playlists/3LhmfLB345HX1tty3Z99u7/tracks?uris=s%2Cp%2Co%2Ct%2Ci%2Cf%2Cy%2C%3A%2Ct%2Cr%2Ca%2Cc%2Ck%2C%3A%2C2%2CZ%2Cb%2C7%2Cw%2Cn%2CG%2CU%2Cn%2CN%2CP%2CC%2Ca%2Cs%2C2%2CE%2C0%2Cw%2CW%2CS%2CQ%2C5
It seems like the uri's match up, ignoring how colons were decoded. Any ideas what the issue is?
@dansinclair25 commented on GitHub (Aug 31, 2016):
song['uri']needs to be a list.Note the method is
user_playlist_add_tracks()(tracks being plural).Just wrap the track in brackets:
sp.user_playlist_add_tracks(user, playlist_id, [song['uri']])