mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-06-19 01:03:53 +00:00
parent
651080e3da
commit
5e9f97df8e
@ -1453,8 +1453,25 @@ class Spotify(object):
|
|||||||
"browse/new-releases", country=country, limit=limit, offset=offset
|
"browse/new-releases", country=country, limit=limit, offset=offset
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def category(self, category_id, country=None, locale=None):
|
||||||
|
""" Get info about a category
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
- category_id - The Spotify category ID for the category.
|
||||||
|
|
||||||
|
- country - An ISO 3166-1 alpha-2 country code.
|
||||||
|
- locale - The desired language, consisting of an ISO 639
|
||||||
|
language code and an ISO 3166-1 alpha-2 country code, joined
|
||||||
|
by an underscore.
|
||||||
|
"""
|
||||||
|
return self._get(
|
||||||
|
"browse/categories/" + category_id,
|
||||||
|
country=country,
|
||||||
|
locale=locale,
|
||||||
|
)
|
||||||
|
|
||||||
def categories(self, country=None, locale=None, limit=20, offset=0):
|
def categories(self, country=None, locale=None, limit=20, offset=0):
|
||||||
""" Get a list of new album releases featured in Spotify
|
""" Get a list of categories
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
- country - An ISO 3166-1 alpha-2 country code.
|
- country - An ISO 3166-1 alpha-2 country code.
|
||||||
@ -1480,7 +1497,7 @@ class Spotify(object):
|
|||||||
def category_playlists(
|
def category_playlists(
|
||||||
self, category_id=None, country=None, limit=20, offset=0
|
self, category_id=None, country=None, limit=20, offset=0
|
||||||
):
|
):
|
||||||
""" Get a list of new album releases featured in Spotify
|
""" Get a list of playlists for a specific Spotify category
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
- category_id - The Spotify category ID for the category.
|
- category_id - The Spotify category ID for the category.
|
||||||
|
|||||||
@ -297,6 +297,10 @@ class SpotipyBrowseApiTests(unittest.TestCase):
|
|||||||
token = prompt_for_user_token(username)
|
token = prompt_for_user_token(username)
|
||||||
cls.spotify = Spotify(auth=token)
|
cls.spotify = Spotify(auth=token)
|
||||||
|
|
||||||
|
def test_category(self):
|
||||||
|
response = self.spotify.category('rock')
|
||||||
|
self.assertTrue('name' in response)
|
||||||
|
|
||||||
def test_categories(self):
|
def test_categories(self):
|
||||||
response = self.spotify.categories()
|
response = self.spotify.categories()
|
||||||
self.assertGreater(len(response['categories']), 0)
|
self.assertGreater(len(response['categories']), 0)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user