pytwitcherapi.models.Stream

class pytwitcherapi.models.Stream(game, channel, twitchid, viewers, preview)[source]

Bases: object

A stream on twitch.tv

__init__(game, channel, twitchid, viewers, preview)[source]

Initialize a new stream

Parameters:
  • game (str) – name of the game
  • channel (Channel) – the channel that is streaming
  • twitchid (int) – the internal twitch id
  • viewers (int) – the viewer count
  • preview (dict) – a dict with preview picture links of the stream
Raises:

None

Methods

__init__(game, channel, twitchid, viewers, ...) Initialize a new stream
wrap_get_stream(response) Wrap the response from getting a stream into an instance
wrap_json(json) Create a Stream instance for the given json
wrap_search(response) Wrap the response from a stream search into instances

Wrap the response from a stream search into instances and return them

Parameters:response (requests.Response) – The response from searching a stream
Returns:the new stream instances
Return type:list of stream
Raises:None
classmethod wrap_get_stream(response)[source]

Wrap the response from getting a stream into an instance and return it

Parameters:response (requests.Response) – The response from getting a stream
Returns:the new stream instance
Return type:list of stream
Raises:None
classmethod wrap_json(json)[source]

Create a Stream instance for the given json

Parameters:json (dict | None) – the dict with the information of the stream
Returns:the new stream instance
Return type:Stream | None
Raises:None
game = None

Name of the game that is beeing streamed

channel = None

The channel instance

twitchid = None

The internal twitch id

viewers = None

the viewer count

preview = None

A dict with preview picture links of the stream