kick.py

Client


This repersents the Client you can use to interact with kick.

Parameters
**options: Any
Options that can be passed

Options
whitelisted: bool = False
If you have been api whitelisted. If set to True, the bypass script will not be used.
bypass_port: int = 9090
The port the bypass script is running on. Defaults to 9090
bypass_host: str = “http://localhost”
The host of the bypass script.

Attributes
user: ClientUser | None
The user you are logged in as. It is until is called.

Methods


Fetches a user from the API.

Parameters
name: str
The user’s slug or username

Raises
HTTPException
Fetching Failed
NotFound
No user with the username/slug exists

Returns
User
The user object associated with the streamer


Gets a chatroom out of a cache that contains chatrooms that you are connected to.

Parameters
chatroom_id: int
The chatroom’s id

Returns
Chatroom | None
Either the chatroom, or None


Gets a partial chatter instance by the streamer and chatter names provided.

Parameters
streamer_name: str
The streamer’s username or slug
chatter_name: str
The chatter’s username or slug

Returns

The partial chatter


Gets a partial user instance by the username and id provided.

Parameters
username: str
The user’s name
id: int
The user’s id

Returns

The partial user


Lets you set an event outside of a subclass.


Authenticates yourself, and fills
Unlike , this does not start the websocket

Parameters
credentials: Credentials
The credentials to authenticate yourself with


Starts the websocket so you can receive events
And authenticate yourself if credentials are provided.

Parameters
credentials: Optional[Credentials]
The credentials to authenticate yourself with, if any


Authenticates yourself, and fills
Unlike , this does not start the websocket

Parameters
credentials: Credentials
The credentials to authenticate yourself with


Starts the websocket so you can receive events
And authenticate yourself if credentials are provided.

automatically calls with the provided kwargs, and calls .

Parameters
credentials: Optional[Credentials]
The credentials to authenticate yourself with, if any


Closes the HTTPClient, no requests can be made after this.

Events


on_ready is an event that can be overriden with the decorator or with a subclass.
This is called after the client has started the websocket and is receiving events.


on_ready is an event that can be overriden with the decorator or with a subclass.
This is called when a message is received over the websocket

Parameters
message:
The message that was received


on_livestream_start is an event that can be overriden with the decorator or with a subclass.
This is called when a user that is being watched starts streaming

Parameters
livestream:
The livestream


on_livestream_start is an event that can be overriden with the decorator or with a subclass.
This is called when someone starts following a streamer that is being watched.

Parameters
streamer:
The streamer


on_livestream_start is an event that can be overriden with the decorator or with a subclass.
This is called when someone stops following a streamer that is being watched.

Parameters
streamer:
The streamer


on_payload_receive is an event that can be overriden with the decorator or with a subclass.
This is called when an event is received from the websocket.

Parameters
event: str
The payload’s event
payload: dict
The payload



This holds credentials that can be used to authenticate yourself with kick.

Parameters
username: Optional[str]
The username to login with. Can not be used with the arg
email: Optional[str]
The email to login with. Can not be used with the arg
password: str
The account’s password
one_time_password: Optional[str]
The 2FA code to login with

Attributes
username: Optional[str]
The username to login with. Can not be used with the arg
email: Optional[str]
The email to login with. Can not be used with the arg
password: str
The account’s password
one_time_password: Optional[str]
The 2FA code to login with

Asset



A class which repersents a kick asset.

Attributes
url: str
The asset’s url

Methods


Fetches the asset from kick

Raises
HTTPException
Fetching the asset failed
NotFound
Asset no longer exists

Returns
bytes
The asset’s bytes


Saves the asset into a file-like object

Parameters
fp: str | bytes | os.PathLike[Any] | BufferedIOBase
The file-like object for the asset to be written to.
If a filepath is given, then a file will be created instead.
seek_begin: bool
Whether to seek to the beginning of the file after saving is
successfully done.

Raises
HTTPException
Fetching the asset failed
NotFound
Asset no longer exists

Returns
int
The amount of bytes written

Badges



A dataclass which represents a badge from a chatroon.

Attributes
type: str
The type of badge
text: str
The badge’s text
count: int
How many of that badge they have
active: bool
If the chatter actively has the badge



A dataclass which represents a subscriber badge from a channel.

Attributes
id: int
The badge’s id
channel_id: int
The id of the channel the chatter is subscribed too
months: int
How many months they have been subscribed to the chatter
image:
The badge’s image

Categories


A dataclass which represents one of kick’s main categories

Attributes
id: int
The categorie’s ID
name: str
The categorie’s name
slug: str
The categorie’s slug
icon:
The categorie’s icon



A dataclass which represents one of kick’s sub categories

Attributes
id: int
The categorie’s ID?
category_id: str
The categorie’s ID?
slug: str
The categorie’s slug
name: str
The categorie’s name
tags: list[str]
A list of the categorie’s tags
description: str | None
The categorie’s description, if any
parent:
The categorie’s parent category.

Chatrooms


A dataclass that represents a kick chatroom.

Attributes
id: int
The chatroom’s id
streamer:
The user who this chatroom belongs to

Methods


Connects to the chatroom, making it so you can now listen for the messages.


Disconnects to the chatroom, making it so you can no longer listen for the messages.


Sends a message in the chatroom

Parameters
content: str
The message’s content

Raises
NotFound
Streamer or chatter not found
HTTPException
Sending the message failed
Forbidden
You are unauthorized from sending the message


Fetches a chatroom’s chatter

Parameters
chatter_name: str
The chatter’s username

Raises
NotFound
Streamer or chatter not found
HTTPException
Fetching the chatter failed

Returns
Chatter
The chatter


Fetches the chatroom’s bans

Raises
NotFound
Streamer Not Found
HTTPException
Fetching the bans failed

Returns
AsyncIterator[BanEntry]
Yields all of the ban entries


Fetches the chatroom’s banned words

Raises
NotFound
Streamer Not Found
HTTPException
Fetching the words failed

Returns
list[str]
A list of the banned words


Fetches the chatroom’s rules

Raises
NotFound
Streamer Not Found
HTTPException
Fetching the rules failed

Returns
str
The rules


Gets a poll from the chatroom

Raises
NotFound
There is no poll in the current chatroom or Streamer Not Found
HTTPException
Fetching the poll failed

Returns
Poll
The poll


Fetches the emotes from the current chatroom.

Parameters
include_global: bool = False
Whether to include global emotes or not

Raises
NotFound
Streamer Not Found
HTTPException
Fetching the bans failed

Returns
AsyncIterator[Emote]
Yields each emote. Starting with from the chatroom, then global


A dataclass that represents a kick chatroom.

Attributes
id: int
The chatroom’s id
chatable_type: str
The chatroom’s type
created_at: datetime.datetime
When the chatroom was created
updated_at: datetime.datetime
When the chatroom was last updated
chat_mode: ChatroomChatMode
The mode the chatroom is in
slowmode: bool
Whether slowmode is enabled
followers_mode: bool
Whether followers_mode is enabled
subscribers_mode: bool
Whether subscribers_mode is enabled
emotes_mode: bool
Whether emotes_mode is enabled
slow_mode: bool
Whether slow_mode is enabled
message_interval: int
Interval at which messages can be sent when slow_mode is enabled
following_min_duration: int
Unknown on what this is
streamer:
The user who this chatroom belongs to

Methods


Connects to the chatroom, making it so you can now listen for the messages.


Disconnects to the chatroom, making it so you can no longer listen for the messages.


Sends a message in the chatroom

Parameters
content: str
The message’s content

Raises
NotFound
Streamer or chatter not found
HTTPException
Sending the message failed
Forbidden
You are unauthorized from sending the message


Fetches a chatroom’s chatter

Parameters
chatter_name: str
The chatter’s username

Raises
NotFound
Streamer or chatter not found
HTTPException
Fetching the chatter failed

Returns
Chatter
The chatter


Fetches the chatroom’s bans

Raises
NotFound
Streamer Not Found
HTTPException
Fetching the bans failed

Returns
AsyncIterator[BanEntry]
Yields all of the ban entries


Fetches the chatroom’s banned words

Raises
NotFound
Streamer Not Found
HTTPException
Fetching the words failed

Returns
list[str]
A list of the banned words


Fetches the chatroom’s rules

Raises
NotFound
Streamer Not Found
HTTPException
Fetching the rules failed

Returns
str
The rules


Gets a poll from the chatroom

Raises
NotFound
There is no poll in the current chatroom or Streamer Not Found
HTTPException
Fetching the poll failed

Returns
Poll
The poll


Fetches the emotes from the current chatroom.

Parameters
include_global: bool = False
Whether to include global emotes or not

Raises
NotFound
Streamer Not Found
HTTPException
Fetching the bans failed

Returns
AsyncIterator[Emote]
Yields each emote. Starting with from the chatroom, then global

BanEntry


A dataclass which represents a ban entry on kick.
This includes timeouts.

Attributes
reason: str
The reason for the ban/timeout
is_permanent: bool
Whether the ban is permanent. True == ban, false == timeout
user:
The user the action was towards
banned_by:
The responsible mod
expires_at: datetime.datetime | None
when the timeout expires at. None for a ban
banned_at: datetime.datetime
When the action happened
chatroom: Chatroom
The chatroom the action happened in

Methods


Unbans the chatter from the chatroom.

Raises
NotFound
Streamer or chatter not found
HTTPException
Unbanning the chatter failed
Forbidden
You are unauthorized from unbanning the chatter

Users


A dataclass which represents a User on kick

Attributes
id: int
The user’s id
channel_id: int
The user’s channel id
username: str
The user’s name
state: str
The state the user has said they live in
socials:
The socials the user has said they have
country: str
The country the user has said they live in
playback_url: str
The user’s playback url
slug: str
The user’s slug
vod_enabled: bool
If the user has vods enabled
is_banned: bool
If the user is banned
subscription_enabled: bool
If the user has subscriptions enabled
follower_count: int
The amount of followers the user has
subscriber_badges: list[]
A list of subscriber badges the user has
online_banner: | None
the banner that gets displayed when the user is live
offline_banner: | None
the banner that gets displayed when the user is offline
is_muted: bool
If the user is muted
is_verified: bool
If the user is verified
avatar:
The user’s avatar
can_host: bool
If the user can host
bio: str
The user’s bio
agreed_to_terms: bool
if the user has agreed to kick’s TOS
email_verified_at: datetime.datetime
When the user verified their user
livestream: | None
The user’s livestream
chatroom:
The user’s chatroom
recent_categories: list[]
The categories the user has recently gone live in

Methods

[[User.fetch_videos]]

[[User.fetch_gift_leaderboard]]


Watches a user to see if they go online.


Stops watching the user



This dataclass represents a partial user on kick

Attributes
id: int
The user’s id
username: str
The user’s name


Methods



A dataclass which respresents a chatter on kick

Attributes
chatroom: Chatroom
The chatroom the chatter is in
id: int
The chatter’s id
username: str
The chatter’s username
slug: str
The chatter’ slug
avatar: | None
The chatter’s avatar, if any
is_staff: bool
If the chatter is a staff member in the chatroom
is_owner: bool
If the chatter is the chatroom owner
is_mod: bool
If the chatter is a mod in the chatroom
badges: list[]
The chat badges the chatter has
following_since: datetime.datetime | None
when the chatter started following the streamer

Methods


Permanently bans a user from a chatroom.

Parameters
reason: str
The reason for the ban

Raises

Banning the user failed

You are unauthorized from banning the user

Streamer or user not found


Unbans the chatter from the chatroom

Raises

Unbanning the user failed

You are unauthorized from unbanning the user

Streamer or user not found


Times out a user for a given amount of time.

Parameters
duration: int
The amount of seconds for the timeout to be
reason: str
The reason for the timeout

Raises

timing out the user failed

You are unauthorized from timing out the user

Streamer or user not found


untimeout’s the chatter

Raises

untimeouting the user failed

You are unauthorized from untimeouting the user

Streamer or user not found



This represents a partial user.

Attributes
streamer_name: str
The streamer’s name
username: str
The chatter’s username

Methods


Fetches a user object for the chatter

Raises

Fetching the user failed

User not found

Returns

The user


Permanently bans a user from a chatroom.

Parameters
reason: str
The reason for the ban

Raises

Banning the user failed

You are unauthorized from banning the user

Streamer or user not found


Unbans the chatter from the chatroom

Raises

Unbanning the user failed

You are unauthorized from unbanning the user

Streamer or user not found


Times out a user for a given amount of time.

Parameters
duration: int
The amount of seconds for the timeout to be
reason: str
The reason for the timeout

Raises

timing out the user failed

You are unauthorized from timing out the user

Streamer or user not found


untimeout’s the chatter

Raises

untimeouting the user failed

You are unauthorized from untimeouting the user

Streamer or user not found



Represents the author of a message on kick

Attributes
id: int
The author’s id
slug: str
The author’s slug
username: str
The author’s username
color: str
The authors… color?
badges: list
Unknown

Methods


Fetches a user object for the author

Raises

Fetching the user failed

User Not Found

Returns

The user

Messages


Represents a message sent on kick

Attributes
id: str
the message’s id
is_reply: bool
If the message is replying to any message
references: | None
If the message is replying to a message, a object is returned. Otherwise None
chatroom_id: int
The id of the chatroom the message was sent in
chatroom: | None
The chatroom the message was sent in.
content: str
The message’s content
created_at: datetime.datetime
When the message was sent
author:
The message’s author



This represents a partial message. Mainly used as the message someone is replying too.

Attributes
id: str
The message’s id
content: str
The message’s content
author:
The message’s author

Emote


A dataclass which represents an emote on kick.

Attributes
id: int
The emote’s id
is_global: bool
If the emote is a global emote, or from a channel
channel_id: int | None
returns the channel_id the emote is from, or None if global
name: str
The emote’s name
subscribers_only: bool
If you have to be a subscriber of the channel to use it. False for global emotes
source:
An asset which contains the emote’s source.

Enums


An enum containing possble chatroom chat mode values.

Attributes
public:
The public value
privet:
The privet value

Leaderboard


This dataclass represents a gift leaderboard entry.

Attributes
user_id: int
The id of the user with this entry
quantity: int
The amount of subs this person has gifted
username: str
The user’s username



This is a dataclass which reprsents the gift leaderboard for a kick streamer.

Attributes
streamer:
The streamer that the leaderboard is for
this_week: list[]
The gift leaderboard for the current week
this_month: list[]
The gift leaderboard for the current month
all_time: list[]
The gift leaderboard for all time

Livestreams


A dataclass which represents a partial livestream on kick.

Attributes
id: int
The livestream’s id
channel_id: int
The livestream’s channel id
title: str
The livestream’s title
created_at: datetime.datetime
When the livestream started
streamer: | None
The livestream’s streaner


A dataclass which represents a livestream on kick.

Attributes
id: int
probably the livestream’s id
slug: str
The streamer’s slug
username: str
The streamer’s username
channel_id: int
probably the streamer’s id or the chatroom id
created_at: datetime.datetime
When the livestream started
title: str
The livestream’s title
is_live: bool
If the livestream is currently live
thumbnail: | None
Returns the livestream’s thumbnail if it has one
duration: int
Probably how long the livestream is/was in seconds
language: str
The language the livestream is in
is_mature: bool
If the livestream is marked as 18+
viewer_count: int
The amount of people currently watching
tags: list[str]
Tags applied to the livestream
url: str
The livestream’s url
embed_url: str
The livestream’s player/embed url
categories: list[]
The categories the livestream is in

Polls


This dataclass represents a chatroom ’s option on kick.

Attributes
chatroom:
The chatroom the poll is in
id: int
The option’s id
label: str
The option’s label
votes: int
The amount of votes the option has

Methods


Votes for this option in the poll

Raises
NotFound
There is no poll in the current chatroom
HTTPException
Deleting the poll failed



This dataclass represents a poll in a chatroom on kick.

Attributes
chatroom:
The chatroom the poll is in
title: str
The poll’s title
options: list[]
The poll’s options
duration: int
How long the poll will last in seconds
result_display_duration: int
How long the poll will display the results in seconds
has_voted: bool
if you’ve voted yet
ends_at: datetime.datetime
When the poll ends at

Methods


Deletes the current poll from the chatroom

Raises
Forbidden
You are unauthorized to delete the poll
NotFound
There is no poll in the current chatroom
HTTPException
Deleting the poll failed

Videos


This dataclass represents a video on kick

Attributes
id: int
The video’s id
slug: str
the video’s slug
channel_id: int
Probably the id of the channel the video is from
created_at: datetime.datetime
When the video was created
updated_at: datetime.datetime
When the video was last updated
title: str
The video’s title
live_stream_id: int
The id of the live stream the video is from
thumbnail: | None
The video’s thumbnail
duration: int
How long the video is in seconds
language: str
The language the video is in
is_mature: bool
If the video is marked as 18+
viewer_count: int
How many people have seen the video
categories: list[]
The categories the video is in

Other


The socials a user on kick has added to their profile

Attributes
instagram: str
Their instagram
youtube: str
Their youtube
twitter: str
Their twitter
discord: str
Their discord
tiktok: str
Their tiktok
facebook: str
Their facebook

Errors


This error is used when there is an error with the bypass script.



This error is used when there is an error with kick.



This error is used when there is an error with logging in.



This error is used when an error is ran into when making a request to kick.

Attributes
status_code: int
The HTTP code



This error is used when kick returns a 403 status code.

Attributes
status_code: int = 403
The HTTP code



This error is used when kick returns a 404 status code.

Attributes
status_code: int = 404
The HTTP code



This error is used when kick returns a a 500 status code, or doesn’t connect.

Attributes
status_code: int = 500
The HTTP code