pytwitcherapi.models.Game

class pytwitcherapi.models.Game(name, box, logo, twitchid, viewers=None, channels=None)[source]

Bases: object

Game on twitch.tv

__init__(name, box, logo, twitchid, viewers=None, channels=None)[source]

Initialize a new game

Parameters:
  • name (str) – The name of the game
  • box (dict) – Links for the box logos
  • logo (dict) – Links for the game logo
  • twitchid (int) – The id used by twitch
  • viewers (int) – The current amount of viewers
  • channels (int) – The current amount of channels
Raises:

None

Methods

__init__(name, box, logo, twitchid[, ...]) Initialize a new game
wrap_json(json[, viewers, channels]) Create a Game instance for the given json
wrap_search(response) Wrap the response from a game search into instances
wrap_topgames(response) Wrap the response from quering the top games into instances

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

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

Wrap the response from quering the top games into instances and return them

Parameters:response (requests.Response) – The response for quering the top games
Returns:the new game instances
Return type:list of Game
Raises:None
classmethod wrap_json(json, viewers=None, channels=None)[source]

Create a Game instance for the given json

Parameters:
  • json (dict) – the dict with the information of the game
  • viewers (int) – The viewer count
  • channels (int) – The viewer count
Returns:

the new game instance

Return type:

Game

Raises:

None

name = None

The name of the game

box = None

Links for the box logos

Links for the logos

twitchid = None

Id used by twitch

viewers = None

Current amount of viewers

channels = None

Current amount of channels