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 Twitch API v5.
If you find a missing endpoint or a bug please raise an issue or contribute and open a pull request.
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.
There are two ways to pass credentials into the TwitchClient. The first and easies 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.