show_featured_artists.py and update publishing docs (#821)

* show_featured_artists.py and update publishing docs

* Don't update version

Co-authored-by: Stéphane Bruckert <contact@stephanebruckert.com>
This commit is contained in:
dnlruiz 2022-06-18 15:26:43 -07:00 committed by GitHub
parent 61c8cda006
commit a4cfd83946
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 4 deletions

View File

@ -6,10 +6,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
* Updated the documentation to specify ISO-639-1 language codes.
* Added `market` parameter to `album` and `albums` to address ([#753](https://github.com/plamere/spotipy/issues/753)
// Add your changes here and then delete this line
### Added
* Added `market` parameter to `album` and `albums` to address ([#753](https://github.com/plamere/spotipy/issues/753)
* Added 'show_featured_artists.py' to 'examples'.
### Fixed
* Updated the documentation to specify ISO-639-1 language codes.
* Fix `AttributeError` for `text` attribute of the `Response` object
## [2.20.0] - 2022-06-18
@ -18,7 +24,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Changed URI handling in `client.Spotify._get_id()` to remove qureies if provided by error.
* Added a new parameter to `RedisCacheHandler` to allow custom keys (instead of the default `token_info` key)
* Simplify check for existing token in `RedisCacheHandler`
* Fix `AttributeError` for `text` attribute of the `Response` object
### Changed
* Removed Python 3.5 and added Python 3.9 in Github Action

View File

@ -0,0 +1,27 @@
# Shows all artists featured on an album
# usage: featured_artists.py spotify:album:[album urn]
from spotipy.oauth2 import SpotifyClientCredentials
import sys
import spotipy
from pprint import pprint
if len(sys.argv) > 1:
urn = sys.argv[1]
else:
urn = 'spotify:album:5yTx83u3qerZF7GRJu7eFk'
sp = spotipy.Spotify(client_credentials_manager=SpotifyClientCredentials())
album = sp.album(urn)
featured_artists = set()
items = album['tracks']['items']
for item in items:
for ele in item['artists']:
if 'name' in ele:
featured_artists.add(ele['name'])
pprint(featured_artists)