yfpy.models.Game

class Game(extracted_data)[source]

Bases: YahooFantasyObject

Model class for “game” data key.

Instantiate the Game child class of YahooFantasyObject.

Parameters:

extracted_data (dict) – Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

code

The Yahoo Fantasy game code.

Type:

str

contest_group_id

The contest group ID of the Yahoo Fantasy game/contest.

Type:

int

current_week

The current (or last if complete) week of the Yahoo Fantasy game/contest.

Type:

int

editorial_season

The year in which the Yahoo Fantasy game/contest starts.

Type:

int

game_id

The Yahoo Fantasy game ID.

Type:

int

game_key

The Yahoo Fantasy game key.

Type:

str

game_weeks

A list of YFPY GameWeek instances.

Type:

list[GameWeek]

has_schedule

Numeric boolean (0 or 1) representing if the Yahoo Fantasy contest has a schedule.

Type:

int

is_contest_over

Numeric boolean (0 or 1) representing if the Yahoo Fantasy contest is complete.

Type:

int

is_contest_reg_active

Numeric boolean (0 or 1) representing if the Yahoo Fantasy contest is active.

Type:

int

is_game_over

Numeric boolean (0 or 1) representing if the Yahoo Fantasy game is complete.

Type:

int

is_live_draft_lobby_active

Numeric boolean (0 or 1) representing if the draft lobby is active.

Type:

int

is_offseason

Numeric boolean (0 or 1) representing if it is the offseason for the respective sport.

Type:

int

is_registration_over

Numeric boolean (0 or 1) representing registration for the fantasy game is over.

Type:

int

leagues

A list of YFPY League instances.

Type:

list[League]

name

The name of the Yahoo Fantasy game.

Type:

str

picks_status

The status of the Yahoo Fantasy game/contest picks when applicable.

Type:

str

players

A list of YFPY Player instances.

Type:

list[Player]

position_types

A list of YFPY PositionType instances.

Type:

list[PositionType]

roster_positions

A list of YFPY RosterPosition instances.

Type:

list[RosterPosition]

scenario_generator

Numeric boolean (0 or 1) representing if the Yahoo Fantasy game has a scenario generator.

Type:

int

season

The Yahoo Fantasy game year.

Type:

int

stat_categories

A YFPY StatCategories instance.

Type:

StatCategories

teams

A list of YFPY Team instances.

Type:

list[Team]

type

The type of the Yahoo Fantasy game.

Type:

str

url

The direct URL of the Yahoo Fantasy game.

Type:

str

Methods

clean_data_dict

Recursive method to un-type custom class type objects for serialization.

from_json

Deserialize JSON to a class object.

serialized

Pack up all object content into nested dictionaries for JSON serialization.

subclass_dict

Derive snake case dictionary keys from custom object type camel case class names.

to_json

Serialize the class object to JSON.

clean_data_dict()

Recursive method to un-type custom class type objects for serialization.

Returns:

Dictionary that extracts serializable data from custom objects.

Return type:

dict

classmethod from_json(json_data)

Deserialize JSON to a class object.

Returns:

Class object derived from JSON data.

Return type:

object

serialized()

Pack up all object content into nested dictionaries for JSON serialization.

Returns:

Serializable dictionary.

Return type:

dict

subclass_dict()

Derive snake case dictionary keys from custom object type camel case class names.

Returns:

Dictionary with snake case strings of all subclasses of YahooFantasyObject as keys and subclasses as values.

Return type:

dict

to_json()

Serialize the class object to JSON.

Returns:

JSON string derived from the serializable version of the class object.

Return type:

str