Docs
Using API Keys in Python

Using API Keys in Python

How to use the Euler Stream API keys in the 3rd-party Python library.

Prerequisites

  1. You have signed up for an Euler Stream account.
  2. You have created an API key in the Euler Stream dashboard.
  3. You have installed the TikTokLive Python library.

How to Use

To use the Euler Stream API keys in the Python library, you need to set the API key global before instantiating the client instance. Here's an example hello-world script demonstrating this:

from TikTokLive import TikTokLiveClient
from TikTokLive.client.web.web_settings import WebDefaults
from TikTokLive.events import ConnectEvent, JoinEvent
 
WebDefaults.tiktok_sign_api_key = "YOUR_API_KEY"
 
client: TikTokLiveClient = TikTokLiveClient(
    unique_id="@tv_asahi_news"
)
 
 
@client.on(ConnectEvent)
async def on_connect(event: ConnectEvent) -> None:
    print(f"Connected to {event.room_id}!")
 
 
@client.on(JoinEvent)
async def on_join(event: JoinEvent):
    print(f"@{event.user.unique_id} joined the stream!")
 
 
if __name__ == '__main__':
    client.run()