Module TikTok.ValidationModels.RestAPI
Defines the structure and configuration of the TikTok API.
This module includes enumerations and models that encapsulate the base API configuration, specific API endpoints, and their respective URLs for interacting with the TikTok API. It serves as a foundation for making requests to the TikTok API, ensuring a structured and consistent approach to accessing API resources.
Classes
class APIEndpoints (**data: Any)
-
Model representing the API endpoints for the TikTok API.
This model encapsulates the various endpoints used to interact with the TikTok API, providing a structured way to access the URLs required for OAuth token requests, user information retrieval, and other actions.
Attributes
OAuthTokenRequestURL
:HttpUrl
- The URL for requesting an OAuth token.
UserInfoURL
:HttpUrl
- The URL for retrieving user information.
UserLikedVideosURL
:HttpUrl
- The URL for retrieving videos liked by a user.
UserPinnedVideosURL
:HttpUrl
- The URL for retrieving videos pinned by a user.
UserRepostedVideosURL
:HttpUrl
- The URL for retrieving videos reposted by a user.
UserFollowingURL
:HttpUrl
- The URL for retrieving users that a specified user is following.
UserFollowersURL
:HttpUrl
- The URL for retrieving followers of a specified user.
PlaylistInfoURL
:HttpUrl
- The URL for retrieving information about a specific playlist.
VideoSearchURL
:HttpUrl
- The URL for searching videos based on specified criteria.
VideoCommentsURL
:HttpUrl
- The URL for retrieving comments for a specific video.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError
][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.self
is explicitly positional-only to allowself
as a field name.Expand source code
class APIEndpoints(BaseRequestModel): """ Model representing the API endpoints for the TikTok API. This model encapsulates the various endpoints used to interact with the TikTok API, providing a structured way to access the URLs required for OAuth token requests, user information retrieval, and other actions. Attributes: OAuthTokenRequestURL (HttpUrl): The URL for requesting an OAuth token. UserInfoURL (HttpUrl): The URL for retrieving user information. UserLikedVideosURL (HttpUrl): The URL for retrieving videos liked by a user. UserPinnedVideosURL (HttpUrl): The URL for retrieving videos pinned by a user. UserRepostedVideosURL (HttpUrl): The URL for retrieving videos reposted by a user. UserFollowingURL (HttpUrl): The URL for retrieving users that a specified user is following. UserFollowersURL (HttpUrl): The URL for retrieving followers of a specified user. PlaylistInfoURL (HttpUrl): The URL for retrieving information about a specific playlist. VideoSearchURL (HttpUrl): The URL for searching videos based on specified criteria. VideoCommentsURL (HttpUrl): The URL for retrieving comments for a specific video. """ OAuthTokenRequestURL: HttpUrl = ( f"{BaseAPI.base_url}/{BaseAPI.api_version}/oauth/token/" ) UserInfoURL: HttpUrl = ( f"{BaseAPI.base_url}/{BaseAPI.api_version}/research/user/info/" ) UserLikedVideosURL: HttpUrl = ( f"{BaseAPI.base_url}/{BaseAPI.api_version}/research/user/liked_videos/" ) UserPinnedVideosURL: HttpUrl = ( f"{BaseAPI.base_url}/{BaseAPI.api_version}/research/user/pinned_videos/" ) UserRepostedVideosURL: HttpUrl = ( f"{BaseAPI.base_url}/{BaseAPI.api_version}/research/user/reposted_videos/" ) UserFollowingURL: HttpUrl = ( f"{BaseAPI.base_url}/{BaseAPI.api_version}/research/user/following/" ) UserFollowersURL: HttpUrl = ( f"{BaseAPI.base_url}/{BaseAPI.api_version}/research/user/followers/" ) PlaylistInfoURL: HttpUrl = ( f"{BaseAPI.base_url}/{BaseAPI.api_version}/research/playlist/info/" ) VideoSearchURL: HttpUrl = ( f"{BaseAPI.base_url}/{BaseAPI.api_version}/research/video/query/" ) VideoCommentsURL: HttpUrl = ( f"{BaseAPI.base_url}/{BaseAPI.api_version}/research/video/comment/list/" )
Ancestors
- BaseRequestModel
- pydantic.main.BaseModel
Class variables
var OAuthTokenRequestURL : pydantic.networks.HttpUrl
var PlaylistInfoURL : pydantic.networks.HttpUrl
var UserFollowersURL : pydantic.networks.HttpUrl
var UserFollowingURL : pydantic.networks.HttpUrl
var UserInfoURL : pydantic.networks.HttpUrl
var UserLikedVideosURL : pydantic.networks.HttpUrl
var UserPinnedVideosURL : pydantic.networks.HttpUrl
var UserRepostedVideosURL : pydantic.networks.HttpUrl
var VideoCommentsURL : pydantic.networks.HttpUrl
var VideoSearchURL : pydantic.networks.HttpUrl
var model_config : pydantic.config.ConfigDict
Inherited members
class BaseAPI (*args, **kwds)
-
Enumeration for the base API configuration.
This class defines the base URL and API version for the TikTok API. It provides a structured way to access these constants throughout the application.
Attributes
base_url
:HttpUrl
- The base URL for the TikTok API.
api_version
:str
- The version of the TikTok API being used.
Expand source code
class BaseAPI(StrEnum): """ Enumeration for the base API configuration. This class defines the base URL and API version for the TikTok API. It provides a structured way to access these constants throughout the application. Attributes: base_url (HttpUrl): The base URL for the TikTok API. api_version (str): The version of the TikTok API being used. """ base_url: HttpUrl = "https://open.tiktokapis.com" api_version: str = "v2"
Ancestors
- enum.StrEnum
- builtins.str
- enum.ReprEnum
- enum.Enum
Class variables
var api_version : str
var base_url : pydantic.networks.HttpUrl