yfpy.models.Team

class Team(extracted_data)[source]

Bases: YahooFantasyObject

Model class for “team” data key.

Instantiate the Team child class of YahooFantasyObject.

Parameters:

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

can_edit_current_week

(for Survival Football) Numeric boolean (0 or 1) representing whether the user competing in the contest can make changes in the current week.

Type:

int

champion_pick

(for Tourney Pick’em) The selected champion for the contest.

Type:

str

champion_status

(for Tourney Pick’em) The final status of the selected champion for the contest.

Type:

str

clinched_playoffs

Numeric boolean (0 or 1) representing if the team has clinched a playoff berth.

Type:

int

division_id

The unique ID number of the division containing the team (if applicable).

Type:

int

done_week

(might be for Tourney Pick’em or Survival Football) ATTRIBUTE MEANING UNKNOWN.

Type:

str

draft_grade

The letter grade assigned to the draft completed by the team (“A+”, “A”, …, “F-“).

Type:

str

draft_position

The draft order/position of the team.

Type:

int

draft_recap_url

The direct URL of the draft recap for the team.

Type:

str

draft_results

A list of YFPY DraftResult instances.

Type:

list[DraftResult]

elimination_week

(for Survival Football) Numeric boolean (0 or 1) representing if there is an elimination week for the user competing in the contest.

Type:

int

email_address

(for Tourney Pick’em) The email address of the user competing in the contest.

Type:

str

faab_balance

The available balance of FAAB (Free Agent Acquisition Budget) (if applicable).

Type:

int

has_draft_grade

Numeric boolean (0 or 1) representing if the team has a draft grade available.

Type:

int

is_in_contest

(for Survival Football) Numeric boolean (0 or 1) representing if the user is in a contest.

Type:

int

is_owned_by_current_login

Numeric boolean (0 or 1) representing if the team is owned by the current user authenticated with the Yahoo Fantasy Sports REST API.

Type:

int

last_editable_week

(for Survival Football) String boolean (“True” or “False”) representing if it is the last editable week for the user competing in the contest.

Type:

str

league_scoring_type

Value designating the type of scoring used by the league (“head” for head-to-head, etc.).

Type:

str

logo_type

(for Tourney Pick’em) The team logo type (“avatar”, etc.) of the user competing in the contest.

Type:

str

manager

(for Survival Football) A YFPY Manager instance for the user competing in the contest.

Type:

Manager

managers

A list or dict (depending on source data) of YFPY Manager instances.

Type:

list[Manager] | dict[str, Manager]

matchups

A list of YFPY Matchup instances.

Type:

list[Matchup]

name

The team name.

Type:

str

number_of_moves

The number of moves made by the team (adds/drops/trades/etc.).

Type:

int

number_of_trades

The number of trades made by the team.

Type:

int

roster

A YFPY Roster instance.

Type:

Roster

players

A list of YFPY Player instances.

Type:

list[Player]

roster_adds

A YFPY RosterAdds instance.

Type:

RosterAdds

roster_adds_value

The number of roster adds made by the team.

Type:

int

team_id

The unique team ID in the league.

Type:

int

team_key

The Yahoo team key.

Type:

str

(for Tourney Pick’em) The direct URL to the team logo of the user competing in the contest.

Type:

str

team_logos

A list of YFPY TeamLogo instances.

Type:

list[TeamLogo]

team_paid

Numeric boolean (0 or 1) representing if the team has paid for Yahoo Fantasy Plus.

Type:

int

team_points

A YFPY TeamPoints instance.

Type:

TeamPoints

points

The total points scored by the team.

Type:

float

team_projected_points

A YFPY TeamProjectedPoints instance.

Type:

TeamProjectedPoints

projected_points

The total projected points for the team.

Type:

float

team_standings

A YFPY TeamStandings instance.

Type:

TeamStandings

wins

The number of wins by the team.

Type:

int

losses

The number of losses by the team.

Type:

int

ties

The number of ties by the team.

Type:

int

percentage

The win percentage of the team.

Type:

float

playoff_seed

The playoff seed of the team.

Type:

int

points_against

The total team points against.

Type:

float

points_for

The total team points for.

Type:

float

rank

The rank of the team in the league standings.

Type:

int

status

(for Survival Football) The status of user competing in the contest (“dead”, etc.).

Type:

str

streak_type

The active team win/loss/tie streak.

Type:

str

streak_length

The length of the streak.

Type:

int

total_strikes

(for Survival Football) The total number of strikes (incorrect selections) made by the user competing in the contest.

Type:

int

url

The direct URL to the team.

Type:

str

user_display_name

(for Tourney Pick’em) The display name for the user competing in the contest.

Type:

str

user_profile_image

(for Tourney Pick’em) The direct URL to the profile image of the user competing in the contest.

Type:

str

waiver_priority

The waiver priority of the team.

Type:

int

win_probability

The active win probability of the team in its current matchup (ranges from 0.0 to 1.0).

Type:

float

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