From c927f02c1caa5dafe9ac942aba0d019abd364db0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bruckert?= Date: Sat, 29 Aug 2020 13:00:49 +0100 Subject: [PATCH] Bump to 2.14.0 (#565) * Add missing changelog entries * Mark search_markets as experimental * Bump to 2.14.0 * Improve FAQ, closes #522 * Remove non-beginner friendly exports from README, closes #521 --- CHANGELOG.md | 9 +++++++-- CONTRIBUTING.md | 2 +- FAQ.md | 12 ++++++++++-- README.md | 26 +++++++------------------- setup.py | 2 +- spotipy/client.py | 7 ++++++- 6 files changed, 32 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c6cf4de..bb7b374 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,10 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +// Add your changes here and then delete this line + +## [2.14.0] - 2020-08-29 + ### Added - - Support to search multiple markets at once. - - Support to search all available Spotify markets. + - (experimental) Support to search multiple/all markets at once. - Support to test whether the current user is following certain users or artists - Proper replacements for all deprecated playlist endpoints @@ -21,6 +24,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Support to advertise different language to Spotify - Added 'collaborative' parameter to user_playlist_create method. - Enforce CHANGELOG update on PR +- Adds `additional_types` parameter to retrieve currently playing podcast episode +- Support to get info about a single category ### Deprecated diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e02af0d..fcbd10c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -31,6 +31,6 @@ To verify the code style: pip install flake8 flake8 . -### README +### Changelog Don't forget to add a short description of your change in the [CHANGELOG](CHANGELOG.md) diff --git a/FAQ.md b/FAQ.md index cefa18f..b0cdf3a 100644 --- a/FAQ.md +++ b/FAQ.md @@ -22,7 +22,7 @@ Solution: - Request a new token by adding `show_dialog=True` to `spotipy.Spotify(auth_manager=SpotifyOAuth(show_dialog=True))` - Check that `spotipy.me()` shows the correct user id -### 401 Unauthorized +### Why do I get 401 Unauthorized? Error: @@ -32,4 +32,12 @@ Error: Solution: - You are likely missing a scope when requesting the endpoint, check -https://developer.spotify.com/web-api/using-scopes/ \ No newline at end of file +https://developer.spotify.com/web-api/using-scopes/ + +### Search doesn't find some tracks + +Problem: you can see a track on the Spotify app but searching for it using the API doesn't find it. + +Solution: by default `search("abba")` works in the US market. +To search for in your current country, the [country indicator](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) +must be specified: `search("abba", market="DE")`. \ No newline at end of file diff --git a/README.md b/README.md index 106b0d1..f2156b6 100644 --- a/README.md +++ b/README.md @@ -29,18 +29,12 @@ Add your new ID and SECRET to your environment: ### Without user authentication -```bash -export SPOTIPY_CLIENT_ID=client_id_here -export SPOTIPY_CLIENT_SECRET=client_secret_here - -// on Windows, use `SET` instead of `export` -``` - ```python import spotipy from spotipy.oauth2 import SpotifyClientCredentials -sp = spotipy.Spotify(auth_manager=SpotifyClientCredentials()) +sp = spotipy.Spotify(auth_manager=SpotifyClientCredentials(client_id="YOUR_APP_CLIENT_ID", + client_secret="YOUR_APP_CLIENT_SECRET")) results = sp.search(q='weezer', limit=20) for idx, track in enumerate(results['tracks']['items']): @@ -49,21 +43,15 @@ for idx, track in enumerate(results['tracks']['items']): ### With user authentication -```bash -export SPOTIPY_CLIENT_ID=client_id_here -export SPOTIPY_CLIENT_SECRET=client_secret_here -export SPOTIPY_REDIRECT_URI=redirect_uri_here - -// on Windows, use `SET` instead of `export` -``` - ```python import spotipy from spotipy.oauth2 import SpotifyOAuth -scope = "user-library-read" - -sp = spotipy.Spotify(auth_manager=SpotifyOAuth(scope=scope)) +sp = spotipy.Spotify(auth_manager=SpotifyOAuth(client_id="YOUR_APP_CLIENT_ID", + client_secret="YOUR_APP_CLIENT_SECRET", + redirect_uri="YOUR_APP_REDIRECT_URI", + username="YOUR_SPOTIFY_USERNAME", + scope="user-library-read")) results = sp.current_user_saved_tracks() for idx, item in enumerate(results['items']): diff --git a/setup.py b/setup.py index f9f1efa..340b4e9 100644 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ extra_reqs = { setup( name='spotipy', - version='2.13.0', + version='2.14.0', description='A light weight Python library for the Spotify Web API', long_description=long_description, long_description_content_type="text/markdown", diff --git a/spotipy/client.py b/spotipy/client.py index 7a6036d..6d4ff07 100644 --- a/spotipy/client.py +++ b/spotipy/client.py @@ -539,7 +539,7 @@ class Spotify(object): ) def search_markets(self, q, limit=10, offset=0, type="track", markets=None, total=None): - """ searches multple markets for an item + """ (experimental) Searches multiple markets for an item Parameters: - q - the search query (see how to write a query in the @@ -553,6 +553,11 @@ class Spotify(object): - total - the total number of results to return if multiple markets are supplied in the search. If multiple types are specified, this only applies to the first type. """ + warnings.warn( + "Searching multiple markets is an experimental feature. " + "Please be aware that this method's inputs and outputs can change in the future.", + UserWarning, + ) if not markets: markets = self.country_codes