spotipy/examples/delete_a_saved_track.py
Hugo van Kemenade 85c9d74dc1
Drop support for EOL Python 3.7 (#1065)
* Add python_requires to help pip

* Update supported versions in tox.ini

* Upgrade Python syntax with pyupgrade --py37-plus

* Bump GitHub Actions

* Add Python 3.11 and 3.12 to CI

* Remove six dependency

* Remove redundant dependencies

* Remove redudant Python 3.5 code

* Drop support for EOL Python 3.7

* Upgrade Python syntax with pyupgrade --py38-plus

* Update CHANGELOG

* More f-strings

---------

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2024-05-21 18:32:01 +02:00

20 lines
428 B
Python

# Delete a track from 'Your Collection' of saved tracks
import pprint
import sys
import spotipy
from spotipy.oauth2 import SpotifyOAuth
scope = 'user-library-modify'
if len(sys.argv) > 1:
tid = sys.argv[1]
else:
print(f"Usage: {sys.argv[0]} track-id ...")
sys.exit()
sp = spotipy.Spotify(auth_manager=SpotifyOAuth(scope=scope))
results = sp.current_user_saved_tracks_delete(tracks=[tid])
pprint.pprint(results)