play_pause
Play, pause, or toggle the current Spotify playback state. Choose the action via the optional parameter.
Instructions
Control Spotify playback – play, pause, or toggle the current state.
Parameters
action : str, optional
One of "play", "pause", or "toggle" (default).
Returns
dict
{"status": "playing" | "paused" | "no_active_device"}
Raises
ValueError
If action is not one of the accepted values.
spotipy.SpotifyException
Propagated if the Spotify API returns a non-2xx response.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | No | toggle |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||