Usage

This is a litte quickstart guide. For more information go to the Usermanual.

API requests

pytwitcherapi.TwitchSession class is the central class for interacting with twitch.tv:

1
2
3
import pytwitcherapi

ts = pytwitcherapi.TwitchSession()

To query all top games use:

5
topgames = ts.top_games()

Get streams and playlist for every game:

 7
 8
 9
10
11
for game in topgames:
    streams = ts.get_streams(game=game)
    for stream in streams:
        channel = stream.channel
        playlist = ts.get_playlist(channel)

As you can see games, channels, streams are wrapped into objects. See pytwitcherapi.Game, pytwitcherapi.Channel, pytwitcherapi.Stream, pytwitcherapi.User.

You can use your own Client-ID for twitch by setting the environment variable PYTWITCHER_CLIENT_ID.