Source code for spotify_py_sdk.endpoints.browse

from .endpoints_base import EndpointsBase
from spotify_py_sdk.types import *


[docs] class Browse(EndpointsBase): """Make calls to the browse api endpoint """ def __init__(self, api): """Constructor method """ super().__init__(api)
[docs] def get_categories(self, country: Optional[COUNTRY_CODE_A2] = None, locale: Optional[str] = None, limit: Optional[int] = None, offset: Optional[int] = None): """Get all categories """ params = EndpointsBase.params_for({"country": country, "locale": locale, "limit": limit, "offset": offset}) return self.get_request(f"browse/categories{params}")
[docs] def get_category(self, id: str, country: Optional[COUNTRY_CODE_A2] = None, locale: Optional[str] = None): """Get a particular category by providing id :param id: pass category id """ params = EndpointsBase.params_for({"country": country, "locale": locale}) return self.get_request(f"browse/categories/{id}{params}")
[docs] def get_new_releases(self, country: Optional[COUNTRY_CODE_A2] = None, limit: Optional[int] = None, offset: Optional[int] = None): """ Get all new releases """ params = EndpointsBase.params_for({"country": country, "limit": limit, "offset": offset}) return self.get_request(f"browse/new-releases{params}")
[docs] def get_playlists_for_category(self, id: str, country: Optional[COUNTRY_CODE_A2] = None, limit: Optional[int] = None, offset: Optional[int] = None): """Get playlists for a category :param id: pass category id """ params = EndpointsBase.params_for({"country": country, "limit": limit, "offset": offset}) return self.get_request(f"browse/categories/{id}/playlists{params}")