Python Twitch API

PyPI verion Downloads PyPI verion Twitch API version Documentation Status

This is a full implementation of the Twitch Helix API, PubSub, EventSub and Chat in python 3.7+.

It handles stuff like keeping your user token refreshed and adds a easy way to interface with all parts of the Twitch API.

Install with pip install twitchAPI


Short Example

from twitchAPI.twitch import Twitch
from twitchAPI.helper import first
import asyncio

async def twitch_example():
    # initialize the twitch instance, this will by default also create a app authentication for you
    twitch = await Twitch('app_id', 'app_secret')
    # call the API for the data of your twitch user
    # this returns a async generator that can be used to iterate over all results
    # but we are just interested in the first result
    # using the first helper makes this easy.
    user = await first(twitch.get_users(logins='your_twitch_user'))
    # print the ID of your user or do whatever else you want with it

# run this example