Getting Started¶
Installation¶
Optional speed extras (orjson, aiodns, Brotli):
Setup¶
Before using the library, you need a Kick developer application:
- Create a Kick account and enable 2FA
- Go to Account Settings > Developer tab
- Create an app to get your Client ID and Client Secret
First API Call¶
import asyncio
from kickpy import KickClient
async def main():
client = KickClient("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET")
# Fetch a user by ID
user = await client.fetch_user(4377088)
print(f"Name: {user.name}")
print(f"Profile: {user.profile_picture}")
# Fetch a channel by slug
channel = await client.fetch_channel(slug="kickbot")
print(f"Title: {channel.stream_title}")
print(f"Live: {channel.stream.is_live}")
# Search categories
categories = await client.fetch_categories(query="Gaming")
for cat in categories:
print(f"{cat.name} ({cat.id})")
# Get live streams (cursor-paginated)
page = await client.fetch_livestreams_v2(limit=5)
for stream in page:
print(f"{stream.slug}: {stream.viewer_count} viewers")
if page.has_next:
next_page = await client.fetch_livestreams_v2(limit=5, cursor=page.next_cursor)
# Get the live streams of specific broadcasters
live = await client.fetch_user_livestreams([4377088, 123456])
await client.close()
asyncio.run(main())
Note
KickClient uses app access tokens by default (client credentials flow). This gives you read-only access to public data. For write operations (chat, moderation, rewards, ads), you need a user token.
Deprecated livestream methods
fetch_livestream() and fetch_livestreams() use the v1 livestreams endpoint, which Kick has deprecated. They still work but emit a DeprecationWarning. Use fetch_livestreams_v2() and fetch_user_livestreams() instead.
Context Manager¶
You can also use KickClient without manually calling close():