mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-26 16:15:51 +03:00
[GH-ISSUE #532] Invalid context URI and bad request for URL error 400 #320
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#320
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 @Esamanoaz on GitHub (Jul 7, 2020).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/532
Describe the bug
When trying to play just one song to a Chromecast device, I get the below errors. If I pass in a list of the same song at least twice, the program runs without errors and the list of songs is played on my speaker.
My code
The entire code
Just the context needed
The smallest context possible:
# Start playbackif args.uri[0].find("track") > 0:client.start_playback(device_id=spotify_device_id, uris=args.uri)else:client.start_playback(device_id=spotify_device_id, context_uri=args.uri[0])Expected behavior
The above if/else statement should go to else because only one URI is being passed in. Then, my Google Home Mini speaker should start playing that song.
Output
Error output with device id replaced as "my_device_id_here"
Environment:
Additional context
I am using spotipy, spotify-token, and pychromecast to play music from Spotify on my Google Home Mini. The album or song URI's will be stored on NFC tags with the album cover art printed on them. Here is an example on credit, where the OP used Spotify and Sonos. I am recreating their project with casting to a Google Home speaker.
@stephanebruckert commented on GitHub (Jul 12, 2020):
If bug appears on this line, please print what
args.uriexactly equals to.urisexpects a list of track urisAnd if bug appears on this line, please print what
args.uri[0]exactly equals to.context_urishould be a string representing a urihttps://spotipy.readthedocs.io/en/2.13.0/#spotipy.client.Spotify.start_playback
@Esamanoaz commented on GitHub (Jul 12, 2020):
Nevermind, I misunderstood the parameters.
I was passing in a string containing one URI into uris. What I needed to do was pass in a list instead of a string. My bad.