yfpy.models.Player

class Player(extracted_data)[source]

Bases: yfpy.models.YahooFantasyObject

Model class for “player” data key.

Instantiate the Player child class of YahooFantasyObject.

Parameters

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

bye_weeks

A YFPY ByeWeeks instance.

Type

ByeWeeks

bye

The week number that the player is on bye.

Type

int

display_position

The display string for the player position.

Type

str

draft_analysis

A YFPY DraftAnalysis instance.

Type

DraftAnalysis

average_draft_pick

The average pick at which the player was drafted.

Type

float

average_draft_round

The average round in which the player was drafted.

Type

float

average_draft_cost

The average price paid for the player to be drafted.

Type

float

percent_drafted

The overall percentage the player was drafted.

Type

float

editorial_player_key

The Yahoo player key using the game key.

Type

str

editorial_team_abbr

The abbreviation of the professional team name for which the player plays.

Type

str

editorial_team_full_name

The name of the professional team for which the player plays.

Type

str

editorial_team_key

The Yahoo team key using the game key.

Type

str

eligible_positions

A list of positions for which the player is eligible.

Type

list[str]

has_player_notes

Numeric boolean (0 or 1) representing if the player has any notes.

Type

int

headshot

A YFPY Headshot instance.

Type

Headshot

headshot_size

The headshot photo size (“small”, “large”, etc.)

Type

str

headshot_url

The direct URL of the headshot photo.

Type

str

is_editable

Numeric boolean (0 or 1) representing if the player is editable.

Type

int

is_undroppable

Numeric boolean (0 or 1) representing if the player is undroppable.

Type

int

name

A YFPY Name instance.

Type

Name

first_name

The first name of the player.

Type

str

last_name

The last name of the player.

Type

str

full_name

The full name of the player.

Type

str

ownership

A YFPY Ownership instance.

Type

Ownership

percent_owned

A YFPY PercentOwned instanced.

Type

PercentOwned

percent_owned_value

The percentage value the player is/was owned in the coverage timeframe.

Type

float

player_id

The unique player ID.

Type

int

player_key

The Yahoo player key.

Type

str

player_notes_last_timestamp

A timestamp of the most recent players notes.

Type

int

player_points

A YFPY PlayerPoints instance.

Type

PlayerPoints

player_points_value

The total points for the player within the coverage timeframe.

Type

float

player_stats

A YFPY PlayerStats instance.

Type

PlayerStats

stats

A list of YFPY Stat instances.

Type

list[Stat]

position_type

The position type of the player (“offense”, “defense”, etc.).

Type

str

primary_position

The primary position of the player.

Type

str

selected_position

A YFPY SelectedPosition instance.

Type

SelectedPosition

selected_position_value

The selected position of the player.

Type

str

status

The status of the player (“IR”, “PUP”, “O”, “Q”, etc.).

Type

str

transaction_data

A YFPY TransactionData instance.

Type

TransactionData

uniform_number

The uniform number of the player.

Type

int

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