Module TikTok.Queries.Playlist
This module contains the PlaylistQueries class for handling playlist-related API queries to the TikTok platform.
Classes
class PlaylistQueries (query: Query)
-
A subclass to handle common API queries.
Attributes
query
:Query
- The parent Query instance.
Initializes the QueryClass subclass with a reference to the parent Query instance.
Parameters
query (Query): The parent Query instance.
Expand source code
class PlaylistQueries(QueryClass): async def info( self, playlist_id: int, cursor: int | None = None ) -> Playlist.ResponseDataModel: """ This method sends a request to the TikTok API to retrieve playlist information based on the provided playlist ID. Parameters: playlist_id (int): The ID of the TikTok playlist. cursor (int | None): An optional cursor for pagination. Returns: Playlist.ResponseDataModel: The response data model containing playlist information. Raises: TikTok.Exceptions.Query.QueryException: If the API query fails or returns an error. pydantic.ValidationError: If the response body is invalid according to the expected model. httpx.HTTPError: For any HTTP errors that may occur during the API request. """ return await self._fetch_data( url=self.query.endpoints.PlaylistInfoURL, request_model_class=Playlist.InfoRequestModel, response_model_class=Playlist.InfoResponseModel, json_data=self._build_json_data( { "playlist_id": playlist_id, "cursor": cursor, } ), )
Ancestors
- QueryClass
- typing.Generic
Methods
async def info(self, playlist_id: int, cursor: int | None = None) ‑> ResponseDataModel
-
This method sends a request to the TikTok API to retrieve playlist information based on the provided playlist ID.
Parameters
playlist_id (int): The ID of the TikTok playlist. cursor (int | None): An optional cursor for pagination.
Returns
Playlist.ResponseDataModel
- The response data model containing playlist information.
Raises
QueryException
- If the API query fails or returns an error.
pydantic.ValidationError
- If the response body is invalid according to the expected model.
httpx.HTTPError
- For any HTTP errors that may occur during the API request.