TikTokLive.client.web package
Subpackages
- TikTokLive.client.web.routes package
- Submodules
- TikTokLive.client.web.routes.download_video module
- TikTokLive.client.web.routes.gift_list module
- TikTokLive.client.web.routes.image_download module
- TikTokLive.client.web.routes.is_live module
- TikTokLive.client.web.routes.room_id_api module
- TikTokLive.client.web.routes.room_id_live_html module
- TikTokLive.client.web.routes.room_info module
- TikTokLive.client.web.routes.sign_fetch module
- Module contents
Submodules
TikTokLive.client.web.web_base module
- class TikTokLive.client.web.web_base.ClientRoute(web: TikTokHTTPClient)
Bases:
ABC
A callable API route for TikTok
- class TikTokLive.client.web.web_base.TikTokHTTPClient(proxy: Proxy | None = None, httpx_kwargs: dict | None = None)
Bases:
object
HTTP client for interacting with the various APIs
- async close() None
Close the HTTP client gracefully
- Returns:
None
- classmethod generate_device_id() int
Generate a spoofed device ID for the TikTok API call
- Returns:
Device ID number
- async get_response(url: str, extra_params: Dict | None = None, extra_headers: Dict | None = None, client: AsyncClient | None = None, base_params: bool = True, base_headers: bool = True, **kwargs) Response
Get a response from the underlying httpx.AsyncClient client.
- Parameters:
url – The URL to request
extra_params – Extra parameters to append to the globals
extra_headers – Extra headers to append to the globals
client – An optional override for the httpx.AsyncClient client
kwargs – Optional keywords for the httpx.AsyncClient.get method
base_params – Whether to include the base params
base_headers – Whether to include the base headers
- Returns:
An httpx.Response object
- set_session_id(session_id: str) None
Set the session id cookies for the HTTP client and Websocket connection
- Parameters:
session_id – The (must be valid) session ID
- Returns:
None
TikTokLive.client.web.web_client module
- class TikTokLive.client.web.web_client.TikTokWebClient(**kwargs)
Bases:
TikTokHTTPClient
Wrapper for the HTTP client to add web routes
TikTokLive.client.web.web_presets module
- class TikTokLive.client.web.web_presets.DevicePreset
Bases:
TypedDict
- browser_name: str
- browser_platform: str
- browser_version: str
- os: str
- user_agent: str
- class TikTokLive.client.web.web_presets.LocationPreset
Bases:
TypedDict
en style ISO code
- country: str
America/Toronto style TZ name
- lang: str
en-US style ISO code
- lang_country: str
US style ISO code
- tz_name: str
- class TikTokLive.client.web.web_presets.ScreenPreset
Bases:
TypedDict
- screen_height: int
- screen_width: int
- TikTokLive.client.web.web_presets.user_agent_to_device_preset(user_agent: str) DevicePreset
Convert a user agent string to a DevicePreset
- Parameters:
user_agent – The user agent string