Quickstart
Get up and running with the Euler Stream API in under 5 minutes.
This guide walks you through making your first connection to a TikTok LIVE stream using the Euler Stream API.
Prerequisites
- An Euler Stream account (sign up here)
- An API key from the Dashboard
Choose Your Language
1. Install the library
pip install TikTokLive2. Connect to a livestream
from TikTokLive import TikTokLiveClient
from TikTokLive.client.web.web_settings import WebDefaults
from TikTokLive.events import ConnectEvent, CommentEvent
# Set your API key BEFORE creating the client
WebDefaults.tiktok_sign_api_key = "YOUR_API_KEY"
client = TikTokLiveClient(unique_id="@tv_asahi_news")
@client.on(ConnectEvent)
async def on_connect(event: ConnectEvent):
print(f"Connected to Room {event.room_id}!")
@client.on(CommentEvent)
async def on_comment(event: CommentEvent):
print(f"{event.user.unique_id}: {event.comment}")
if __name__ == '__main__':
client.run()Replace YOUR_API_KEY with the API key from your dashboard. Replace @tv_asahi_news with any TikTok
username that is currently live.
What Just Happened?
When you run the code above:
- The library sends your API key to the Euler Stream signing server
- The server generates an authenticated URL for the TikTok LIVE WebSocket
- The library connects to TikTok's WebSocket and starts receiving real-time events
- Your callback functions fire whenever a new event arrives (comments, gifts, joins, etc.)