mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-27 08:35:49 +03:00
[GH-ISSUE #771] Error 400 when trying to add a track to a playlist. #469
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#469
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 @MarcoMorandin on GitHub (Jan 14, 2022).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/771
I am trying to add tracks into a my own playlist. When I execute the code I get this error:
HTTP Error for POST to https://api.spotify.com/v1/playlists/(playlistID)/tracks with Params: {'position': None} returned 400 due to Invalid track uri: spotify:track:3I guess it sends only the first character of the id of the song (in this case is 3).
Here is my code:
`
import spotipy
from spotipy.oauth2 import SpotifyOAuth
sp = spotipy.Spotify(auth_manager=SpotifyOAuth(client_id="(client_id)",
client_secret="(client_secret)",
redirect_uri="http://localhost:8080",
scope="user-library-read playlist-modify-public"))
t = '(trackID)'
print(sp.playlist_add_items('(playlistID)', t))
`
Have you got some hint?
Thanks in advice.
@stephanebruckert commented on GitHub (Jan 15, 2022):
You need to pass a list to
playlist_add_items, soplaylist_add_items(["spotify:track:3xxxxxx"])@stephanebruckert commented on GitHub (Jan 15, 2022):
TODO: since this issue comes back a lot, let's allow passing a single spotify URI