mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-06-19 09:13:53 +00:00
* Updated references to ISO 639 standard to clarify that the ISO 639-1 alpha-2 standard is used. * Added `market` parameter to `album` and `albums` * fix formatting change
This commit is contained in:
parent
14ee53eacd
commit
5175f19851
@ -6,6 +6,8 @@ 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).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## Unreleased
|
## 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
|
// Add your changes here and then delete this line
|
||||||
|
|
||||||
|
|||||||
@ -144,7 +144,7 @@ class Spotify(object):
|
|||||||
See urllib3 https://urllib3.readthedocs.io/en/latest/reference/urllib3.util.html
|
See urllib3 https://urllib3.readthedocs.io/en/latest/reference/urllib3.util.html
|
||||||
:param language:
|
:param language:
|
||||||
The language parameter advertises what language the user prefers to see.
|
The language parameter advertises what language the user prefers to see.
|
||||||
See ISO-639 language code: https://www.loc.gov/standards/iso639-2/php/code_list.php
|
See ISO-639-1 language code: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
|
||||||
"""
|
"""
|
||||||
self.prefix = "https://api.spotify.com/v1/"
|
self.prefix = "https://api.spotify.com/v1/"
|
||||||
self._auth = auth
|
self._auth = auth
|
||||||
@ -420,14 +420,18 @@ class Spotify(object):
|
|||||||
trid = self._get_id("artist", artist_id)
|
trid = self._get_id("artist", artist_id)
|
||||||
return self._get("artists/" + trid + "/related-artists")
|
return self._get("artists/" + trid + "/related-artists")
|
||||||
|
|
||||||
def album(self, album_id):
|
def album(self, album_id, market=None):
|
||||||
""" returns a single album given the album's ID, URIs or URL
|
""" returns a single album given the album's ID, URIs or URL
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
- album_id - the album ID, URI or URL
|
- album_id - the album ID, URI or URL
|
||||||
|
- market - an ISO 3166-1 alpha-2 country code
|
||||||
"""
|
"""
|
||||||
|
|
||||||
trid = self._get_id("album", album_id)
|
trid = self._get_id("album", album_id)
|
||||||
|
if market is not None:
|
||||||
|
return self._get("albums/" + trid + '?market=' + market)
|
||||||
|
else:
|
||||||
return self._get("albums/" + trid)
|
return self._get("albums/" + trid)
|
||||||
|
|
||||||
def album_tracks(self, album_id, limit=50, offset=0, market=None):
|
def album_tracks(self, album_id, limit=50, offset=0, market=None):
|
||||||
@ -446,14 +450,18 @@ class Spotify(object):
|
|||||||
"albums/" + trid + "/tracks/", limit=limit, offset=offset, market=market
|
"albums/" + trid + "/tracks/", limit=limit, offset=offset, market=market
|
||||||
)
|
)
|
||||||
|
|
||||||
def albums(self, albums):
|
def albums(self, albums, market=None):
|
||||||
""" returns a list of albums given the album IDs, URIs, or URLs
|
""" returns a list of albums given the album IDs, URIs, or URLs
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
- albums - a list of album IDs, URIs or URLs
|
- albums - a list of album IDs, URIs or URLs
|
||||||
|
- market - an ISO 3166-1 alpha-2 country code
|
||||||
"""
|
"""
|
||||||
|
|
||||||
tlist = [self._get_id("album", a) for a in albums]
|
tlist = [self._get_id("album", a) for a in albums]
|
||||||
|
if market is not None:
|
||||||
|
return self._get("albums/?ids=" + ",".join(tlist) + '&market=' + market)
|
||||||
|
else:
|
||||||
return self._get("albums/?ids=" + ",".join(tlist))
|
return self._get("albums/?ids=" + ",".join(tlist))
|
||||||
|
|
||||||
def show(self, show_id, market=None):
|
def show(self, show_id, market=None):
|
||||||
@ -1483,8 +1491,8 @@ class Spotify(object):
|
|||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
- locale - The desired language, consisting of a lowercase ISO
|
- locale - The desired language, consisting of a lowercase ISO
|
||||||
639 language code and an uppercase ISO 3166-1 alpha-2 country
|
639-1 alpha-2 language code and an uppercase ISO 3166-1 alpha-2
|
||||||
code, joined by an underscore.
|
country code, joined by an underscore.
|
||||||
|
|
||||||
- country - An ISO 3166-1 alpha-2 country code.
|
- country - An ISO 3166-1 alpha-2 country code.
|
||||||
|
|
||||||
@ -1533,7 +1541,7 @@ class Spotify(object):
|
|||||||
- category_id - The Spotify category ID for the category.
|
- category_id - The Spotify category ID for the category.
|
||||||
|
|
||||||
- country - An ISO 3166-1 alpha-2 country code.
|
- country - An ISO 3166-1 alpha-2 country code.
|
||||||
- locale - The desired language, consisting of an ISO 639
|
- locale - The desired language, consisting of an ISO 639-1 alpha-2
|
||||||
language code and an ISO 3166-1 alpha-2 country code, joined
|
language code and an ISO 3166-1 alpha-2 country code, joined
|
||||||
by an underscore.
|
by an underscore.
|
||||||
"""
|
"""
|
||||||
@ -1548,7 +1556,7 @@ class Spotify(object):
|
|||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
- country - An ISO 3166-1 alpha-2 country code.
|
- country - An ISO 3166-1 alpha-2 country code.
|
||||||
- locale - The desired language, consisting of an ISO 639
|
- locale - The desired language, consisting of an ISO 639-1 alpha-2
|
||||||
language code and an ISO 3166-1 alpha-2 country code, joined
|
language code and an ISO 3166-1 alpha-2 country code, joined
|
||||||
by an underscore.
|
by an underscore.
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user