Welcome to python-twitch-client
¶
An easy to use Python library for accessing the Twitch API
Warning
This documentation is a work in progress
Note
python-twitch-client
currently supports Helix API and Twitch API v5.
Helix API integration is a work in progress and some endpoints might be missing.
If you find a missing endpoint or a bug please raise an issue or contribute and open a pull request.
Installation¶
You can install python-twitch-client
with pip
:
$ pip install python-twitch-client
python-twitch-client
is currently only tested and confirmed working on Linux and Mac. If you’re
on a Windows machine and getting any bugs, please open a bug and help us find a solution.
Authentication¶
Before you can use Twitch API you need to get the client ID. To get one, you should follow the steps on Twitch Authentication page.
Some of the endpoints also require OAuth token. To get one for testing purposes, you can use the
free tokengen tool or use TwitchHelix’s get_oauth
method.
There are two ways to pass credentials into the TwitchClient. The first and easiest way is to just pass the credentials as an argument:
client = TwitchClient(client_id='<my client id>', oauth_token='<my oauth token>')
Other option is to create a config file ~/.twitch.cfg which is a text file formatted as .ini configuration file.
An example of the config file might look like:
[Credentials]
client_id = <my client id>
oauth_token = <my oauth token>
Note
You only need to provide oauth_token
if you’re calling endpoints that need it.
If you call functions that require oauth_token
and you did not provide it, functions will
raise TwitchAuthException
exception.