yfpy.models.League

class League(extracted_data)[source]

Bases: yfpy.models.YahooFantasyObject

Model class for “league” data key.

Instantiate the League child class of YahooFantasyObject.

Parameters

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

allow_add_to_dl_extra_pos

Numeric boolean (0 or 1) representing if the leagues allows adding extra positions to the DL (currently uncertain what this is).

Type

int

current_week

The current week number.

Type

int

draft_results

A list of YFPY DraftResult instances.

Type

list[DraftResult]

draft_status

The status of the draft (“postdraft”, etc.).

Type

str

display_name

The display name of the league.

Type

str

edit_key

The Yahoo edit key for the league.

Type

int

end_date

A date string representing the end date of the league (format: “YYYY-MM-DD”).

Type

str

end_week

The number of the last week of the league.

Type

int

entry_fee

The entry fee for Yahoo paid leagues (USD).

Type

str

game_code

The Yahoo game code (“nfl”, “nhl”, “nba”, “mlb”).

Type

str

iris_group_chat_id

The unique IRIS group chat ID for the league.

Type

str | null

is_cash_league

Numeric boolean (0 or 1) representing if the league is a Yahoo paid league.

Type

int

is_finished

Numeric boolean (0 or 1) representing if the league season has completed.

Type

int

is_pro_league

Numeric boolean (0 or 1) representing if the league is a Yahoo Pro league.

Type

str

league_id

The unique Yahoo league ID.

Type

str

league_key

The Yahoo league key.

Type

str

league_type

The type of the league (“private”, “public”).

Type

str

league_update_timestamp

A timestamp representing the last time the league was updated.

Type

int

logo_url

The direct URL of the league logo photo.

Type

str

name

The name of the league.

Type

str

num_teams

The number of teams in the league.

Type

str

password

The password required to join the league (if applicable).

Type

str | null

payment_deadline

A date string representing the deadline by which all league dues payments must be made (format: “YYYY-MM-DD”).

Type

str

players

A list of YFPY Player instances.

Type

list[Player]

renew

A string indicating the previous Yahoo game code and previous Yahoo league ID (Ex.: “371_811308”) (if applicable).

Type

str | null

renewed

A string indicating the next Yahoo game code and next Yahoo league ID (Ex.: “390_303233”) (if applicable).

Type

str | null

scoreboard

A YFPY Scoreboard instance.

Type

Scoreboard

matchups

A list of YFPY Matchup instances.

Type

list[Matchup]

scoring_type

The scoring type of the league (“head” for head-to-head, etc.).

Type

str

season

The season year of the league.

Type

int

settings

A YFPY Settings instance.

Type

Settings

short_invitation_url

The sharable short URL sent by invite allowing players to join the league.

Type

str

standings

A YFPY Standings instance.

Type

Standings

teams_ordered_by_standings

A list of YFPY Team instances ordered by their ranks in the league standings.

Type

list[Team]

start_date

A date string representing the start date of the league (format: “YYYY-MM-DD”).

Type

str

start_week

The number of the first week of the league.

Type

int

transactions

A list of YFPY Transaction instances.

Type

list[Transaction]

url

The direct URL of the league.

Type

str

weekly_deadline

The weekly deadline of the league (if applicable).

Type

str | null

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