From edd3f29a2c6dacd7d5358968ab48584fa47d96af Mon Sep 17 00:00:00 2001 From: Mason Stephenson <86178444+masstep@users.noreply.github.com> Date: Sat, 10 Dec 2022 10:27:29 -0600 Subject: [PATCH] Getting Started Clarifications and Example Code File (#904) * added URI link to README getting started * revised comment * added alternate module installation instruction * installation troubleshooting comment * scope clarification comment * added playlist_add_items.py to examples folder * reformatted changelog edits * Relocated added contributions to added section in Changelog * removed unnecessary library installation instruction * Clarified alternative installation instruction --- CHANGELOG.md | 4 ++++ README.md | 8 ++++++++ examples/playlist_add_items.py | 13 +++++++++++++ examples/show_artist_top_tracks.py | 1 + 4 files changed, 26 insertions(+) create mode 100644 examples/playlist_add_items.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 0be2886f..ca840e14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- Add alternative module installation instruction to README +- Added Comment to README - Getting Started for user to add URI to app in Spotify Developer Dashboard. +- Added playlist_add_tracks.py to example folder + ### Fixed - Update contributing.md diff --git a/README.md b/README.md index a525959d..aff9a396 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,12 @@ Spotipy's full documentation is online at [Spotipy Documentation](http://spotipy pip install spotipy ``` +alternatively, for Windows users + +```bash +py -m pip install spotipy +``` + or upgrade ```bash @@ -43,6 +49,8 @@ for idx, track in enumerate(results['tracks']['items']): ### With user authentication +A redirect URI must be added to your application at [My Dashboard](https://developer.spotify.com/dashboard/applications) to access user authenticated features. + ```python import spotipy from spotipy.oauth2 import SpotifyOAuth diff --git a/examples/playlist_add_items.py b/examples/playlist_add_items.py new file mode 100644 index 00000000..c4125157 --- /dev/null +++ b/examples/playlist_add_items.py @@ -0,0 +1,13 @@ +# Add a list of items (URI) to a playlist (URI) + +import spotipy +from spotipy.oauth2 import SpotifyOAuth + +sp = spotipy.Spotify(auth_manager=SpotifyOAuth(client_id="YOUR_APP_CLIENT_ID", + client_secret="YOUR_APP_CLIENT_SECRET", + redirect_uri="YOUR_APP_REDIRECT_URI", + scope="playlist-modify-private" + )) + +sp.playlist_add_items('playlist_id', ['list_of_items']) + diff --git a/examples/show_artist_top_tracks.py b/examples/show_artist_top_tracks.py index 857bfb8f..97d2f92b 100644 --- a/examples/show_artist_top_tracks.py +++ b/examples/show_artist_top_tracks.py @@ -1,4 +1,5 @@ # shows artist info for a URN or URL +# scope is not required for this function from spotipy.oauth2 import SpotifyClientCredentials import spotipy