Models

YFPY module containing Python object models representing all currently known Yahoo Fantasy Sports REST API data.

This module is built to abstract away the intricacies of parsing the complex and oftentimes messy data returned by the Yahoo Fantasy Sports REST API, and instead provide the user with a collection of custom classes making it easy and intuitive to access the data content.

Attributes:
  • logger (Logger) –

    Module level logger for usage and debugging.

YahooFantasyObject

Bases: object

Base Yahoo Fantasy Sports data object from which all model classes inherit their methods and attributes.

Source code in yfpy/models.py
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
class YahooFantasyObject(object):
    """Base Yahoo Fantasy Sports data object from which all model classes inherit their methods and attributes.
    """

    def __init__(self, extracted_data: Dict):
        """Instantiate a Yahoo Fantasy Object.

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

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

        """
        self._extracted_data: Dict = extracted_data
        self._index: int = 0
        if isinstance(extracted_data, dict):
            self._keys: List = list(self._extracted_data.keys())

    def __str__(self):
        """Override __str__ to display YahooFantasyObject attribute values as JSON.
        """
        return f"{self.__class__.__name__}({self.to_json()})"

    def __repr__(self):
        """Override __repr__ to display YahooFantasyObject attribute values as JSON.
        """
        return f"{self.__class__.__name__}({self.to_json()})"

    def __getattribute__(self, attribute_name: str):
        """Override __getattribute__ to flatten lists of single-key dictionaries with objects as values to lists of
        objects.
        """
        attribute = object.__getattribute__(self, attribute_name)

        # skip builtin attributes that start with underscores and check if attribute is a list or dict
        if not attribute_name.startswith("_") and isinstance(attribute, (list, dict)):
            if attribute:
                # extract singular key from parent plural key
                attribute_element_name = None
                if attribute_name == "bonuses":
                    attribute_element_name = "bonus"
                elif attribute_name.endswith("s"):
                    attribute_element_name = attribute_name[:-1]

                if attribute_element_name:
                    if isinstance(attribute, list):
                        # flatten list of single-key dictionaries with object values to list of object values
                        return [el[attribute_element_name] if isinstance(el, dict) else el for el in attribute]
                    elif isinstance(attribute, dict):
                        # flatten single-key dictionary with object value to list of object
                        return [attribute[attribute_element_name]]
                    else:
                        return attribute
                else:
                    return attribute
            else:
                return attribute
        else:
            return attribute

    def __eq__(self, other):
        if not isinstance(other, self.__class__):
            return NotImplemented
        return self._equality_field_dict() == other._equality_field_dict()

    def __len__(self):
        return len(self._extracted_data)

    def __iter__(self):
        return self

    def __next__(self):
        try:
            if isinstance(self._extracted_data, dict):
                result = self._extracted_data.get(self._keys[self._index])
            else:
                result = self._extracted_data[self._index]
        except IndexError:
            raise StopIteration
        self._index += 1
        return result

    def __reversed__(self):
        return reversed(self._keys)

    def __del__(self):
        if os.environ.get("CHECK_FOR_MISSING_YAHOO_DATA", None):
            self._check_for_missing_fields()

    def _check_for_missing_fields(self) -> List[str]:

        unknown_extracted_data_keys = list(
            set(self._keys)
            - set([att for att in (set(dir(self)) - set(dir(YahooFantasyObject))) if not att.startswith("_")])
        )
        unknown_extracted_data_key_count = len(unknown_extracted_data_keys)

        if unknown_extracted_data_key_count > 0:
            logger.debug(
                f"The Yahoo Fantasy Sports API includes {unknown_extracted_data_key_count} additional data "
                f"fields for {self.__class__.__name__} that are not included in "
                f"YFPY: {unknown_extracted_data_keys}"
            )

        return unknown_extracted_data_keys

    @staticmethod
    def _get_nested_value(obj: object, value_parents: Union[str, List], value_default: Any = None,
                          value_as: Type = None) -> Any:

        if isinstance(value_parents, str):
            value_parents = [value_parents]

        try:
            for ref in value_parents:
                if isinstance(obj, dict):
                    obj = getitem(obj, ref)
                else:
                    obj = getattr(obj, ref)
        except KeyError:
            return value_default
        except AttributeError:
            return value_default

        if obj is not None:
            if value_as is not None:
                try:
                    return value_as(obj)
                except ValueError:
                    return value_default
            else:
                return obj
        else:
            return value_default

    def _convert_to_string(self, extracted_data_key: str) -> str:
        return str(self._extracted_data.get(extracted_data_key, ""))

    def _equality_field_dict(self) -> Dict:
        return {k: v for k, v in self.__dict__.items() if k not in ["_extracted_data", "_index", "_keys"]}

    def subclass_dict(self) -> Dict:
        """Derive snake case dictionary keys from custom object type camel case class names.

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

        """
        return {snakecase(cls.__name__): cls for cls in self.__class__.__mro__[-2].__subclasses__()}

    def clean_data_dict(self) -> Dict:
        """Recursive method to un-type custom class type objects for serialization.

        Returns:
            dict: Dictionary that extracts serializable data from custom objects.

        """
        clean_dict = {}
        for k, v in self.__dict__.items():
            if k in self._keys:
                clean_dict[k] = v.clean_data_dict() if type(v) in self.subclass_dict().values() else v
        return clean_dict

    def serialized(self) -> Dict:
        """Pack up all object content into nested dictionaries for JSON serialization.

        Returns:
            dict: Serializable dictionary.

        """
        serializable_dict = dict()
        for a, v in self.clean_data_dict().items():
            if hasattr(v, "serialized"):
                serializable_dict[a] = v.serialized()
            else:
                serializable_dict[a] = v
        return serializable_dict

    def to_json(self) -> str:
        """Serialize the class object to JSON.

        Returns:
            str: JSON string derived from the serializable version of the class object.

        """
        return jsonify_data(self.serialized())

    @classmethod
    def from_json(cls, json_data: Dict) -> object:
        """Deserialize JSON to a class object.

        Returns:
            object: Class object derived from JSON data.

        """
        return cls(json_data)

__init__

__init__(extracted_data)

Instantiate a Yahoo Fantasy Object.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Source code in yfpy/models.py
33
34
35
36
37
38
39
40
41
42
43
44
45
46
def __init__(self, extracted_data: Dict):
    """Instantiate a Yahoo Fantasy Object.

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

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

    """
    self._extracted_data: Dict = extracted_data
    self._index: int = 0
    if isinstance(extracted_data, dict):
        self._keys: List = list(self._extracted_data.keys())

__str__

__str__()

Override str to display YahooFantasyObject attribute values as JSON.

Source code in yfpy/models.py
48
49
50
51
def __str__(self):
    """Override __str__ to display YahooFantasyObject attribute values as JSON.
    """
    return f"{self.__class__.__name__}({self.to_json()})"

__repr__

__repr__()

Override repr to display YahooFantasyObject attribute values as JSON.

Source code in yfpy/models.py
53
54
55
56
def __repr__(self):
    """Override __repr__ to display YahooFantasyObject attribute values as JSON.
    """
    return f"{self.__class__.__name__}({self.to_json()})"

__getattribute__

__getattribute__(attribute_name)

Override getattribute to flatten lists of single-key dictionaries with objects as values to lists of objects.

Source code in yfpy/models.py
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
def __getattribute__(self, attribute_name: str):
    """Override __getattribute__ to flatten lists of single-key dictionaries with objects as values to lists of
    objects.
    """
    attribute = object.__getattribute__(self, attribute_name)

    # skip builtin attributes that start with underscores and check if attribute is a list or dict
    if not attribute_name.startswith("_") and isinstance(attribute, (list, dict)):
        if attribute:
            # extract singular key from parent plural key
            attribute_element_name = None
            if attribute_name == "bonuses":
                attribute_element_name = "bonus"
            elif attribute_name.endswith("s"):
                attribute_element_name = attribute_name[:-1]

            if attribute_element_name:
                if isinstance(attribute, list):
                    # flatten list of single-key dictionaries with object values to list of object values
                    return [el[attribute_element_name] if isinstance(el, dict) else el for el in attribute]
                elif isinstance(attribute, dict):
                    # flatten single-key dictionary with object value to list of object
                    return [attribute[attribute_element_name]]
                else:
                    return attribute
            else:
                return attribute
        else:
            return attribute
    else:
        return attribute

subclass_dict

subclass_dict()

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

Returns:
  • dict( Dict ) –

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

  • Dict

    values.

Source code in yfpy/models.py
171
172
173
174
175
176
177
178
179
def subclass_dict(self) -> Dict:
    """Derive snake case dictionary keys from custom object type camel case class names.

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

    """
    return {snakecase(cls.__name__): cls for cls in self.__class__.__mro__[-2].__subclasses__()}

clean_data_dict

clean_data_dict()

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

Returns:
  • dict( Dict ) –

    Dictionary that extracts serializable data from custom objects.

Source code in yfpy/models.py
181
182
183
184
185
186
187
188
189
190
191
192
def clean_data_dict(self) -> Dict:
    """Recursive method to un-type custom class type objects for serialization.

    Returns:
        dict: Dictionary that extracts serializable data from custom objects.

    """
    clean_dict = {}
    for k, v in self.__dict__.items():
        if k in self._keys:
            clean_dict[k] = v.clean_data_dict() if type(v) in self.subclass_dict().values() else v
    return clean_dict

serialized

serialized()

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

Returns:
  • dict( Dict ) –

    Serializable dictionary.

Source code in yfpy/models.py
194
195
196
197
198
199
200
201
202
203
204
205
206
207
def serialized(self) -> Dict:
    """Pack up all object content into nested dictionaries for JSON serialization.

    Returns:
        dict: Serializable dictionary.

    """
    serializable_dict = dict()
    for a, v in self.clean_data_dict().items():
        if hasattr(v, "serialized"):
            serializable_dict[a] = v.serialized()
        else:
            serializable_dict[a] = v
    return serializable_dict

to_json

to_json()

Serialize the class object to JSON.

Returns:
  • str( str ) –

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

Source code in yfpy/models.py
209
210
211
212
213
214
215
216
def to_json(self) -> str:
    """Serialize the class object to JSON.

    Returns:
        str: JSON string derived from the serializable version of the class object.

    """
    return jsonify_data(self.serialized())

from_json classmethod

from_json(json_data)

Deserialize JSON to a class object.

Returns:
  • object( object ) –

    Class object derived from JSON data.

Source code in yfpy/models.py
218
219
220
221
222
223
224
225
226
@classmethod
def from_json(cls, json_data: Dict) -> object:
    """Deserialize JSON to a class object.

    Returns:
        object: Class object derived from JSON data.

    """
    return cls(json_data)

User

Bases: YahooFantasyObject

Model class for "user" data key.

Source code in yfpy/models.py
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
class User(YahooFantasyObject):
    """Model class for "user" data key.
    """

    def __init__(self, extracted_data):
        """Instantiate the User child class of YahooFantasyObject.

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

        Attributes:
            games (list[Game]): The Yahoo Fantasy games in which the user participates/has participated.
            guid (str): The Yahoo user ID.

        """
        YahooFantasyObject.__init__(self, extracted_data)
        self.games: List = self._extracted_data.get("games", [])
        self.guid: str = self._extracted_data.get("guid", "")

__init__

__init__(extracted_data)

Instantiate the User child class of YahooFantasyObject.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • games (list[Game]) –

    The Yahoo Fantasy games in which the user participates/has participated.

  • guid (str) –

    The Yahoo user ID.

Source code in yfpy/models.py
234
235
236
237
238
239
240
241
242
243
244
245
246
247
def __init__(self, extracted_data):
    """Instantiate the User child class of YahooFantasyObject.

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

    Attributes:
        games (list[Game]): The Yahoo Fantasy games in which the user participates/has participated.
        guid (str): The Yahoo user ID.

    """
    YahooFantasyObject.__init__(self, extracted_data)
    self.games: List = self._extracted_data.get("games", [])
    self.guid: str = self._extracted_data.get("guid", "")

Game

Bases: YahooFantasyObject

Model class for "game" data key.

Source code in yfpy/models.py
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
class Game(YahooFantasyObject):
    """Model class for "game" data key.
    """

    def __init__(self, extracted_data):
        """Instantiate the Game child class of YahooFantasyObject.

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

        Attributes:
            code (str): The Yahoo Fantasy game code.
            contest_group_id (int): The contest group ID of the Yahoo Fantasy game/contest.
            current_week (int): The current (or last if complete) week of the Yahoo Fantasy game/contest.
            editorial_season (int): The year in which the Yahoo Fantasy game/contest starts.
            game_id (int): The Yahoo Fantasy game ID.
            game_key (str): The Yahoo Fantasy game key.
            game_weeks (list[GameWeek]): A list of YFPY GameWeek instances.
            has_schedule (int): Numeric boolean (0 or 1) representing if the Yahoo Fantasy contest has a schedule.
            is_contest_over (int): Numeric boolean (0 or 1) representing if the Yahoo Fantasy contest is complete.
            is_contest_reg_active (int): Numeric boolean (0 or 1) representing if the Yahoo Fantasy contest is active.
            is_game_over (int): Numeric boolean (0 or 1) representing if the Yahoo Fantasy game is complete.
            is_live_draft_lobby_active (int): Numeric boolean (0 or 1) representing if the draft lobby is active.
            is_offseason (int): Numeric boolean (0 or 1) representing if it is the offseason for the respective sport.
            is_registration_over (int): Numeric boolean (0 or 1) representing registration for the fantasy game is over.
            leagues (list[League]): A list of YFPY League instances.
            name (str): The name of the Yahoo Fantasy game.
            picks_status (str): The status of the Yahoo Fantasy game/contest picks when applicable.
            players (list[Player]): A list of YFPY Player instances.
            position_types (list[PositionType]): A list of YFPY PositionType instances.
            roster_positions (list[RosterPosition]): A list of YFPY RosterPosition instances.
            scenario_generator (int): Numeric boolean (0 or 1) representing if the Yahoo Fantasy game has a scenario
                generator.
            season (int): The Yahoo Fantasy game year.
            stat_categories (StatCategories): A YFPY StatCategories instance.
            teams (list[Team]): A list of YFPY Team instances.
            type (str): The type of the Yahoo Fantasy game.
            url (str): The direct URL of the Yahoo Fantasy game.

        """
        YahooFantasyObject.__init__(self, extracted_data)
        self.code: str = self._extracted_data.get("code", "")
        self.contest_group_id: Optional[int] = self._extracted_data.get("contest_group_id", None)
        self.current_week: Optional[int] = self._extracted_data.get("current_week", None)
        self.editorial_season: Optional[int] = self._extracted_data.get("editorial_season", None)
        self.game_id: Optional[int] = self._extracted_data.get("game_id", None)
        self.game_key: str = self._convert_to_string("game_key")  # convert to string to handle leading zeros
        self.game_weeks: List[GameWeek] = self._extracted_data.get("game_weeks", [])
        self.has_schedule: int = self._extracted_data.get("has_schedule", 0)
        self.is_contest_over: int = self._extracted_data.get("is_contest_over", 0)
        self.is_contest_reg_active: int = self._extracted_data.get("is_contest_reg_active", 0)
        self.is_game_over: int = self._extracted_data.get("is_game_over", 0)
        self.is_live_draft_lobby_active: int = self._extracted_data.get("is_live_draft_lobby_active", 0)
        self.is_offseason: int = self._extracted_data.get("is_offseason", 0)
        self.is_registration_over: int = self._extracted_data.get("is_registration_over", 0)
        self.leagues: List[League] = self._extracted_data.get("leagues", [])
        self.name: str = self._extracted_data.get("name", "")
        self.picks_status: str = self._extracted_data.get("picks_status", "")
        self.players: List[Player] = self._extracted_data.get("players", [])
        self.position_types: List[PositionType] = self._extracted_data.get("position_types", [])
        self.roster_positions: List[RosterPosition] = self._extracted_data.get("roster_positions", [])
        self.scenario_generator: int = self._extracted_data.get("scenario_generator", 0)
        self.season: Optional[int] = self._extracted_data.get("season", None)
        self.stat_categories: StatCategories = self._extracted_data.get("stat_categories", StatCategories({}))
        self.teams: List[Team] = self._extracted_data.get("teams", [])
        self.type: str = self._extracted_data.get("type", "")
        self.url: str = self._extracted_data.get("url", "")

__init__

__init__(extracted_data)

Instantiate the Game child class of YahooFantasyObject.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • code (str) –

    The Yahoo Fantasy game code.

  • contest_group_id (int) –

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

  • current_week (int) –

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

  • editorial_season (int) –

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

  • game_id (int) –

    The Yahoo Fantasy game ID.

  • game_key (str) –

    The Yahoo Fantasy game key.

  • game_weeks (list[GameWeek]) –

    A list of YFPY GameWeek instances.

  • has_schedule (int) –

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

  • is_contest_over (int) –

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

  • is_contest_reg_active (int) –

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

  • is_game_over (int) –

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

  • is_live_draft_lobby_active (int) –

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

  • is_offseason (int) –

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

  • is_registration_over (int) –

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

  • leagues (list[League]) –

    A list of YFPY League instances.

  • name (str) –

    The name of the Yahoo Fantasy game.

  • picks_status (str) –

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

  • players (list[Player]) –

    A list of YFPY Player instances.

  • position_types (list[PositionType]) –

    A list of YFPY PositionType instances.

  • roster_positions (list[RosterPosition]) –

    A list of YFPY RosterPosition instances.

  • scenario_generator (int) –

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

  • season (int) –

    The Yahoo Fantasy game year.

  • stat_categories (StatCategories) –

    A YFPY StatCategories instance.

  • teams (list[Team]) –

    A list of YFPY Team instances.

  • type (str) –

    The type of the Yahoo Fantasy game.

  • url (str) –

    The direct URL of the Yahoo Fantasy game.

Source code in yfpy/models.py
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
def __init__(self, extracted_data):
    """Instantiate the Game child class of YahooFantasyObject.

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

    Attributes:
        code (str): The Yahoo Fantasy game code.
        contest_group_id (int): The contest group ID of the Yahoo Fantasy game/contest.
        current_week (int): The current (or last if complete) week of the Yahoo Fantasy game/contest.
        editorial_season (int): The year in which the Yahoo Fantasy game/contest starts.
        game_id (int): The Yahoo Fantasy game ID.
        game_key (str): The Yahoo Fantasy game key.
        game_weeks (list[GameWeek]): A list of YFPY GameWeek instances.
        has_schedule (int): Numeric boolean (0 or 1) representing if the Yahoo Fantasy contest has a schedule.
        is_contest_over (int): Numeric boolean (0 or 1) representing if the Yahoo Fantasy contest is complete.
        is_contest_reg_active (int): Numeric boolean (0 or 1) representing if the Yahoo Fantasy contest is active.
        is_game_over (int): Numeric boolean (0 or 1) representing if the Yahoo Fantasy game is complete.
        is_live_draft_lobby_active (int): Numeric boolean (0 or 1) representing if the draft lobby is active.
        is_offseason (int): Numeric boolean (0 or 1) representing if it is the offseason for the respective sport.
        is_registration_over (int): Numeric boolean (0 or 1) representing registration for the fantasy game is over.
        leagues (list[League]): A list of YFPY League instances.
        name (str): The name of the Yahoo Fantasy game.
        picks_status (str): The status of the Yahoo Fantasy game/contest picks when applicable.
        players (list[Player]): A list of YFPY Player instances.
        position_types (list[PositionType]): A list of YFPY PositionType instances.
        roster_positions (list[RosterPosition]): A list of YFPY RosterPosition instances.
        scenario_generator (int): Numeric boolean (0 or 1) representing if the Yahoo Fantasy game has a scenario
            generator.
        season (int): The Yahoo Fantasy game year.
        stat_categories (StatCategories): A YFPY StatCategories instance.
        teams (list[Team]): A list of YFPY Team instances.
        type (str): The type of the Yahoo Fantasy game.
        url (str): The direct URL of the Yahoo Fantasy game.

    """
    YahooFantasyObject.__init__(self, extracted_data)
    self.code: str = self._extracted_data.get("code", "")
    self.contest_group_id: Optional[int] = self._extracted_data.get("contest_group_id", None)
    self.current_week: Optional[int] = self._extracted_data.get("current_week", None)
    self.editorial_season: Optional[int] = self._extracted_data.get("editorial_season", None)
    self.game_id: Optional[int] = self._extracted_data.get("game_id", None)
    self.game_key: str = self._convert_to_string("game_key")  # convert to string to handle leading zeros
    self.game_weeks: List[GameWeek] = self._extracted_data.get("game_weeks", [])
    self.has_schedule: int = self._extracted_data.get("has_schedule", 0)
    self.is_contest_over: int = self._extracted_data.get("is_contest_over", 0)
    self.is_contest_reg_active: int = self._extracted_data.get("is_contest_reg_active", 0)
    self.is_game_over: int = self._extracted_data.get("is_game_over", 0)
    self.is_live_draft_lobby_active: int = self._extracted_data.get("is_live_draft_lobby_active", 0)
    self.is_offseason: int = self._extracted_data.get("is_offseason", 0)
    self.is_registration_over: int = self._extracted_data.get("is_registration_over", 0)
    self.leagues: List[League] = self._extracted_data.get("leagues", [])
    self.name: str = self._extracted_data.get("name", "")
    self.picks_status: str = self._extracted_data.get("picks_status", "")
    self.players: List[Player] = self._extracted_data.get("players", [])
    self.position_types: List[PositionType] = self._extracted_data.get("position_types", [])
    self.roster_positions: List[RosterPosition] = self._extracted_data.get("roster_positions", [])
    self.scenario_generator: int = self._extracted_data.get("scenario_generator", 0)
    self.season: Optional[int] = self._extracted_data.get("season", None)
    self.stat_categories: StatCategories = self._extracted_data.get("stat_categories", StatCategories({}))
    self.teams: List[Team] = self._extracted_data.get("teams", [])
    self.type: str = self._extracted_data.get("type", "")
    self.url: str = self._extracted_data.get("url", "")

GameWeek

Bases: YahooFantasyObject

Model class for "game_week" data key.

Source code in yfpy/models.py
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
class GameWeek(YahooFantasyObject):
    """Model class for "game_week" data key.
    """

    def __init__(self, extracted_data):
        """Instantiate the GameWeek child class of YahooFantasyObject.

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

        Attributes:
            display_name (str): The display name of the Yahoo Fantasy game week.
            end (str): The end date of the Yahoo Fantasy game week.
            start (str): The start date of the Yahoo Fantasy game week.
            week (int): The week number of the Yahoo Fantasy game week.

        """
        YahooFantasyObject.__init__(self, extracted_data)
        self.display_name: str = self._extracted_data.get("display_name", "")
        self.end: str = self._extracted_data.get("end", "")
        self.start: str = self._extracted_data.get("start", "")
        self.week: Optional[int] = self._extracted_data.get("week", None)

__init__

__init__(extracted_data)

Instantiate the GameWeek child class of YahooFantasyObject.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • display_name (str) –

    The display name of the Yahoo Fantasy game week.

  • end (str) –

    The end date of the Yahoo Fantasy game week.

  • start (str) –

    The start date of the Yahoo Fantasy game week.

  • week (int) –

    The week number of the Yahoo Fantasy game week.

Source code in yfpy/models.py
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
def __init__(self, extracted_data):
    """Instantiate the GameWeek child class of YahooFantasyObject.

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

    Attributes:
        display_name (str): The display name of the Yahoo Fantasy game week.
        end (str): The end date of the Yahoo Fantasy game week.
        start (str): The start date of the Yahoo Fantasy game week.
        week (int): The week number of the Yahoo Fantasy game week.

    """
    YahooFantasyObject.__init__(self, extracted_data)
    self.display_name: str = self._extracted_data.get("display_name", "")
    self.end: str = self._extracted_data.get("end", "")
    self.start: str = self._extracted_data.get("start", "")
    self.week: Optional[int] = self._extracted_data.get("week", None)

PositionType

Bases: YahooFantasyObject

Model class for "position_type" data key.

Source code in yfpy/models.py
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
class PositionType(YahooFantasyObject):
    """Model class for "position_type" data key.
    """

    def __init__(self, extracted_data):
        """Instantiate the PositionType child class of YahooFantasyObject.

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

        Attributes:
            type (str): The type of the player position ("offense", "defense", etc.).
            display_name (str): The full text display of the position type.

        """
        YahooFantasyObject.__init__(self, extracted_data)
        self.type: str = self._extracted_data.get("type", "")
        self.display_name: str = self._extracted_data.get("display_name", "")

__init__

__init__(extracted_data)

Instantiate the PositionType child class of YahooFantasyObject.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • type (str) –

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

  • display_name (str) –

    The full text display of the position type.

Source code in yfpy/models.py
350
351
352
353
354
355
356
357
358
359
360
361
362
363
def __init__(self, extracted_data):
    """Instantiate the PositionType child class of YahooFantasyObject.

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

    Attributes:
        type (str): The type of the player position ("offense", "defense", etc.).
        display_name (str): The full text display of the position type.

    """
    YahooFantasyObject.__init__(self, extracted_data)
    self.type: str = self._extracted_data.get("type", "")
    self.display_name: str = self._extracted_data.get("display_name", "")

League

Bases: YahooFantasyObject

Model class for "league" data key.

Source code in yfpy/models.py
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
class League(YahooFantasyObject):
    """Model class for "league" data key.
    """

    def __init__(self, extracted_data):
        """Instantiate the League child class of YahooFantasyObject.

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

        Attributes:
            allow_add_to_dl_extra_pos (int): Numeric boolean (0 or 1) representing if the leagues allows adding extra
                positions to the DL (currently uncertain what this is).
            current_week (int): The current week number.
            draft_results (list[DraftResult]): A list of YFPY DraftResult instances.
            draft_status (str): The status of the draft ("postdraft", etc.).
            display_name (str): The display name of the league.
            edit_key (int): The Yahoo edit key for the league.
            end_date (str): A date string representing the end date of the league (format: "YYYY-MM-DD").
            end_week (int): The number of the last week of the league.
            entry_fee (str): The entry fee for Yahoo paid leagues (USD).
            felo_tier (str): The league fantasy ELO level (Bronze, Silver, Gold, Platinum, Diamond).
            game_code (str): The Yahoo game code ("nfl", "nhl", "nba", "mlb").
            iris_group_chat_id (str | null): The unique IRIS group chat ID for the league.
            is_cash_league (int): Numeric boolean (0 or 1) representing if the league is a Yahoo paid league.
            is_finished (int): Numeric boolean (0 or 1) representing if the league season has completed.
            is_plus_league (int): Numeric boolean (0 or 1) representing if the league has paid for Yahoo Fantasy Plus.
            is_pro_league (str): Numeric boolean (0 or 1) representing if the league is a Yahoo Pro league.
            league_id (str): The unique Yahoo league ID.
            league_key (str): The Yahoo league key.
            league_type (str): The type of the league ("private", "public").
            league_update_timestamp (int): A timestamp representing the last time the league was updated.
            logo_url (str): The direct URL of the league logo photo.
            name (str): The name of the league.
            num_teams (str): The number of teams in the league.
            password (str | null): The password required to join the league (if applicable).
            payment_deadline (str): A date string representing the deadline by which all league dues payments must be
                made (format: "YYYY-MM-DD").
            players (list[Player]): A list of YFPY Player instances.
            renew (str | null): A string indicating the previous Yahoo game code and previous Yahoo league ID (Ex.:
                "371_811308") (if applicable).
            renewed (str | null): A string indicating the next Yahoo game code and next Yahoo league ID (Ex.:
                "390_303233") (if applicable).
            scoreboard (Scoreboard): A YFPY Scoreboard instance.
            matchups (list[Matchup]): A list of YFPY Matchup instances.
            scoring_type (str): The scoring type of the league ("head" for head-to-head, etc.).
            season (int): The season year of the league.
            settings (Settings): A YFPY Settings instance.
            short_invitation_url (str): The sharable short URL sent by invite allowing players to join the league.
            standings (Standings): A YFPY Standings instance.
            start_date (str): A date string representing the start date of the league (format: "YYYY-MM-DD").
            start_week (int): The number of the first week of the league.
            teams (list[Team]): A list of YFPY Team instances.
            teams_ordered_by_standings (list[Team]): A list of YFPY Team instances ordered by their ranks in the league
                standings.
            transactions (list[Transaction]): A list of YFPY Transaction instances.
            url (str): The direct URL of the league.
            weekly_deadline (str | null): The weekly deadline of the league (if applicable).

        """
        YahooFantasyObject.__init__(self, extracted_data)
        self.allow_add_to_dl_extra_pos: int = self._extracted_data.get("allow_add_to_dl_extra_pos", 0)
        self.current_week: Optional[int] = self._extracted_data.get("current_week", None)
        self.draft_results: List[DraftResult] = self._extracted_data.get("draft_results", [])
        self.draft_status: str = self._extracted_data.get("draft_status", "")
        self.display_name: str = self._extracted_data.get("display_name", "")
        self.edit_key: Optional[int] = self._extracted_data.get("edit_key", None)
        self.end_date: str = self._extracted_data.get("end_date", "")
        self.end_week: Optional[str] = self._extracted_data.get("end_week", None)
        self.entry_fee: str = self._extracted_data.get("entry_fee", "")
        self.felo_tier: str = self._extracted_data.get("felo_tier", "")
        self.game_code: str = self._extracted_data.get("game_code", "")
        self.iris_group_chat_id: str = self._extracted_data.get("iris_group_chat_id", "")
        self.is_cash_league: int = self._extracted_data.get("is_cash_league", 0)
        self.is_finished: int = self._extracted_data.get("is_finished", 0)
        self.is_plus_league: int = self._extracted_data.get("is_plus_league", 0)
        self.is_pro_league: int = self._extracted_data.get("is_pro_league", 0)
        self.league_id: str = self._convert_to_string("league_id")  # convert to string to handle leading zeros
        self.league_key: str = self._extracted_data.get("league_key", "")
        self.league_type: str = self._extracted_data.get("league_type", "")
        self.league_update_timestamp: Optional[int] = self._extracted_data.get("league_update_timestamp", None)
        self.logo_url: str = self._extracted_data.get("logo_url", "")
        self.name: bytes = self._extracted_data.get("name", "").encode("utf-8")  # support special characters
        self.num_teams: int = self._extracted_data.get("num_teams", 0)
        self.password: str = self._extracted_data.get("password", "")
        self.payment_deadline: str = self._extracted_data.get("payment_deadline", "")
        self.players: List[Player] = self._extracted_data.get("players", [])
        self.renew: str = self._extracted_data.get("renew", "")
        self.renewed: str = self._extracted_data.get("renewed", "")
        self.scoreboard: Scoreboard = self._extracted_data.get("scoreboard", Scoreboard({}))
        self.matchups: List[Matchup] = self._get_nested_value(self.scoreboard, "matchups", [])
        self.scoring_type: str = self._extracted_data.get("scoring_type", "")
        self.season: Optional[int] = self._extracted_data.get("season", None)
        self.settings: Settings = self._extracted_data.get("settings", Settings({}))
        self.short_invitation_url: str = self._extracted_data.get("short_invitation_url", "")
        self.standings: Standings = self._extracted_data.get("standings", Standings({}))
        self.start_date: str = self._extracted_data.get("start_date", "")
        self.start_week: Optional[int] = self._extracted_data.get("start_week", None)
        self.teams: List[Team] = self._extracted_data.get("teams", [])
        self.teams_ordered_by_standings: List[Team] = self._get_nested_value(self.standings, "teams", [])
        self.transactions: List[Transaction] = self._extracted_data.get("transactions", [])
        self.url: str = self._extracted_data.get("url", "")
        self.weekly_deadline: str = self._extracted_data.get("weekly_deadline", "")

__init__

__init__(extracted_data)

Instantiate the League child class of YahooFantasyObject.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • allow_add_to_dl_extra_pos (int) –

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

  • current_week (int) –

    The current week number.

  • draft_results (list[DraftResult]) –

    A list of YFPY DraftResult instances.

  • draft_status (str) –

    The status of the draft ("postdraft", etc.).

  • display_name (str) –

    The display name of the league.

  • edit_key (int) –

    The Yahoo edit key for the league.

  • end_date (str) –

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

  • end_week (int) –

    The number of the last week of the league.

  • entry_fee (str) –

    The entry fee for Yahoo paid leagues (USD).

  • felo_tier (str) –

    The league fantasy ELO level (Bronze, Silver, Gold, Platinum, Diamond).

  • game_code (str) –

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

  • iris_group_chat_id (str | null) –

    The unique IRIS group chat ID for the league.

  • is_cash_league (int) –

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

  • is_finished (int) –

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

  • is_plus_league (int) –

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

  • is_pro_league (str) –

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

  • league_id (str) –

    The unique Yahoo league ID.

  • league_key (str) –

    The Yahoo league key.

  • league_type (str) –

    The type of the league ("private", "public").

  • league_update_timestamp (int) –

    A timestamp representing the last time the league was updated.

  • logo_url (str) –

    The direct URL of the league logo photo.

  • name (str) –

    The name of the league.

  • num_teams (str) –

    The number of teams in the league.

  • password (str | null) –

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

  • payment_deadline (str) –

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

  • players (list[Player]) –

    A list of YFPY Player instances.

  • renew (str | null) –

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

  • renewed (str | null) –

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

  • scoreboard (Scoreboard) –

    A YFPY Scoreboard instance.

  • matchups (list[Matchup]) –

    A list of YFPY Matchup instances.

  • scoring_type (str) –

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

  • season (int) –

    The season year of the league.

  • settings (Settings) –

    A YFPY Settings instance.

  • short_invitation_url (str) –

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

  • standings (Standings) –

    A YFPY Standings instance.

  • start_date (str) –

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

  • start_week (int) –

    The number of the first week of the league.

  • teams (list[Team]) –

    A list of YFPY Team instances.

  • teams_ordered_by_standings (list[Team]) –

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

  • transactions (list[Transaction]) –

    A list of YFPY Transaction instances.

  • url (str) –

    The direct URL of the league.

  • weekly_deadline (str | null) –

    The weekly deadline of the league (if applicable).

Source code in yfpy/models.py
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
def __init__(self, extracted_data):
    """Instantiate the League child class of YahooFantasyObject.

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

    Attributes:
        allow_add_to_dl_extra_pos (int): Numeric boolean (0 or 1) representing if the leagues allows adding extra
            positions to the DL (currently uncertain what this is).
        current_week (int): The current week number.
        draft_results (list[DraftResult]): A list of YFPY DraftResult instances.
        draft_status (str): The status of the draft ("postdraft", etc.).
        display_name (str): The display name of the league.
        edit_key (int): The Yahoo edit key for the league.
        end_date (str): A date string representing the end date of the league (format: "YYYY-MM-DD").
        end_week (int): The number of the last week of the league.
        entry_fee (str): The entry fee for Yahoo paid leagues (USD).
        felo_tier (str): The league fantasy ELO level (Bronze, Silver, Gold, Platinum, Diamond).
        game_code (str): The Yahoo game code ("nfl", "nhl", "nba", "mlb").
        iris_group_chat_id (str | null): The unique IRIS group chat ID for the league.
        is_cash_league (int): Numeric boolean (0 or 1) representing if the league is a Yahoo paid league.
        is_finished (int): Numeric boolean (0 or 1) representing if the league season has completed.
        is_plus_league (int): Numeric boolean (0 or 1) representing if the league has paid for Yahoo Fantasy Plus.
        is_pro_league (str): Numeric boolean (0 or 1) representing if the league is a Yahoo Pro league.
        league_id (str): The unique Yahoo league ID.
        league_key (str): The Yahoo league key.
        league_type (str): The type of the league ("private", "public").
        league_update_timestamp (int): A timestamp representing the last time the league was updated.
        logo_url (str): The direct URL of the league logo photo.
        name (str): The name of the league.
        num_teams (str): The number of teams in the league.
        password (str | null): The password required to join the league (if applicable).
        payment_deadline (str): A date string representing the deadline by which all league dues payments must be
            made (format: "YYYY-MM-DD").
        players (list[Player]): A list of YFPY Player instances.
        renew (str | null): A string indicating the previous Yahoo game code and previous Yahoo league ID (Ex.:
            "371_811308") (if applicable).
        renewed (str | null): A string indicating the next Yahoo game code and next Yahoo league ID (Ex.:
            "390_303233") (if applicable).
        scoreboard (Scoreboard): A YFPY Scoreboard instance.
        matchups (list[Matchup]): A list of YFPY Matchup instances.
        scoring_type (str): The scoring type of the league ("head" for head-to-head, etc.).
        season (int): The season year of the league.
        settings (Settings): A YFPY Settings instance.
        short_invitation_url (str): The sharable short URL sent by invite allowing players to join the league.
        standings (Standings): A YFPY Standings instance.
        start_date (str): A date string representing the start date of the league (format: "YYYY-MM-DD").
        start_week (int): The number of the first week of the league.
        teams (list[Team]): A list of YFPY Team instances.
        teams_ordered_by_standings (list[Team]): A list of YFPY Team instances ordered by their ranks in the league
            standings.
        transactions (list[Transaction]): A list of YFPY Transaction instances.
        url (str): The direct URL of the league.
        weekly_deadline (str | null): The weekly deadline of the league (if applicable).

    """
    YahooFantasyObject.__init__(self, extracted_data)
    self.allow_add_to_dl_extra_pos: int = self._extracted_data.get("allow_add_to_dl_extra_pos", 0)
    self.current_week: Optional[int] = self._extracted_data.get("current_week", None)
    self.draft_results: List[DraftResult] = self._extracted_data.get("draft_results", [])
    self.draft_status: str = self._extracted_data.get("draft_status", "")
    self.display_name: str = self._extracted_data.get("display_name", "")
    self.edit_key: Optional[int] = self._extracted_data.get("edit_key", None)
    self.end_date: str = self._extracted_data.get("end_date", "")
    self.end_week: Optional[str] = self._extracted_data.get("end_week", None)
    self.entry_fee: str = self._extracted_data.get("entry_fee", "")
    self.felo_tier: str = self._extracted_data.get("felo_tier", "")
    self.game_code: str = self._extracted_data.get("game_code", "")
    self.iris_group_chat_id: str = self._extracted_data.get("iris_group_chat_id", "")
    self.is_cash_league: int = self._extracted_data.get("is_cash_league", 0)
    self.is_finished: int = self._extracted_data.get("is_finished", 0)
    self.is_plus_league: int = self._extracted_data.get("is_plus_league", 0)
    self.is_pro_league: int = self._extracted_data.get("is_pro_league", 0)
    self.league_id: str = self._convert_to_string("league_id")  # convert to string to handle leading zeros
    self.league_key: str = self._extracted_data.get("league_key", "")
    self.league_type: str = self._extracted_data.get("league_type", "")
    self.league_update_timestamp: Optional[int] = self._extracted_data.get("league_update_timestamp", None)
    self.logo_url: str = self._extracted_data.get("logo_url", "")
    self.name: bytes = self._extracted_data.get("name", "").encode("utf-8")  # support special characters
    self.num_teams: int = self._extracted_data.get("num_teams", 0)
    self.password: str = self._extracted_data.get("password", "")
    self.payment_deadline: str = self._extracted_data.get("payment_deadline", "")
    self.players: List[Player] = self._extracted_data.get("players", [])
    self.renew: str = self._extracted_data.get("renew", "")
    self.renewed: str = self._extracted_data.get("renewed", "")
    self.scoreboard: Scoreboard = self._extracted_data.get("scoreboard", Scoreboard({}))
    self.matchups: List[Matchup] = self._get_nested_value(self.scoreboard, "matchups", [])
    self.scoring_type: str = self._extracted_data.get("scoring_type", "")
    self.season: Optional[int] = self._extracted_data.get("season", None)
    self.settings: Settings = self._extracted_data.get("settings", Settings({}))
    self.short_invitation_url: str = self._extracted_data.get("short_invitation_url", "")
    self.standings: Standings = self._extracted_data.get("standings", Standings({}))
    self.start_date: str = self._extracted_data.get("start_date", "")
    self.start_week: Optional[int] = self._extracted_data.get("start_week", None)
    self.teams: List[Team] = self._extracted_data.get("teams", [])
    self.teams_ordered_by_standings: List[Team] = self._get_nested_value(self.standings, "teams", [])
    self.transactions: List[Transaction] = self._extracted_data.get("transactions", [])
    self.url: str = self._extracted_data.get("url", "")
    self.weekly_deadline: str = self._extracted_data.get("weekly_deadline", "")

Team

Bases: YahooFantasyObject

Model class for "team" data key.

Source code in yfpy/models.py
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
class Team(YahooFantasyObject):
    """Model class for "team" data key.
    """

    def __init__(self, extracted_data):
        """Instantiate the Team child class of YahooFantasyObject.

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

        Attributes:
            can_edit_current_week (int): (for Survival Football) Numeric boolean (0 or 1) representing whether the user
                competing in the contest can make changes in the current week.
            champion_pick (str): (for Tourney Pick'em) The selected champion for the contest.
            champion_status (str): (for Tourney Pick'em) The final status of the selected champion for the contest.
            clinched_playoffs (int): Numeric boolean (0 or 1) representing if the team has clinched a playoff berth.
            division_id (int): The unique ID number of the division containing the team (if applicable).
            done_week (str): (might be for Tourney Pick'em or Survival Football) ATTRIBUTE MEANING UNKNOWN.
            draft_grade (str): The letter grade assigned to the draft completed by the team ("A+", "A", ..., "F-").
            draft_position (int): The draft order/position of the team.
            draft_recap_url (str): The direct URL of the draft recap for the team.
            draft_results (list[DraftResult]): A list of YFPY DraftResult instances.
            elimination_week (int): (for Survival Football) Numeric boolean (0 or 1) representing if there is an
                elimination week for the user competing in the contest.
            email_address (str): (for Tourney Pick'em) The email address of the user competing in the contest.
            faab_balance (int): The available balance of FAAB (Free Agent Acquisition Budget) (if applicable).
            has_draft_grade (int): Numeric boolean (0 or 1) representing if the team has a draft grade available.
            is_in_contest (int): (for Survival Football) Numeric boolean (0 or 1) representing if the user is in a
                contest.
            is_owned_by_current_login (int): Numeric boolean (0 or 1) representing if the team is owned by the current
                user authenticated with the Yahoo Fantasy Sports REST API.
            last_editable_week (str): (for Survival Football) String boolean ("True" or "False") representing if it is
                the last editable week for the user competing in the contest.
            league_scoring_type (str): Value designating the type of scoring used by the league ("head" for
                head-to-head, etc.).
            logo_type (str): (for Tourney Pick'em) The team logo type ("avatar", etc.) of the user competing in the
                contest.
            manager (Manager): (for Survival Football) A YFPY Manager instance for the user competing in the contest.
            managers (list[Manager] | dict[str, Manager]): A list or dict (depending on source data) of YFPY Manager
                instances.
            matchups (list[Matchup]): A list of YFPY Matchup instances.
            name (str): The team name.
            number_of_moves (int): The number of moves made by the team (adds/drops/trades/etc.).
            number_of_trades (int): The number of trades made by the team.
            roster (Roster): A YFPY Roster instance.
            players (list[Player]): A list of YFPY Player instances.
            roster_adds (RosterAdds): A YFPY RosterAdds instance.
            roster_adds_value (int): The number of roster adds made by the team.
            team_id (int): The unique team ID in the league.
            team_key (str): The Yahoo team key.
            team_logo (str): (for Tourney Pick'em) The direct URL to the team logo of the user competing in the contest.
            team_logos (list[TeamLogo]): A list of YFPY TeamLogo instances.
            team_paid (int): Numeric boolean (0 or 1) representing if the team has paid for Yahoo Fantasy Plus.
            team_points (TeamPoints): A YFPY TeamPoints instance.
            points (float): The total points scored by the team.
            team_projected_points (TeamProjectedPoints): A YFPY TeamProjectedPoints instance.
            projected_points (float): The total projected points for the team.
            team_standings (TeamStandings): A YFPY TeamStandings instance.
            wins (int): The number of wins by the team.
            losses (int): The number of losses by the team.
            ties (int): The number of ties by the team.
            percentage (float): The win percentage of the team.
            playoff_seed (int): The playoff seed of the team.
            points_against (float): The total team points against.
            points_for (float): The total team points for.
            rank (int): The rank of the team in the league standings.
            status (str): (for Survival Football) The status of user competing in the contest ("dead", etc.).
            streak_type (str): The active team win/loss/tie streak.
            streak_length (int): The length of the streak.
            total_strikes (int): (for Survival Football) The total number of strikes (incorrect selections) made by the
                user competing in the contest.
            url (str): The direct URL to the team.
            user_display_name (str): (for Tourney Pick'em) The display name for the user competing in the contest.
            user_profile_image (str): (for Tourney Pick'em) The direct URL to the profile image of the user competing
                in the contest.
            waiver_priority (int): The waiver priority of the team.
            win_probability (float): The active win probability of the team in its current matchup (ranges from 0.0 to
                1.0).

        """
        YahooFantasyObject.__init__(self, extracted_data)
        self.can_edit_current_week: int = self._extracted_data.get("can_edit_current_week", 0)
        self.champion_pick: str = self._extracted_data.get("champion_pick", "")
        self.champion_status: str = self._extracted_data.get("champion_status", "")
        self.clinched_playoffs: int = self._extracted_data.get("clinched_playoffs", 0)
        self.division_id: Optional[int] = self._extracted_data.get("division_id", None)
        self.done_week: Optional[str] = self._extracted_data.get("done_week", None)
        self.draft_grade: str = self._extracted_data.get("draft_grade", "")
        self.draft_position: Optional[int] = self._extracted_data.get("draft_position", None)
        self.draft_recap_url: str = self._extracted_data.get("draft_recap_url", "")
        self.draft_results: List[DraftResult] = self._extracted_data.get("draft_results", [])
        self.elimination_week: Optional[int] = self._extracted_data.get("elimination_week", None)
        self.email_address: str = self._extracted_data.get("email_address", "")
        self.faab_balance: Optional[int] = self._extracted_data.get("faab_balance", None)
        self.has_draft_grade: int = self._extracted_data.get("has_draft_grade", 0)
        self.is_in_contest: int = self._extracted_data.get("is_in_contest", 0)
        self.is_owned_by_current_login: int = self._extracted_data.get("is_owned_by_current_login", 0)
        self.last_editable_week: str = self._extracted_data.get("last_editable_week", "")
        self.league_scoring_type: str = self._extracted_data.get("league_scoring_type", "")
        self.logo_type: str = self._extracted_data.get("logo_type", "")
        self.manager: Manager = self._extracted_data.get("manager", Manager({}))
        self.managers: List[Manager] = self._extracted_data.get("managers", [])
        self.matchups: List[Matchup] = self._extracted_data.get("matchups", [])
        self.name: bytes = self._extracted_data.get("name", "").encode("utf-8")  # support special characters
        self.number_of_moves: int = self._extracted_data.get("number_of_moves", 0)
        self.number_of_trades: int = self._extracted_data.get("number_of_trades", 0)
        self.roster: Roster = self._extracted_data.get("roster", Roster({}))
        self.players: List[Player] = self._get_nested_value(self.roster, "players", [])
        self.roster_adds: RosterAdds = self._extracted_data.get("roster_adds", RosterAdds({}))
        self.roster_adds_value: int = self._get_nested_value(self.roster_adds, "value", 0)
        self.team_id: Optional[int] = self._extracted_data.get("team_id", None)
        self.team_key: str = self._extracted_data.get("team_key", "")
        self.team_logo: str = self._extracted_data.get("team_logo", "")
        self.team_logos: List[TeamLogo] = self._extracted_data.get("team_logos", [])
        self.team_paid: int = self._extracted_data.get("team_paid", 0)
        self.team_points: TeamPoints = self._extracted_data.get("team_points", TeamPoints({}))
        self.points: float = self._get_nested_value(self.team_points, "total", 0.0, float)
        self.team_projected_points: TeamProjectedPoints = self._extracted_data.get("team_projected_points",
                                                                                   TeamProjectedPoints({}))
        self.projected_points: float = self._get_nested_value(self.team_projected_points, "total", 0.0, float)
        self.team_standings: TeamStandings = self._extracted_data.get("team_standings", TeamStandings({}))
        self.wins: int = self._get_nested_value(self.team_standings, ["outcome_totals", "wins"], 0, int)
        self.losses: int = self._get_nested_value(self.team_standings, ["outcome_totals", "losses"], 0, int)
        self.ties: int = self._get_nested_value(self.team_standings, ["outcome_totals", "ties"], 0, int)
        self.percentage: float = self._get_nested_value(
            self.team_standings, ["outcome_totals", "percentage"], 0.0, float
        )
        self.playoff_seed: int = self._get_nested_value(self.team_standings, "playoff_seed", None, int)
        self.points_against: float = self._get_nested_value(self.team_standings, "points_against", 0.0, float)
        self.points_for: float = self._get_nested_value(self.team_standings, "points_for", 0.0, float)
        self.rank: int = self._get_nested_value(self.team_standings, "rank", None)
        self.status: str = self._extracted_data.get("status", "")
        self.streak_type: str = self._get_nested_value(self.team_standings, ["streak", "type"], "")
        self.streak_length: int = self._get_nested_value(self.team_standings, ["streak", "value"], None, int)
        self.total_strikes: int = self._extracted_data.get("total_strikes", 0)
        self.url: str = self._extracted_data.get("url", "")
        self.user_display_name: str = self._extracted_data.get("user_display_name", "")
        self.user_profile_image: str = self._extracted_data.get("user_profile_image", "")
        self.waiver_priority: Optional[int] = self._extracted_data.get("waiver_priority", None)
        self.win_probability: float = self._get_nested_value(self._extracted_data, "win_probability", 0.0, float)

__init__

__init__(extracted_data)

Instantiate the Team child class of YahooFantasyObject.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • can_edit_current_week (int) –

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

  • champion_pick (str) –

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

  • champion_status (str) –

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

  • clinched_playoffs (int) –

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

  • division_id (int) –

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

  • done_week (str) –

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

  • draft_grade (str) –

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

  • draft_position (int) –

    The draft order/position of the team.

  • draft_recap_url (str) –

    The direct URL of the draft recap for the team.

  • draft_results (list[DraftResult]) –

    A list of YFPY DraftResult instances.

  • elimination_week (int) –

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

  • email_address (str) –

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

  • faab_balance (int) –

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

  • has_draft_grade (int) –

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

  • is_in_contest (int) –

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

  • is_owned_by_current_login (int) –

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

  • last_editable_week (str) –

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

  • league_scoring_type (str) –

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

  • logo_type (str) –

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

  • manager (Manager) –

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

  • managers (list[Manager] | dict[str, Manager]) –

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

  • matchups (list[Matchup]) –

    A list of YFPY Matchup instances.

  • name (str) –

    The team name.

  • number_of_moves (int) –

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

  • number_of_trades (int) –

    The number of trades made by the team.

  • roster (Roster) –

    A YFPY Roster instance.

  • players (list[Player]) –

    A list of YFPY Player instances.

  • roster_adds (RosterAdds) –

    A YFPY RosterAdds instance.

  • roster_adds_value (int) –

    The number of roster adds made by the team.

  • team_id (int) –

    The unique team ID in the league.

  • team_key (str) –

    The Yahoo team key.

  • team_logo (str) –

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

  • team_logos (list[TeamLogo]) –

    A list of YFPY TeamLogo instances.

  • team_paid (int) –

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

  • team_points (TeamPoints) –

    A YFPY TeamPoints instance.

  • points (float) –

    The total points scored by the team.

  • team_projected_points (TeamProjectedPoints) –

    A YFPY TeamProjectedPoints instance.

  • projected_points (float) –

    The total projected points for the team.

  • team_standings (TeamStandings) –

    A YFPY TeamStandings instance.

  • wins (int) –

    The number of wins by the team.

  • losses (int) –

    The number of losses by the team.

  • ties (int) –

    The number of ties by the team.

  • percentage (float) –

    The win percentage of the team.

  • playoff_seed (int) –

    The playoff seed of the team.

  • points_against (float) –

    The total team points against.

  • points_for (float) –

    The total team points for.

  • rank (int) –

    The rank of the team in the league standings.

  • status (str) –

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

  • streak_type (str) –

    The active team win/loss/tie streak.

  • streak_length (int) –

    The length of the streak.

  • total_strikes (int) –

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

  • url (str) –

    The direct URL to the team.

  • user_display_name (str) –

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

  • user_profile_image (str) –

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

  • waiver_priority (int) –

    The waiver priority of the team.

  • win_probability (float) –

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

Source code in yfpy/models.py
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
def __init__(self, extracted_data):
    """Instantiate the Team child class of YahooFantasyObject.

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

    Attributes:
        can_edit_current_week (int): (for Survival Football) Numeric boolean (0 or 1) representing whether the user
            competing in the contest can make changes in the current week.
        champion_pick (str): (for Tourney Pick'em) The selected champion for the contest.
        champion_status (str): (for Tourney Pick'em) The final status of the selected champion for the contest.
        clinched_playoffs (int): Numeric boolean (0 or 1) representing if the team has clinched a playoff berth.
        division_id (int): The unique ID number of the division containing the team (if applicable).
        done_week (str): (might be for Tourney Pick'em or Survival Football) ATTRIBUTE MEANING UNKNOWN.
        draft_grade (str): The letter grade assigned to the draft completed by the team ("A+", "A", ..., "F-").
        draft_position (int): The draft order/position of the team.
        draft_recap_url (str): The direct URL of the draft recap for the team.
        draft_results (list[DraftResult]): A list of YFPY DraftResult instances.
        elimination_week (int): (for Survival Football) Numeric boolean (0 or 1) representing if there is an
            elimination week for the user competing in the contest.
        email_address (str): (for Tourney Pick'em) The email address of the user competing in the contest.
        faab_balance (int): The available balance of FAAB (Free Agent Acquisition Budget) (if applicable).
        has_draft_grade (int): Numeric boolean (0 or 1) representing if the team has a draft grade available.
        is_in_contest (int): (for Survival Football) Numeric boolean (0 or 1) representing if the user is in a
            contest.
        is_owned_by_current_login (int): Numeric boolean (0 or 1) representing if the team is owned by the current
            user authenticated with the Yahoo Fantasy Sports REST API.
        last_editable_week (str): (for Survival Football) String boolean ("True" or "False") representing if it is
            the last editable week for the user competing in the contest.
        league_scoring_type (str): Value designating the type of scoring used by the league ("head" for
            head-to-head, etc.).
        logo_type (str): (for Tourney Pick'em) The team logo type ("avatar", etc.) of the user competing in the
            contest.
        manager (Manager): (for Survival Football) A YFPY Manager instance for the user competing in the contest.
        managers (list[Manager] | dict[str, Manager]): A list or dict (depending on source data) of YFPY Manager
            instances.
        matchups (list[Matchup]): A list of YFPY Matchup instances.
        name (str): The team name.
        number_of_moves (int): The number of moves made by the team (adds/drops/trades/etc.).
        number_of_trades (int): The number of trades made by the team.
        roster (Roster): A YFPY Roster instance.
        players (list[Player]): A list of YFPY Player instances.
        roster_adds (RosterAdds): A YFPY RosterAdds instance.
        roster_adds_value (int): The number of roster adds made by the team.
        team_id (int): The unique team ID in the league.
        team_key (str): The Yahoo team key.
        team_logo (str): (for Tourney Pick'em) The direct URL to the team logo of the user competing in the contest.
        team_logos (list[TeamLogo]): A list of YFPY TeamLogo instances.
        team_paid (int): Numeric boolean (0 or 1) representing if the team has paid for Yahoo Fantasy Plus.
        team_points (TeamPoints): A YFPY TeamPoints instance.
        points (float): The total points scored by the team.
        team_projected_points (TeamProjectedPoints): A YFPY TeamProjectedPoints instance.
        projected_points (float): The total projected points for the team.
        team_standings (TeamStandings): A YFPY TeamStandings instance.
        wins (int): The number of wins by the team.
        losses (int): The number of losses by the team.
        ties (int): The number of ties by the team.
        percentage (float): The win percentage of the team.
        playoff_seed (int): The playoff seed of the team.
        points_against (float): The total team points against.
        points_for (float): The total team points for.
        rank (int): The rank of the team in the league standings.
        status (str): (for Survival Football) The status of user competing in the contest ("dead", etc.).
        streak_type (str): The active team win/loss/tie streak.
        streak_length (int): The length of the streak.
        total_strikes (int): (for Survival Football) The total number of strikes (incorrect selections) made by the
            user competing in the contest.
        url (str): The direct URL to the team.
        user_display_name (str): (for Tourney Pick'em) The display name for the user competing in the contest.
        user_profile_image (str): (for Tourney Pick'em) The direct URL to the profile image of the user competing
            in the contest.
        waiver_priority (int): The waiver priority of the team.
        win_probability (float): The active win probability of the team in its current matchup (ranges from 0.0 to
            1.0).

    """
    YahooFantasyObject.__init__(self, extracted_data)
    self.can_edit_current_week: int = self._extracted_data.get("can_edit_current_week", 0)
    self.champion_pick: str = self._extracted_data.get("champion_pick", "")
    self.champion_status: str = self._extracted_data.get("champion_status", "")
    self.clinched_playoffs: int = self._extracted_data.get("clinched_playoffs", 0)
    self.division_id: Optional[int] = self._extracted_data.get("division_id", None)
    self.done_week: Optional[str] = self._extracted_data.get("done_week", None)
    self.draft_grade: str = self._extracted_data.get("draft_grade", "")
    self.draft_position: Optional[int] = self._extracted_data.get("draft_position", None)
    self.draft_recap_url: str = self._extracted_data.get("draft_recap_url", "")
    self.draft_results: List[DraftResult] = self._extracted_data.get("draft_results", [])
    self.elimination_week: Optional[int] = self._extracted_data.get("elimination_week", None)
    self.email_address: str = self._extracted_data.get("email_address", "")
    self.faab_balance: Optional[int] = self._extracted_data.get("faab_balance", None)
    self.has_draft_grade: int = self._extracted_data.get("has_draft_grade", 0)
    self.is_in_contest: int = self._extracted_data.get("is_in_contest", 0)
    self.is_owned_by_current_login: int = self._extracted_data.get("is_owned_by_current_login", 0)
    self.last_editable_week: str = self._extracted_data.get("last_editable_week", "")
    self.league_scoring_type: str = self._extracted_data.get("league_scoring_type", "")
    self.logo_type: str = self._extracted_data.get("logo_type", "")
    self.manager: Manager = self._extracted_data.get("manager", Manager({}))
    self.managers: List[Manager] = self._extracted_data.get("managers", [])
    self.matchups: List[Matchup] = self._extracted_data.get("matchups", [])
    self.name: bytes = self._extracted_data.get("name", "").encode("utf-8")  # support special characters
    self.number_of_moves: int = self._extracted_data.get("number_of_moves", 0)
    self.number_of_trades: int = self._extracted_data.get("number_of_trades", 0)
    self.roster: Roster = self._extracted_data.get("roster", Roster({}))
    self.players: List[Player] = self._get_nested_value(self.roster, "players", [])
    self.roster_adds: RosterAdds = self._extracted_data.get("roster_adds", RosterAdds({}))
    self.roster_adds_value: int = self._get_nested_value(self.roster_adds, "value", 0)
    self.team_id: Optional[int] = self._extracted_data.get("team_id", None)
    self.team_key: str = self._extracted_data.get("team_key", "")
    self.team_logo: str = self._extracted_data.get("team_logo", "")
    self.team_logos: List[TeamLogo] = self._extracted_data.get("team_logos", [])
    self.team_paid: int = self._extracted_data.get("team_paid", 0)
    self.team_points: TeamPoints = self._extracted_data.get("team_points", TeamPoints({}))
    self.points: float = self._get_nested_value(self.team_points, "total", 0.0, float)
    self.team_projected_points: TeamProjectedPoints = self._extracted_data.get("team_projected_points",
                                                                               TeamProjectedPoints({}))
    self.projected_points: float = self._get_nested_value(self.team_projected_points, "total", 0.0, float)
    self.team_standings: TeamStandings = self._extracted_data.get("team_standings", TeamStandings({}))
    self.wins: int = self._get_nested_value(self.team_standings, ["outcome_totals", "wins"], 0, int)
    self.losses: int = self._get_nested_value(self.team_standings, ["outcome_totals", "losses"], 0, int)
    self.ties: int = self._get_nested_value(self.team_standings, ["outcome_totals", "ties"], 0, int)
    self.percentage: float = self._get_nested_value(
        self.team_standings, ["outcome_totals", "percentage"], 0.0, float
    )
    self.playoff_seed: int = self._get_nested_value(self.team_standings, "playoff_seed", None, int)
    self.points_against: float = self._get_nested_value(self.team_standings, "points_against", 0.0, float)
    self.points_for: float = self._get_nested_value(self.team_standings, "points_for", 0.0, float)
    self.rank: int = self._get_nested_value(self.team_standings, "rank", None)
    self.status: str = self._extracted_data.get("status", "")
    self.streak_type: str = self._get_nested_value(self.team_standings, ["streak", "type"], "")
    self.streak_length: int = self._get_nested_value(self.team_standings, ["streak", "value"], None, int)
    self.total_strikes: int = self._extracted_data.get("total_strikes", 0)
    self.url: str = self._extracted_data.get("url", "")
    self.user_display_name: str = self._extracted_data.get("user_display_name", "")
    self.user_profile_image: str = self._extracted_data.get("user_profile_image", "")
    self.waiver_priority: Optional[int] = self._extracted_data.get("waiver_priority", None)
    self.win_probability: float = self._get_nested_value(self._extracted_data, "win_probability", 0.0, float)

DraftResult

Bases: YahooFantasyObject

Model class for "draft_result" data key.

Source code in yfpy/models.py
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
class DraftResult(YahooFantasyObject):
    """Model class for "draft_result" data key.
    """

    def __init__(self, extracted_data):
        """Instantiate the DraftResult child class of YahooFantasyObject.

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

        Attributes:
            cost (int): The player cost (for auction drafts).
            pick (int): The draft pick number.
            round (int): The draft round.
            team_key (str): The Yahoo team key of the team that made the draft pick.
            player_key (str): The Yahoo player key of the player that was drafted.
        """
        YahooFantasyObject.__init__(self, extracted_data)
        self.cost: Optional[int] = self._extracted_data.get("cost", None)
        self.pick: Optional[int] = self._extracted_data.get("pick", None)
        self.round: Optional[int] = self._extracted_data.get("round", None)
        self.team_key: str = self._extracted_data.get("team_key", "")
        self.player_key: str = self._extracted_data.get("player_key", "")

__init__

__init__(extracted_data)

Instantiate the DraftResult child class of YahooFantasyObject.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • cost (int) –

    The player cost (for auction drafts).

  • pick (int) –

    The draft pick number.

  • round (int) –

    The draft round.

  • team_key (str) –

    The Yahoo team key of the team that made the draft pick.

  • player_key (str) –

    The Yahoo player key of the player that was drafted.

Source code in yfpy/models.py
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
def __init__(self, extracted_data):
    """Instantiate the DraftResult child class of YahooFantasyObject.

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

    Attributes:
        cost (int): The player cost (for auction drafts).
        pick (int): The draft pick number.
        round (int): The draft round.
        team_key (str): The Yahoo team key of the team that made the draft pick.
        player_key (str): The Yahoo player key of the player that was drafted.
    """
    YahooFantasyObject.__init__(self, extracted_data)
    self.cost: Optional[int] = self._extracted_data.get("cost", None)
    self.pick: Optional[int] = self._extracted_data.get("pick", None)
    self.round: Optional[int] = self._extracted_data.get("round", None)
    self.team_key: str = self._extracted_data.get("team_key", "")
    self.player_key: str = self._extracted_data.get("player_key", "")

Standings

Bases: YahooFantasyObject

Model class for "standings" data key.

Source code in yfpy/models.py
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
class Standings(YahooFantasyObject):
    """Model class for "standings" data key.
    """

    def __init__(self, extracted_data):
        """Instantiate the Standings child class of YahooFantasyObject.

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

        Attributes:
            teams (list[Team]): A list of YFPY Team instances with standings data.
        """
        YahooFantasyObject.__init__(self, extracted_data)
        self.teams: List[Team] = self._extracted_data.get("teams", [])

__init__

__init__(extracted_data)

Instantiate the Standings child class of YahooFantasyObject.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • teams (list[Team]) –

    A list of YFPY Team instances with standings data.

Source code in yfpy/models.py
646
647
648
649
650
651
652
653
654
655
656
def __init__(self, extracted_data):
    """Instantiate the Standings child class of YahooFantasyObject.

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

    Attributes:
        teams (list[Team]): A list of YFPY Team instances with standings data.
    """
    YahooFantasyObject.__init__(self, extracted_data)
    self.teams: List[Team] = self._extracted_data.get("teams", [])

Transaction

Bases: YahooFantasyObject

Model class for "transaction" data key.

Source code in yfpy/models.py
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
class Transaction(YahooFantasyObject):
    """Model class for "transaction" data key.
    """

    def __init__(self, extracted_data):
        """Instantiate the Transaction child class of YahooFantasyObject.

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

        Attributes:
            players (list[Player]): A list of YFPY Player instances.
            status (str): The transaction status ("successful", etc.).
            timestamp (int): The timestamp of when the transaction occurred.
            tradee_team_key (str): The Yahoo team key for the team receiving the player (if applicable).
            tradee_team_name (str): The team name of the team receiving the player (if applicable).
            trader_team_key (str): The Yahoo team key for the team sending the player (if applicable).
            trader_team_name (str): The team name for the team sending the player (if applicable).
            transaction_id (int): The unique transaction ID number.
            transaction_key (str): The Yahoo transaction key (Ex.: "406.l.413954.tr.555").
            type (str): The type of the transaction ("add", "drop", "trade", etc.).
        """
        YahooFantasyObject.__init__(self, extracted_data)
        self.faab_bid: Optional[int] = self._extracted_data.get("faab_bid", None)
        self.picks: List[Pick] = self._extracted_data.get("picks", [])
        self.players: List[Player] = self._extracted_data.get("players", [])
        self.status: str = self._extracted_data.get("status", "")
        self.timestamp: Optional[int] = self._extracted_data.get("timestamp", None)
        self.tradee_team_key: str = self._extracted_data.get("tradee_team_key", "")
        self.tradee_team_name: str = self._extracted_data.get("tradee_team_name", "")
        self.trader_team_key: str = self._extracted_data.get("trader_team_key", "")
        self.trader_team_name: str = self._extracted_data.get("trader_team_name", "")
        self.transaction_id: Optional[int] = self._extracted_data.get("transaction_id", None)
        self.transaction_key: str = self._extracted_data.get("transaction_key", "")
        self.type: str = self._extracted_data.get("type", "")

__init__

__init__(extracted_data)

Instantiate the Transaction child class of YahooFantasyObject.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • players (list[Player]) –

    A list of YFPY Player instances.

  • status (str) –

    The transaction status ("successful", etc.).

  • timestamp (int) –

    The timestamp of when the transaction occurred.

  • tradee_team_key (str) –

    The Yahoo team key for the team receiving the player (if applicable).

  • tradee_team_name (str) –

    The team name of the team receiving the player (if applicable).

  • trader_team_key (str) –

    The Yahoo team key for the team sending the player (if applicable).

  • trader_team_name (str) –

    The team name for the team sending the player (if applicable).

  • transaction_id (int) –

    The unique transaction ID number.

  • transaction_key (str) –

    The Yahoo transaction key (Ex.: "406.l.413954.tr.555").

  • type (str) –

    The type of the transaction ("add", "drop", "trade", etc.).

Source code in yfpy/models.py
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
def __init__(self, extracted_data):
    """Instantiate the Transaction child class of YahooFantasyObject.

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

    Attributes:
        players (list[Player]): A list of YFPY Player instances.
        status (str): The transaction status ("successful", etc.).
        timestamp (int): The timestamp of when the transaction occurred.
        tradee_team_key (str): The Yahoo team key for the team receiving the player (if applicable).
        tradee_team_name (str): The team name of the team receiving the player (if applicable).
        trader_team_key (str): The Yahoo team key for the team sending the player (if applicable).
        trader_team_name (str): The team name for the team sending the player (if applicable).
        transaction_id (int): The unique transaction ID number.
        transaction_key (str): The Yahoo transaction key (Ex.: "406.l.413954.tr.555").
        type (str): The type of the transaction ("add", "drop", "trade", etc.).
    """
    YahooFantasyObject.__init__(self, extracted_data)
    self.faab_bid: Optional[int] = self._extracted_data.get("faab_bid", None)
    self.picks: List[Pick] = self._extracted_data.get("picks", [])
    self.players: List[Player] = self._extracted_data.get("players", [])
    self.status: str = self._extracted_data.get("status", "")
    self.timestamp: Optional[int] = self._extracted_data.get("timestamp", None)
    self.tradee_team_key: str = self._extracted_data.get("tradee_team_key", "")
    self.tradee_team_name: str = self._extracted_data.get("tradee_team_name", "")
    self.trader_team_key: str = self._extracted_data.get("trader_team_key", "")
    self.trader_team_name: str = self._extracted_data.get("trader_team_name", "")
    self.transaction_id: Optional[int] = self._extracted_data.get("transaction_id", None)
    self.transaction_key: str = self._extracted_data.get("transaction_key", "")
    self.type: str = self._extracted_data.get("type", "")

Pick

Bases: YahooFantasyObject

Model class for "pick" data key.

Source code in yfpy/models.py
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
class Pick(YahooFantasyObject):
    """Model class for "pick" data key.
    """

    def __init__(self, extracted_data):
        """Instantiate the Pick child class of YahooFantasyObject.

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

        Attributes:
            destination_team_key (str): Team key in the format <game_key>.l.<league_id>.t.<team_id> of the team
                receiving the pick in the transaction.
            destination_team_name (str): Team name of the team receiving the pick in the transaction.
            original_team_key (str): Team key in the format <game_key>.l.<league_id>.t.<team_id> of the team to which
                the pick in the transaction originally belonged.
            original_team_name (str): Team name of the team to which the pick in the transaction originally belonged.
            round (int): The draft round of the pick in the transaction.
            source_team_key (str): Team key in the format <game_key>.l.<league_id>.t.<team_id> of the team sending the
                pick in the transaction.
            source_team_name (str): Team name of the team sending the pick in the transaction.
        """
        YahooFantasyObject.__init__(self, extracted_data)
        self.destination_team_key: str = self._extracted_data.get("destination_team_key", "")
        self.destination_team_name: str = self._extracted_data.get("destination_team_name", "")
        self.original_team_key: str = self._extracted_data.get("original_team_key", "")
        self.original_team_name: str = self._extracted_data.get("original_team_name", "")
        self.round: Optional[int] = self._extracted_data.get("round", None)
        self.source_team_key: str = self._extracted_data.get("source_team_key", "")
        self.source_team_name: str = self._extracted_data.get("source_team_name", "")

__init__

__init__(extracted_data)

Instantiate the Pick child class of YahooFantasyObject.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • destination_team_key (str) –

    Team key in the format .l..t. of the team receiving the pick in the transaction.

  • destination_team_name (str) –

    Team name of the team receiving the pick in the transaction.

  • original_team_key (str) –

    Team key in the format .l..t. of the team to which the pick in the transaction originally belonged.

  • original_team_name (str) –

    Team name of the team to which the pick in the transaction originally belonged.

  • round (int) –

    The draft round of the pick in the transaction.

  • source_team_key (str) –

    Team key in the format .l..t. of the team sending the pick in the transaction.

  • source_team_name (str) –

    Team name of the team sending the pick in the transaction.

Source code in yfpy/models.py
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
def __init__(self, extracted_data):
    """Instantiate the Pick child class of YahooFantasyObject.

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

    Attributes:
        destination_team_key (str): Team key in the format <game_key>.l.<league_id>.t.<team_id> of the team
            receiving the pick in the transaction.
        destination_team_name (str): Team name of the team receiving the pick in the transaction.
        original_team_key (str): Team key in the format <game_key>.l.<league_id>.t.<team_id> of the team to which
            the pick in the transaction originally belonged.
        original_team_name (str): Team name of the team to which the pick in the transaction originally belonged.
        round (int): The draft round of the pick in the transaction.
        source_team_key (str): Team key in the format <game_key>.l.<league_id>.t.<team_id> of the team sending the
            pick in the transaction.
        source_team_name (str): Team name of the team sending the pick in the transaction.
    """
    YahooFantasyObject.__init__(self, extracted_data)
    self.destination_team_key: str = self._extracted_data.get("destination_team_key", "")
    self.destination_team_name: str = self._extracted_data.get("destination_team_name", "")
    self.original_team_key: str = self._extracted_data.get("original_team_key", "")
    self.original_team_name: str = self._extracted_data.get("original_team_name", "")
    self.round: Optional[int] = self._extracted_data.get("round", None)
    self.source_team_key: str = self._extracted_data.get("source_team_key", "")
    self.source_team_name: str = self._extracted_data.get("source_team_name", "")

Manager

Bases: YahooFantasyObject

Model class for "manager" data key.

Source code in yfpy/models.py
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
class Manager(YahooFantasyObject):
    """Model class for "manager" data key.
    """

    def __init__(self, extracted_data):
        """Instantiate the Manager child class of YahooFantasyObject.

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

        Attributes:
            email (str): The email address of the manager.
            emails (list[str]): (for Survival Football) List of email addresses for the manager competing in the
                contest.
            fantasy_profile_url (str): (for Survival Football) The direct URL for the profile of the manager competing
                in the contest.
            felo_score (int): The manager fantasy ELO rating.
            felo_tier (str): The manager fantasy ELO level (Bronze, Silver, Gold, Platinum, Diamond).
            guid (str): The unique Yahoo GUID of the user account associated with manager.
            image_url (str): The direct URL of the manager profile image.
            is_comanager (int): Numeric boolean (0 or 1) representing if the manager is a co-manager.
            is_commissioner (int): Numeric boolean (0 or 1) representing if the manager is commissioner of the league
                from which the manager data is being retrieved.
            is_current_login (int): Numeric boolean (0 or 1) representing if the manager is the current user
                authenticated with the Yahoo Fantasy Sports REST API.
            manager_id (int): The unique manager ID in the league.
            nickname (str): The display nickname of the manager.
            profile_image_url (str): (for Survival Football) The direct URL of the profile image of the manager
                competing in the contest.
        """
        YahooFantasyObject.__init__(self, extracted_data)
        self.email: str = self._extracted_data.get("email", "")
        self.emails: List[str] = self._extracted_data.get("emails", [])
        self.fantasy_profile_url: str = self._extracted_data.get("fantasy_profile_url", "")
        self.felo_score: Optional[int] = self._extracted_data.get("felo_score", None)
        self.felo_tier: str = self._extracted_data.get("felo_tier", "")
        self.guid: str = self._extracted_data.get("guid", "")
        self.image_url: str = self._extracted_data.get("image_url", "")
        self.is_comanager: int = self._extracted_data.get("is_comanager", 0)
        self.is_commissioner: int = self._extracted_data.get("is_comanager", 0)
        self.is_current_login: int = self._extracted_data.get("is_current_login", 0)
        self.manager_id: Optional[int] = self._extracted_data.get("manager_id", None)
        self.nickname: str = self._extracted_data.get("nickname", "")
        self.profile_image_url: str = self._extracted_data.get("profile_image_url", "")

__init__

__init__(extracted_data)

Instantiate the Manager child class of YahooFantasyObject.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • email (str) –

    The email address of the manager.

  • emails (list[str]) –

    (for Survival Football) List of email addresses for the manager competing in the contest.

  • fantasy_profile_url (str) –

    (for Survival Football) The direct URL for the profile of the manager competing in the contest.

  • felo_score (int) –

    The manager fantasy ELO rating.

  • felo_tier (str) –

    The manager fantasy ELO level (Bronze, Silver, Gold, Platinum, Diamond).

  • guid (str) –

    The unique Yahoo GUID of the user account associated with manager.

  • image_url (str) –

    The direct URL of the manager profile image.

  • is_comanager (int) –

    Numeric boolean (0 or 1) representing if the manager is a co-manager.

  • is_commissioner (int) –

    Numeric boolean (0 or 1) representing if the manager is commissioner of the league from which the manager data is being retrieved.

  • is_current_login (int) –

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

  • manager_id (int) –

    The unique manager ID in the league.

  • nickname (str) –

    The display nickname of the manager.

  • profile_image_url (str) –

    (for Survival Football) The direct URL of the profile image of the manager competing in the contest.

Source code in yfpy/models.py
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
def __init__(self, extracted_data):
    """Instantiate the Manager child class of YahooFantasyObject.

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

    Attributes:
        email (str): The email address of the manager.
        emails (list[str]): (for Survival Football) List of email addresses for the manager competing in the
            contest.
        fantasy_profile_url (str): (for Survival Football) The direct URL for the profile of the manager competing
            in the contest.
        felo_score (int): The manager fantasy ELO rating.
        felo_tier (str): The manager fantasy ELO level (Bronze, Silver, Gold, Platinum, Diamond).
        guid (str): The unique Yahoo GUID of the user account associated with manager.
        image_url (str): The direct URL of the manager profile image.
        is_comanager (int): Numeric boolean (0 or 1) representing if the manager is a co-manager.
        is_commissioner (int): Numeric boolean (0 or 1) representing if the manager is commissioner of the league
            from which the manager data is being retrieved.
        is_current_login (int): Numeric boolean (0 or 1) representing if the manager is the current user
            authenticated with the Yahoo Fantasy Sports REST API.
        manager_id (int): The unique manager ID in the league.
        nickname (str): The display nickname of the manager.
        profile_image_url (str): (for Survival Football) The direct URL of the profile image of the manager
            competing in the contest.
    """
    YahooFantasyObject.__init__(self, extracted_data)
    self.email: str = self._extracted_data.get("email", "")
    self.emails: List[str] = self._extracted_data.get("emails", [])
    self.fantasy_profile_url: str = self._extracted_data.get("fantasy_profile_url", "")
    self.felo_score: Optional[int] = self._extracted_data.get("felo_score", None)
    self.felo_tier: str = self._extracted_data.get("felo_tier", "")
    self.guid: str = self._extracted_data.get("guid", "")
    self.image_url: str = self._extracted_data.get("image_url", "")
    self.is_comanager: int = self._extracted_data.get("is_comanager", 0)
    self.is_commissioner: int = self._extracted_data.get("is_comanager", 0)
    self.is_current_login: int = self._extracted_data.get("is_current_login", 0)
    self.manager_id: Optional[int] = self._extracted_data.get("manager_id", None)
    self.nickname: str = self._extracted_data.get("nickname", "")
    self.profile_image_url: str = self._extracted_data.get("profile_image_url", "")

Roster

Bases: YahooFantasyObject

Model class for "roster" data key.

Source code in yfpy/models.py
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
class Roster(YahooFantasyObject):
    """Model class for "roster" data key.
    """

    def __init__(self, extracted_data):
        """Instantiate the Roster child class of YahooFantasyObject.

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

        Attributes:
            coverage_type (str): The timeframe for the selected roster ("week", "date", "season", etc.).
            week (int): The week number.
            is_editable (int): Numeric boolean (0 or 1) representing if the roster is editable.
            is_prescoring (int): Numeric boolean (0 or 1) representing if the roster is in a prescoring state.
            players (list[Player]): A list of YFPY Player instances.
        """
        YahooFantasyObject.__init__(self, extracted_data)
        self.coverage_type: str = self._extracted_data.get("coverage_type", "")
        self.week: Optional[int] = self._extracted_data.get("week", None)
        self.is_editable: int = self._extracted_data.get("is_editable", 0)
        self.is_prescoring: int = self._extracted_data.get("is_prescoring", 0)  # TODO: what does prescoring mean?
        self.players: List[Player] = self._extracted_data.get("players", [])

__init__

__init__(extracted_data)

Instantiate the Roster child class of YahooFantasyObject.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • coverage_type (str) –

    The timeframe for the selected roster ("week", "date", "season", etc.).

  • week (int) –

    The week number.

  • is_editable (int) –

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

  • is_prescoring (int) –

    Numeric boolean (0 or 1) representing if the roster is in a prescoring state.

  • players (list[Player]) –

    A list of YFPY Player instances.

Source code in yfpy/models.py
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
def __init__(self, extracted_data):
    """Instantiate the Roster child class of YahooFantasyObject.

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

    Attributes:
        coverage_type (str): The timeframe for the selected roster ("week", "date", "season", etc.).
        week (int): The week number.
        is_editable (int): Numeric boolean (0 or 1) representing if the roster is editable.
        is_prescoring (int): Numeric boolean (0 or 1) representing if the roster is in a prescoring state.
        players (list[Player]): A list of YFPY Player instances.
    """
    YahooFantasyObject.__init__(self, extracted_data)
    self.coverage_type: str = self._extracted_data.get("coverage_type", "")
    self.week: Optional[int] = self._extracted_data.get("week", None)
    self.is_editable: int = self._extracted_data.get("is_editable", 0)
    self.is_prescoring: int = self._extracted_data.get("is_prescoring", 0)  # TODO: what does prescoring mean?
    self.players: List[Player] = self._extracted_data.get("players", [])

RosterAdds

Bases: YahooFantasyObject

Model class for "roster_adds" data key.

Source code in yfpy/models.py
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
class RosterAdds(YahooFantasyObject):
    """Model class for "roster_adds" data key.
    """

    def __init__(self, extracted_data):
        """Instantiate the RosterAdds child class of YahooFantasyObject.

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

        Attributes:
            coverage_type (str): The timeframe for the selected roster ("week", "date", "season", etc.).
            coverage_value (int): The value of the coverage type (week number, for instance).
            value (int): The number of roster adds within the coverage timeframe.
        """
        YahooFantasyObject.__init__(self, extracted_data)
        self.coverage_type: str = self._extracted_data.get("coverage_type", "")
        self.coverage_value: int = self._get_nested_value(self._extracted_data, "coverage_value", 0, int)
        self.value: int = self._get_nested_value(self._extracted_data, "value", 0, int)

__init__

__init__(extracted_data)

Instantiate the RosterAdds child class of YahooFantasyObject.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • coverage_type (str) –

    The timeframe for the selected roster ("week", "date", "season", etc.).

  • coverage_value (int) –

    The value of the coverage type (week number, for instance).

  • value (int) –

    The number of roster adds within the coverage timeframe.

Source code in yfpy/models.py
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
def __init__(self, extracted_data):
    """Instantiate the RosterAdds child class of YahooFantasyObject.

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

    Attributes:
        coverage_type (str): The timeframe for the selected roster ("week", "date", "season", etc.).
        coverage_value (int): The value of the coverage type (week number, for instance).
        value (int): The number of roster adds within the coverage timeframe.
    """
    YahooFantasyObject.__init__(self, extracted_data)
    self.coverage_type: str = self._extracted_data.get("coverage_type", "")
    self.coverage_value: int = self._get_nested_value(self._extracted_data, "coverage_value", 0, int)
    self.value: int = self._get_nested_value(self._extracted_data, "value", 0, int)

Bases: YahooFantasyObject

Model class for "team_logo" data key.

Source code in yfpy/models.py
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
class TeamLogo(YahooFantasyObject):
    """Model class for "team_logo" data key.
    """

    def __init__(self, extracted_data):
        """Instantiate the TeamLogo child class of YahooFantasyObject.

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

        Attributes:
            size (str): The size of the team logo photo ("small", "large", etc.)
            url (str): The direct URL of the team logo photo.
        """
        YahooFantasyObject.__init__(self, extracted_data)
        self.size: str = self._extracted_data.get("size", "")
        self.url: str = self._extracted_data.get("url", "")

__init__

__init__(extracted_data)

Instantiate the TeamLogo child class of YahooFantasyObject.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • size (str) –

    The size of the team logo photo ("small", "large", etc.)

  • url (str) –

    The direct URL of the team logo photo.

Source code in yfpy/models.py
830
831
832
833
834
835
836
837
838
839
840
841
842
def __init__(self, extracted_data):
    """Instantiate the TeamLogo child class of YahooFantasyObject.

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

    Attributes:
        size (str): The size of the team logo photo ("small", "large", etc.)
        url (str): The direct URL of the team logo photo.
    """
    YahooFantasyObject.__init__(self, extracted_data)
    self.size: str = self._extracted_data.get("size", "")
    self.url: str = self._extracted_data.get("url", "")

TeamPoints

Bases: YahooFantasyObject

Model class for "team_points" data key.

Source code in yfpy/models.py
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
class TeamPoints(YahooFantasyObject):
    """Model class for "team_points" data key.
    """

    def __init__(self, extracted_data):
        """Instantiate the TeamPoints child class of YahooFantasyObject.

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

        Attributes:
            coverage_type (str): The timeframe for the selected team points ("week", "date", "season", etc.).
            season (int): The season year.
            total (float): The total team points for the coverage timeframe.
            week (int): The week number (if applicable).
        """
        YahooFantasyObject.__init__(self, extracted_data)
        self.coverage_type: str = self._extracted_data.get("coverage_type", "")
        self.season: Optional[int] = self._extracted_data.get("season", None)
        self.total: float = self._get_nested_value(self._extracted_data, "total", 0.0, float)
        self.week: Optional[int] = self._extracted_data.get("week", None)

__init__

__init__(extracted_data)

Instantiate the TeamPoints child class of YahooFantasyObject.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • coverage_type (str) –

    The timeframe for the selected team points ("week", "date", "season", etc.).

  • season (int) –

    The season year.

  • total (float) –

    The total team points for the coverage timeframe.

  • week (int) –

    The week number (if applicable).

Source code in yfpy/models.py
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
def __init__(self, extracted_data):
    """Instantiate the TeamPoints child class of YahooFantasyObject.

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

    Attributes:
        coverage_type (str): The timeframe for the selected team points ("week", "date", "season", etc.).
        season (int): The season year.
        total (float): The total team points for the coverage timeframe.
        week (int): The week number (if applicable).
    """
    YahooFantasyObject.__init__(self, extracted_data)
    self.coverage_type: str = self._extracted_data.get("coverage_type", "")
    self.season: Optional[int] = self._extracted_data.get("season", None)
    self.total: float = self._get_nested_value(self._extracted_data, "total", 0.0, float)
    self.week: Optional[int] = self._extracted_data.get("week", None)

TeamProjectedPoints

Bases: YahooFantasyObject

Model class for "team_projected_points" data key.

Source code in yfpy/models.py
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
class TeamProjectedPoints(YahooFantasyObject):
    """Model class for "team_projected_points" data key.
    """

    def __init__(self, extracted_data):
        """Instantiate the TeamProjectedPoints child class of YahooFantasyObject.

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

        Attributes:
            coverage_type (str): The timeframe for the selected team projected points ("week", "date", "season", etc.).
            total (float): The total team projected points for the coverage timeframe.
            week (int): The week number.
        """
        YahooFantasyObject.__init__(self, extracted_data)
        self.coverage_type: str = self._extracted_data.get("coverage_type", "")
        self.total: float = self._get_nested_value(self._extracted_data, "total", 0.0, float)
        self.week: Optional[int] = self._extracted_data.get("week", None)

__init__

__init__(extracted_data)

Instantiate the TeamProjectedPoints child class of YahooFantasyObject.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • coverage_type (str) –

    The timeframe for the selected team projected points ("week", "date", "season", etc.).

  • total (float) –

    The total team projected points for the coverage timeframe.

  • week (int) –

    The week number.

Source code in yfpy/models.py
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
def __init__(self, extracted_data):
    """Instantiate the TeamProjectedPoints child class of YahooFantasyObject.

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

    Attributes:
        coverage_type (str): The timeframe for the selected team projected points ("week", "date", "season", etc.).
        total (float): The total team projected points for the coverage timeframe.
        week (int): The week number.
    """
    YahooFantasyObject.__init__(self, extracted_data)
    self.coverage_type: str = self._extracted_data.get("coverage_type", "")
    self.total: float = self._get_nested_value(self._extracted_data, "total", 0.0, float)
    self.week: Optional[int] = self._extracted_data.get("week", None)

TeamStandings

Bases: YahooFantasyObject

Model class for "team_standings" data key.

Source code in yfpy/models.py
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
class TeamStandings(YahooFantasyObject):
    """Model class for "team_standings" data key.
    """

    def __init__(self, extracted_data):
        """Instantiate the TeamStandings child class of YahooFantasyObject.

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

        Attributes:
            divisional_outcome_totals (DivisionalOutcomeTotals): A list of YFPY DivisionalOutcomeTotals instances.
            outcome_totals (OutcomeTotals): A YFPY OutcomeTotals instance.
            playoff_seed (int): The playoff seed position for the team.
            points_against (float): The total team points against.
            points_for (float): The total team points for.
            rank (int): The rank of the team in the league standings.
            streak (Streak): A YFPY Streak instance.
        """
        YahooFantasyObject.__init__(self, extracted_data)
        self.divisional_outcome_totals: DivisionalOutcomeTotals = self._extracted_data.get(
            "divisional_outcome_totals", DivisionalOutcomeTotals({}))
        self.outcome_totals: OutcomeTotals = self._extracted_data.get("outcome_totals", OutcomeTotals({}))
        self.playoff_seed: int = self._extracted_data.get("playoff_seed", 0)
        self.points_against: float = self._get_nested_value(self._extracted_data, "points_against", 0.0, float)
        self.points_for: float = self._get_nested_value(self._extracted_data, "points_for", 0.0, float)
        self.rank: Optional[int] = self._extracted_data.get("rank", None)
        self.streak: Streak = self._extracted_data.get("streak", Streak({}))

__init__

__init__(extracted_data)

Instantiate the TeamStandings child class of YahooFantasyObject.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • divisional_outcome_totals (DivisionalOutcomeTotals) –

    A list of YFPY DivisionalOutcomeTotals instances.

  • outcome_totals (OutcomeTotals) –

    A YFPY OutcomeTotals instance.

  • playoff_seed (int) –

    The playoff seed position for the team.

  • points_against (float) –

    The total team points against.

  • points_for (float) –

    The total team points for.

  • rank (int) –

    The rank of the team in the league standings.

  • streak (Streak) –

    A YFPY Streak instance.

Source code in yfpy/models.py
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
def __init__(self, extracted_data):
    """Instantiate the TeamStandings child class of YahooFantasyObject.

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

    Attributes:
        divisional_outcome_totals (DivisionalOutcomeTotals): A list of YFPY DivisionalOutcomeTotals instances.
        outcome_totals (OutcomeTotals): A YFPY OutcomeTotals instance.
        playoff_seed (int): The playoff seed position for the team.
        points_against (float): The total team points against.
        points_for (float): The total team points for.
        rank (int): The rank of the team in the league standings.
        streak (Streak): A YFPY Streak instance.
    """
    YahooFantasyObject.__init__(self, extracted_data)
    self.divisional_outcome_totals: DivisionalOutcomeTotals = self._extracted_data.get(
        "divisional_outcome_totals", DivisionalOutcomeTotals({}))
    self.outcome_totals: OutcomeTotals = self._extracted_data.get("outcome_totals", OutcomeTotals({}))
    self.playoff_seed: int = self._extracted_data.get("playoff_seed", 0)
    self.points_against: float = self._get_nested_value(self._extracted_data, "points_against", 0.0, float)
    self.points_for: float = self._get_nested_value(self._extracted_data, "points_for", 0.0, float)
    self.rank: Optional[int] = self._extracted_data.get("rank", None)
    self.streak: Streak = self._extracted_data.get("streak", Streak({}))

DivisionalOutcomeTotals

Bases: YahooFantasyObject

Model class for "divisional_outcome_totals" data key.

Source code in yfpy/models.py
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
class DivisionalOutcomeTotals(YahooFantasyObject):
    """Model class for "divisional_outcome_totals" data key.
    """

    def __init__(self, extracted_data):
        """Instantiate the DivisionOutcomeTotals child class of YahooFantasyObject.

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

        Attributes:
            losses (int): The number of losses by the team within the division.
            ties (int): The number of ties by the team within the division.
            wins (int): The number of wins by the team within the division.
        """
        YahooFantasyObject.__init__(self, extracted_data)
        self.losses: int = self._get_nested_value(self._extracted_data, "losses", 0, int)
        self.ties: int = self._get_nested_value(self._extracted_data, "ties", 0, int)
        self.wins: int = self._get_nested_value(self._extracted_data, "wins", 0, int)

__init__

__init__(extracted_data)

Instantiate the DivisionOutcomeTotals child class of YahooFantasyObject.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • losses (int) –

    The number of losses by the team within the division.

  • ties (int) –

    The number of ties by the team within the division.

  • wins (int) –

    The number of wins by the team within the division.

Source code in yfpy/models.py
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
def __init__(self, extracted_data):
    """Instantiate the DivisionOutcomeTotals child class of YahooFantasyObject.

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

    Attributes:
        losses (int): The number of losses by the team within the division.
        ties (int): The number of ties by the team within the division.
        wins (int): The number of wins by the team within the division.
    """
    YahooFantasyObject.__init__(self, extracted_data)
    self.losses: int = self._get_nested_value(self._extracted_data, "losses", 0, int)
    self.ties: int = self._get_nested_value(self._extracted_data, "ties", 0, int)
    self.wins: int = self._get_nested_value(self._extracted_data, "wins", 0, int)

OutcomeTotals

Bases: YahooFantasyObject

Model class for "outcome_totals" data key.

Source code in yfpy/models.py
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
class OutcomeTotals(YahooFantasyObject):
    """Model class for "outcome_totals" data key.
    """

    def __init__(self, extracted_data):
        """Instantiate the OutcomeTotals child class of YahooFantasyObject.

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

        Attributes:
            losses (int): The number of losses by the team.
            percentage (float): The win percentage of the team.
            ties (int): The number of ties by the team.
            wins (int): The number of wins by the team.
        """
        YahooFantasyObject.__init__(self, extracted_data)
        self.losses: int = self._get_nested_value(self._extracted_data, "losses", 0, int)
        self.percentage: float = self._get_nested_value(self._extracted_data, "percentage", 0.0, float)
        self.ties: int = self._get_nested_value(self._extracted_data, "ties", 0, int)
        self.wins: int = self._get_nested_value(self._extracted_data, "wins", 0, int)

__init__

__init__(extracted_data)

Instantiate the OutcomeTotals child class of YahooFantasyObject.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • losses (int) –

    The number of losses by the team.

  • percentage (float) –

    The win percentage of the team.

  • ties (int) –

    The number of ties by the team.

  • wins (int) –

    The number of wins by the team.

Source code in yfpy/models.py
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
def __init__(self, extracted_data):
    """Instantiate the OutcomeTotals child class of YahooFantasyObject.

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

    Attributes:
        losses (int): The number of losses by the team.
        percentage (float): The win percentage of the team.
        ties (int): The number of ties by the team.
        wins (int): The number of wins by the team.
    """
    YahooFantasyObject.__init__(self, extracted_data)
    self.losses: int = self._get_nested_value(self._extracted_data, "losses", 0, int)
    self.percentage: float = self._get_nested_value(self._extracted_data, "percentage", 0.0, float)
    self.ties: int = self._get_nested_value(self._extracted_data, "ties", 0, int)
    self.wins: int = self._get_nested_value(self._extracted_data, "wins", 0, int)

Streak

Bases: YahooFantasyObject

Model class for "streak" data key.

Source code in yfpy/models.py
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
class Streak(YahooFantasyObject):
    """Model class for "streak" data key.
    """

    def __init__(self, extracted_data):
        """Instantiate the Streak child class of YahooFantasyObject.

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

        Attributes:
            type (str): The streak type ("W" for win, "L" for loss, "T" for tie).
            value (int): The length of the streak.
        """
        YahooFantasyObject.__init__(self, extracted_data)
        self.type: str = self._extracted_data.get("type", "")
        self.value: int = self._get_nested_value(self._extracted_data, "value", 0, int)

__init__

__init__(extracted_data)

Instantiate the Streak child class of YahooFantasyObject.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • type (str) –

    The streak type ("W" for win, "L" for loss, "T" for tie).

  • value (int) –

    The length of the streak.

Source code in yfpy/models.py
973
974
975
976
977
978
979
980
981
982
983
984
985
def __init__(self, extracted_data):
    """Instantiate the Streak child class of YahooFantasyObject.

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

    Attributes:
        type (str): The streak type ("W" for win, "L" for loss, "T" for tie).
        value (int): The length of the streak.
    """
    YahooFantasyObject.__init__(self, extracted_data)
    self.type: str = self._extracted_data.get("type", "")
    self.value: int = self._get_nested_value(self._extracted_data, "value", 0, int)

Scoreboard

Bases: YahooFantasyObject

Model class for "scoreboard" data key.

Source code in yfpy/models.py
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
class Scoreboard(YahooFantasyObject):
    """Model class for "scoreboard" data key.
    """

    def __init__(self, extracted_data):
        """Instantiate the Scoreboard child class of YahooFantasyObject.

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

        Attributes:
            matchups (list[Matchup]): A list of YFPY Matchup instances representing the matchups for the week.
            week (int): The week for which the scoreboard applies.
        """
        YahooFantasyObject.__init__(self, extracted_data)
        self.matchups: List[Matchup] = self._extracted_data.get("matchups", [])
        self.week: Optional[int] = self._extracted_data.get("week", None)

__init__

__init__(extracted_data)

Instantiate the Scoreboard child class of YahooFantasyObject.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • matchups (list[Matchup]) –

    A list of YFPY Matchup instances representing the matchups for the week.

  • week (int) –

    The week for which the scoreboard applies.

Source code in yfpy/models.py
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
def __init__(self, extracted_data):
    """Instantiate the Scoreboard child class of YahooFantasyObject.

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

    Attributes:
        matchups (list[Matchup]): A list of YFPY Matchup instances representing the matchups for the week.
        week (int): The week for which the scoreboard applies.
    """
    YahooFantasyObject.__init__(self, extracted_data)
    self.matchups: List[Matchup] = self._extracted_data.get("matchups", [])
    self.week: Optional[int] = self._extracted_data.get("week", None)

Settings

Bases: YahooFantasyObject

Model class for "settings" data key.

Source code in yfpy/models.py
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
class Settings(YahooFantasyObject):
    """Model class for "settings" data key.
    """

    def __init__(self, extracted_data):
        """Instantiate the Settings child class of YahooFantasyObject.

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

        Attributes:
            cant_cut_list (int): Numeric boolean (0 or 1) representing if the league uses the Yahoo "can't cut list".
            divisions (list[Division]): A list of YFPY Division instances for leagues with divisions.
            draft_pick_time (int): The number of seconds allowed to make each draft pick.
            draft_time (int): A timestamp representing when the draft will start.
            draft_together (int): Numeric boolean (0 or 1) representing if the league uses Yahoo Fantasy Draft Together
                live video chat during online drafts.
            draft_type (str): The type of draft ("live", "offline", etc.)
            has_multiweek_championship (int): Numeric boolean (0 or 1) representing if the league has a multi-week
                championship matchup.
            has_playoff_consolation_games (bool): Numeric boolean (0 or 1) representing if the league has a consolation
                playoff bracket.
            is_auction_draft (int): Numeric boolean (0 or 1) representing if the league uses an auction draft.
            league_premium_features (List): List of features enables as part of subscription to Yahoo Fantasy Plus or
                Yahoo Fantasy Commissioner Plus.
            max_teams (int): The maximum number of teams allowed in the league.
            num_playoff_consolation_teams (int): The number of teams that make the consolation playoff bracket.
            num_playoff_teams (int): The number of teams that make the playoffs.
            persistent_url (str): Custom URL configured for the league that remains the same every season.
            pickem_enabled (int): Numeric boolean (0 or 1) representing if the league has enabled the built-in Yahoo
                "pick 'em" game that allows managers to pick winners of each fantasy matchup each week in the league.
            player_pool (str): Value designating what player pool is allowed for the league ("ALL", etc.).
            playoff_start_week (int): The week number on which the playoffs start.
            post_draft_players (str): Value designating what happens to players after the draft ("W" for waivers, etc.).
            roster_positions (list[RosterPosition]): A list of YFPY RosterPosition instances.
            scoring_type (str): Value designating what type of scoring the league uses ("head" for head-to-head, etc.).
            sendbird_channel_url (str): The in-app Sendbird channel ID.
            stat_categories (StatCategories): A YFPY StatCategories instance.
            stat_modifiers (StatModifiers): A YFPY StatModifiers instance.
            trade_end_date (str): A date string representing when trading is no longer allowed (format: "YYYY-MM-DD").
            trade_ratify_type (str): Value designating how trades are ratified ("commish" for commissioner, etc.).
            trade_reject_time (int): The number of days during which a trade can be rejected.
            uses_faab (int): Numeric boolean (0 or 1) representing if the league uses FAAB (Free Agent Acquisition
                Budget).
            uses_fractional_points (int): Numeric boolean (0 or 1) representing if the league allows fractional scoring.
            uses_lock_eliminated_teams (int): Numeric boolean (0 or 1) representing if the league locks teams
                eliminated from the playoffs.
            uses_median_score (int): (for paid subscribers to Yahoo Fantasy Commissioner Plus) Numeric boolean (0 or 1)
                representing if the league plays an extra game against the median each week.
            uses_negative_points (int): Numeric boolean (0 or 1) representing if the league allows negative scoring.
            uses_playoffs (int): Numeric boolean (0 or 1) representing if the league has playoffs.
            uses_playoff_reseeding (int): Numeric boolean (0 or 1) representing if the league reseeds the playoffs once
                the fantasy regular season is complete.
            waiver_rule (str): Value designating when players go to waivers ("gametime", etc.).
            waiver_time (int): The number of days that players remain on waivers.
            waiver_type (str): Value designating what type of waivers are used by the league ("R" for rolling, etc.).
        """
        YahooFantasyObject.__init__(self, extracted_data)
        self.cant_cut_list: int = self._extracted_data.get("cant_cut_list", 0)
        self.divisions: List[Division] = self._extracted_data.get("divisions", [])
        self.draft_pick_time: Optional[int] = self._extracted_data.get("draft_pick_time", None)
        self.draft_time: Optional[int] = self._extracted_data.get("draft_time", None)
        self.draft_together: int = self._extracted_data.get("draft_together", 0)
        self.draft_type: str = self._extracted_data.get("draft_type", "")
        self.has_multiweek_championship: int = self._extracted_data.get("has_multiweek_championship", 0)
        self.has_playoff_consolation_games: int = self._extracted_data.get("has_playoff_consolation_games", 0)
        self.is_auction_draft: int = self._extracted_data.get("is_auction_draft", 0)
        self.league_premium_features: List = self._extracted_data.get("league_premium_features", [])  # TODO: features?
        self.max_teams: Optional[int] = self._extracted_data.get("max_teams", None)
        self.num_playoff_consolation_teams: Optional[int] = self._extracted_data.get("num_playoff_consolation_teams",
                                                                                     None)
        self.num_playoff_teams: Optional[int] = self._extracted_data.get("num_playoff_teams", None)
        self.persistent_url: Optional[str] = self._extracted_data.get("persistent_url", None)
        self.pickem_enabled: int = self._extracted_data.get("pickem_enabled", 0)
        self.player_pool: str = self._extracted_data.get("player_pool", "")
        self.playoff_start_week: Optional[int] = self._extracted_data.get("playoff_start_week", None)
        self.post_draft_players: str = self._extracted_data.get("post_draft_players", "")
        self.roster_positions: List[RosterPosition] = self._extracted_data.get("roster_positions", [])
        self.scoring_type: str = self._extracted_data.get("scoring_type", "")
        self.sendbird_channel_url: str = self._extracted_data.get("sendbird_channel_url", "")
        self.stat_categories: StatCategories = self._extracted_data.get("stat_categories", StatCategories({}))
        self.stat_modifiers: StatModifiers = self._extracted_data.get("stat_modifiers", StatModifiers({}))
        self.trade_end_date: str = self._extracted_data.get("trade_end_date", "")
        self.trade_ratify_type: str = self._extracted_data.get("trade_ratify_type", "")
        self.trade_reject_time: Optional[int] = self._extracted_data.get("trade_reject_time", None)
        self.uses_faab: int = self._extracted_data.get("uses_faab", 0)
        self.uses_fractional_points: int = self._extracted_data.get("uses_fractional_points", 0)
        self.uses_lock_eliminated_teams: int = self._extracted_data.get("uses_lock_eliminated_teams", 0)
        self.uses_median_score: int = self._extracted_data.get("uses_median_score", 0)
        self.uses_negative_points: int = self._extracted_data.get("uses_negative_points", 0)
        self.uses_playoff: int = self._extracted_data.get("uses_playoff", 0)
        self.uses_playoff_reseeding: int = self._extracted_data.get("uses_playoff_reseeding", 0)
        self.waiver_rule: str = self._extracted_data.get("waiver_rule", "")
        self.waiver_time: Optional[int] = self._extracted_data.get("waiver_time", None)
        self.waiver_type: str = self._extracted_data.get("waiver_type", "")

__init__

__init__(extracted_data)

Instantiate the Settings child class of YahooFantasyObject.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • cant_cut_list (int) –

    Numeric boolean (0 or 1) representing if the league uses the Yahoo "can't cut list".

  • divisions (list[Division]) –

    A list of YFPY Division instances for leagues with divisions.

  • draft_pick_time (int) –

    The number of seconds allowed to make each draft pick.

  • draft_time (int) –

    A timestamp representing when the draft will start.

  • draft_together (int) –

    Numeric boolean (0 or 1) representing if the league uses Yahoo Fantasy Draft Together live video chat during online drafts.

  • draft_type (str) –

    The type of draft ("live", "offline", etc.)

  • has_multiweek_championship (int) –

    Numeric boolean (0 or 1) representing if the league has a multi-week championship matchup.

  • has_playoff_consolation_games (bool) –

    Numeric boolean (0 or 1) representing if the league has a consolation playoff bracket.

  • is_auction_draft (int) –

    Numeric boolean (0 or 1) representing if the league uses an auction draft.

  • league_premium_features (List) –

    List of features enables as part of subscription to Yahoo Fantasy Plus or Yahoo Fantasy Commissioner Plus.

  • max_teams (int) –

    The maximum number of teams allowed in the league.

  • num_playoff_consolation_teams (int) –

    The number of teams that make the consolation playoff bracket.

  • num_playoff_teams (int) –

    The number of teams that make the playoffs.

  • persistent_url (str) –

    Custom URL configured for the league that remains the same every season.

  • pickem_enabled (int) –

    Numeric boolean (0 or 1) representing if the league has enabled the built-in Yahoo "pick 'em" game that allows managers to pick winners of each fantasy matchup each week in the league.

  • player_pool (str) –

    Value designating what player pool is allowed for the league ("ALL", etc.).

  • playoff_start_week (int) –

    The week number on which the playoffs start.

  • post_draft_players (str) –

    Value designating what happens to players after the draft ("W" for waivers, etc.).

  • roster_positions (list[RosterPosition]) –

    A list of YFPY RosterPosition instances.

  • scoring_type (str) –

    Value designating what type of scoring the league uses ("head" for head-to-head, etc.).

  • sendbird_channel_url (str) –

    The in-app Sendbird channel ID.

  • stat_categories (StatCategories) –

    A YFPY StatCategories instance.

  • stat_modifiers (StatModifiers) –

    A YFPY StatModifiers instance.

  • trade_end_date (str) –

    A date string representing when trading is no longer allowed (format: "YYYY-MM-DD").

  • trade_ratify_type (str) –

    Value designating how trades are ratified ("commish" for commissioner, etc.).

  • trade_reject_time (int) –

    The number of days during which a trade can be rejected.

  • uses_faab (int) –

    Numeric boolean (0 or 1) representing if the league uses FAAB (Free Agent Acquisition Budget).

  • uses_fractional_points (int) –

    Numeric boolean (0 or 1) representing if the league allows fractional scoring.

  • uses_lock_eliminated_teams (int) –

    Numeric boolean (0 or 1) representing if the league locks teams eliminated from the playoffs.

  • uses_median_score (int) –

    (for paid subscribers to Yahoo Fantasy Commissioner Plus) Numeric boolean (0 or 1) representing if the league plays an extra game against the median each week.

  • uses_negative_points (int) –

    Numeric boolean (0 or 1) representing if the league allows negative scoring.

  • uses_playoffs (int) –

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

  • uses_playoff_reseeding (int) –

    Numeric boolean (0 or 1) representing if the league reseeds the playoffs once the fantasy regular season is complete.

  • waiver_rule (str) –

    Value designating when players go to waivers ("gametime", etc.).

  • waiver_time (int) –

    The number of days that players remain on waivers.

  • waiver_type (str) –

    Value designating what type of waivers are used by the league ("R" for rolling, etc.).

Source code in yfpy/models.py
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
def __init__(self, extracted_data):
    """Instantiate the Settings child class of YahooFantasyObject.

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

    Attributes:
        cant_cut_list (int): Numeric boolean (0 or 1) representing if the league uses the Yahoo "can't cut list".
        divisions (list[Division]): A list of YFPY Division instances for leagues with divisions.
        draft_pick_time (int): The number of seconds allowed to make each draft pick.
        draft_time (int): A timestamp representing when the draft will start.
        draft_together (int): Numeric boolean (0 or 1) representing if the league uses Yahoo Fantasy Draft Together
            live video chat during online drafts.
        draft_type (str): The type of draft ("live", "offline", etc.)
        has_multiweek_championship (int): Numeric boolean (0 or 1) representing if the league has a multi-week
            championship matchup.
        has_playoff_consolation_games (bool): Numeric boolean (0 or 1) representing if the league has a consolation
            playoff bracket.
        is_auction_draft (int): Numeric boolean (0 or 1) representing if the league uses an auction draft.
        league_premium_features (List): List of features enables as part of subscription to Yahoo Fantasy Plus or
            Yahoo Fantasy Commissioner Plus.
        max_teams (int): The maximum number of teams allowed in the league.
        num_playoff_consolation_teams (int): The number of teams that make the consolation playoff bracket.
        num_playoff_teams (int): The number of teams that make the playoffs.
        persistent_url (str): Custom URL configured for the league that remains the same every season.
        pickem_enabled (int): Numeric boolean (0 or 1) representing if the league has enabled the built-in Yahoo
            "pick 'em" game that allows managers to pick winners of each fantasy matchup each week in the league.
        player_pool (str): Value designating what player pool is allowed for the league ("ALL", etc.).
        playoff_start_week (int): The week number on which the playoffs start.
        post_draft_players (str): Value designating what happens to players after the draft ("W" for waivers, etc.).
        roster_positions (list[RosterPosition]): A list of YFPY RosterPosition instances.
        scoring_type (str): Value designating what type of scoring the league uses ("head" for head-to-head, etc.).
        sendbird_channel_url (str): The in-app Sendbird channel ID.
        stat_categories (StatCategories): A YFPY StatCategories instance.
        stat_modifiers (StatModifiers): A YFPY StatModifiers instance.
        trade_end_date (str): A date string representing when trading is no longer allowed (format: "YYYY-MM-DD").
        trade_ratify_type (str): Value designating how trades are ratified ("commish" for commissioner, etc.).
        trade_reject_time (int): The number of days during which a trade can be rejected.
        uses_faab (int): Numeric boolean (0 or 1) representing if the league uses FAAB (Free Agent Acquisition
            Budget).
        uses_fractional_points (int): Numeric boolean (0 or 1) representing if the league allows fractional scoring.
        uses_lock_eliminated_teams (int): Numeric boolean (0 or 1) representing if the league locks teams
            eliminated from the playoffs.
        uses_median_score (int): (for paid subscribers to Yahoo Fantasy Commissioner Plus) Numeric boolean (0 or 1)
            representing if the league plays an extra game against the median each week.
        uses_negative_points (int): Numeric boolean (0 or 1) representing if the league allows negative scoring.
        uses_playoffs (int): Numeric boolean (0 or 1) representing if the league has playoffs.
        uses_playoff_reseeding (int): Numeric boolean (0 or 1) representing if the league reseeds the playoffs once
            the fantasy regular season is complete.
        waiver_rule (str): Value designating when players go to waivers ("gametime", etc.).
        waiver_time (int): The number of days that players remain on waivers.
        waiver_type (str): Value designating what type of waivers are used by the league ("R" for rolling, etc.).
    """
    YahooFantasyObject.__init__(self, extracted_data)
    self.cant_cut_list: int = self._extracted_data.get("cant_cut_list", 0)
    self.divisions: List[Division] = self._extracted_data.get("divisions", [])
    self.draft_pick_time: Optional[int] = self._extracted_data.get("draft_pick_time", None)
    self.draft_time: Optional[int] = self._extracted_data.get("draft_time", None)
    self.draft_together: int = self._extracted_data.get("draft_together", 0)
    self.draft_type: str = self._extracted_data.get("draft_type", "")
    self.has_multiweek_championship: int = self._extracted_data.get("has_multiweek_championship", 0)
    self.has_playoff_consolation_games: int = self._extracted_data.get("has_playoff_consolation_games", 0)
    self.is_auction_draft: int = self._extracted_data.get("is_auction_draft", 0)
    self.league_premium_features: List = self._extracted_data.get("league_premium_features", [])  # TODO: features?
    self.max_teams: Optional[int] = self._extracted_data.get("max_teams", None)
    self.num_playoff_consolation_teams: Optional[int] = self._extracted_data.get("num_playoff_consolation_teams",
                                                                                 None)
    self.num_playoff_teams: Optional[int] = self._extracted_data.get("num_playoff_teams", None)
    self.persistent_url: Optional[str] = self._extracted_data.get("persistent_url", None)
    self.pickem_enabled: int = self._extracted_data.get("pickem_enabled", 0)
    self.player_pool: str = self._extracted_data.get("player_pool", "")
    self.playoff_start_week: Optional[int] = self._extracted_data.get("playoff_start_week", None)
    self.post_draft_players: str = self._extracted_data.get("post_draft_players", "")
    self.roster_positions: List[RosterPosition] = self._extracted_data.get("roster_positions", [])
    self.scoring_type: str = self._extracted_data.get("scoring_type", "")
    self.sendbird_channel_url: str = self._extracted_data.get("sendbird_channel_url", "")
    self.stat_categories: StatCategories = self._extracted_data.get("stat_categories", StatCategories({}))
    self.stat_modifiers: StatModifiers = self._extracted_data.get("stat_modifiers", StatModifiers({}))
    self.trade_end_date: str = self._extracted_data.get("trade_end_date", "")
    self.trade_ratify_type: str = self._extracted_data.get("trade_ratify_type", "")
    self.trade_reject_time: Optional[int] = self._extracted_data.get("trade_reject_time", None)
    self.uses_faab: int = self._extracted_data.get("uses_faab", 0)
    self.uses_fractional_points: int = self._extracted_data.get("uses_fractional_points", 0)
    self.uses_lock_eliminated_teams: int = self._extracted_data.get("uses_lock_eliminated_teams", 0)
    self.uses_median_score: int = self._extracted_data.get("uses_median_score", 0)
    self.uses_negative_points: int = self._extracted_data.get("uses_negative_points", 0)
    self.uses_playoff: int = self._extracted_data.get("uses_playoff", 0)
    self.uses_playoff_reseeding: int = self._extracted_data.get("uses_playoff_reseeding", 0)
    self.waiver_rule: str = self._extracted_data.get("waiver_rule", "")
    self.waiver_time: Optional[int] = self._extracted_data.get("waiver_time", None)
    self.waiver_type: str = self._extracted_data.get("waiver_type", "")

Division

Bases: YahooFantasyObject

Model class for "division" data key.

Source code in yfpy/models.py
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
class Division(YahooFantasyObject):
    """Model class for "division" data key.
    """

    def __init__(self, extracted_data):
        """Instantiate the Division child class of YahooFantasyObject.

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

        Attributes:
            division_id (int): The unique division ID number in the league.
            name (str): The division name.
        """
        YahooFantasyObject.__init__(self, extracted_data)
        self.division_id: Optional[int] = self._extracted_data.get("division_id", None)
        self.name: str = self._extracted_data.get("name", "")

__init__

__init__(extracted_data)

Instantiate the Division child class of YahooFantasyObject.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • division_id (int) –

    The unique division ID number in the league.

  • name (str) –

    The division name.

Source code in yfpy/models.py
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
def __init__(self, extracted_data):
    """Instantiate the Division child class of YahooFantasyObject.

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

    Attributes:
        division_id (int): The unique division ID number in the league.
        name (str): The division name.
    """
    YahooFantasyObject.__init__(self, extracted_data)
    self.division_id: Optional[int] = self._extracted_data.get("division_id", None)
    self.name: str = self._extracted_data.get("name", "")

RosterPosition

Bases: YahooFantasyObject

Model class for "roster_position" data key.

Source code in yfpy/models.py
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
class RosterPosition(YahooFantasyObject):
    """Model class for "roster_position" data key.
    """

    def __init__(self, extracted_data):
        """Instantiate the RosterPosition child class of YahooFantasyObject.

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

        Attributes:
            abbreviation (str): The abbreviated position string.
            count (int): The number of roster slots available for this position.
            display_name (str): The unabbreviated position string.
            is_bench (int): Numeric boolean (0 or 1) representing if the roster position is the bench position.
            is_starting_position (int): Numeric boolean (0 or 1) representing if the roster position is in the starting
                lineup and scores points.
            position (str): The abbreviated position string.
            position_type (str): The position type ("O" for offense, etc.)
        """
        YahooFantasyObject.__init__(self, extracted_data)
        self.abbreviation: str = self._extracted_data.get("abbreviation", "")
        self.count: int = self._extracted_data.get("count", 0)
        self.display_name: str = self._extracted_data.get("display_name", "")
        self.is_bench: int = self._extracted_data.get("is_bench", 0)
        self.is_starting_position: int = self._extracted_data.get("is_starting_position", 0)
        self.position: str = self._extracted_data.get("position", "")
        self.position_type: str = self._extracted_data.get("position_type", "")

__init__

__init__(extracted_data)

Instantiate the RosterPosition child class of YahooFantasyObject.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • abbreviation (str) –

    The abbreviated position string.

  • count (int) –

    The number of roster slots available for this position.

  • display_name (str) –

    The unabbreviated position string.

  • is_bench (int) –

    Numeric boolean (0 or 1) representing if the roster position is the bench position.

  • is_starting_position (int) –

    Numeric boolean (0 or 1) representing if the roster position is in the starting lineup and scores points.

  • position (str) –

    The abbreviated position string.

  • position_type (str) –

    The position type ("O" for offense, etc.)

Source code in yfpy/models.py
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
def __init__(self, extracted_data):
    """Instantiate the RosterPosition child class of YahooFantasyObject.

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

    Attributes:
        abbreviation (str): The abbreviated position string.
        count (int): The number of roster slots available for this position.
        display_name (str): The unabbreviated position string.
        is_bench (int): Numeric boolean (0 or 1) representing if the roster position is the bench position.
        is_starting_position (int): Numeric boolean (0 or 1) representing if the roster position is in the starting
            lineup and scores points.
        position (str): The abbreviated position string.
        position_type (str): The position type ("O" for offense, etc.)
    """
    YahooFantasyObject.__init__(self, extracted_data)
    self.abbreviation: str = self._extracted_data.get("abbreviation", "")
    self.count: int = self._extracted_data.get("count", 0)
    self.display_name: str = self._extracted_data.get("display_name", "")
    self.is_bench: int = self._extracted_data.get("is_bench", 0)
    self.is_starting_position: int = self._extracted_data.get("is_starting_position", 0)
    self.position: str = self._extracted_data.get("position", "")
    self.position_type: str = self._extracted_data.get("position_type", "")

StatCategories

Bases: YahooFantasyObject

Model class for "stat_categories" data key.

Source code in yfpy/models.py
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
class StatCategories(YahooFantasyObject):
    """Model class for "stat_categories" data key.
    """

    def __init__(self, extracted_data):
        """Instantiate the StatCategories child class of YahooFantasyObject.

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

        Attributes:
            groups (list[Group]): A list of YFPY Group instances representing the stat
                categories groups.
            stats (list[Stat]): A list of YFPY Stat instances representing the league stat categories.
        """
        YahooFantasyObject.__init__(self, extracted_data)
        self.groups: List[Group] = self._extracted_data.get("groups", [])
        self.stats: List[Stat] = self._extracted_data.get("stats", [])

__init__

__init__(extracted_data)

Instantiate the StatCategories child class of YahooFantasyObject.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • groups (list[Group]) –

    A list of YFPY Group instances representing the stat categories groups.

  • stats (list[Stat]) –

    A list of YFPY Stat instances representing the league stat categories.

Source code in yfpy/models.py
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
def __init__(self, extracted_data):
    """Instantiate the StatCategories child class of YahooFantasyObject.

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

    Attributes:
        groups (list[Group]): A list of YFPY Group instances representing the stat
            categories groups.
        stats (list[Stat]): A list of YFPY Stat instances representing the league stat categories.
    """
    YahooFantasyObject.__init__(self, extracted_data)
    self.groups: List[Group] = self._extracted_data.get("groups", [])
    self.stats: List[Stat] = self._extracted_data.get("stats", [])

Group

Bases: YahooFantasyObject

Model class for "group" data key in "stat_categories" data key.

Source code in yfpy/models.py
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
class Group(YahooFantasyObject):
    """Model class for "group" data key in "stat_categories" data key.
    """

    def __init__(self, extracted_data):
        """Instantiate the Group child class of YahooFantasyObject.

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

        Attributes:
            group_abbr (str): The abbreviated display name of the stat categories group.
            group_display_name (str): The display name of the stat categories group.
            group_name (str): The name of the stat categories group.
        """
        YahooFantasyObject.__init__(self, extracted_data)
        self.group_abbr: str = self._extracted_data.get("group_abbr", "")
        self.group_display_name: str = self._extracted_data.get("group_display_name", "")
        self.group_name: str = self._extracted_data.get("group_name", "")

__init__

__init__(extracted_data)

Instantiate the Group child class of YahooFantasyObject.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • group_abbr (str) –

    The abbreviated display name of the stat categories group.

  • group_display_name (str) –

    The display name of the stat categories group.

  • group_name (str) –

    The name of the stat categories group.

Source code in yfpy/models.py
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
def __init__(self, extracted_data):
    """Instantiate the Group child class of YahooFantasyObject.

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

    Attributes:
        group_abbr (str): The abbreviated display name of the stat categories group.
        group_display_name (str): The display name of the stat categories group.
        group_name (str): The name of the stat categories group.
    """
    YahooFantasyObject.__init__(self, extracted_data)
    self.group_abbr: str = self._extracted_data.get("group_abbr", "")
    self.group_display_name: str = self._extracted_data.get("group_display_name", "")
    self.group_name: str = self._extracted_data.get("group_name", "")

StatModifiers

Bases: YahooFantasyObject

Model class for "stat_modifiers" data key.

Source code in yfpy/models.py
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
class StatModifiers(YahooFantasyObject):
    """Model class for "stat_modifiers" data key.
    """

    def __init__(self, extracted_data):
        """Instantiate the StatModifiers child class of YahooFantasyObject.

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

        Attributes:
            stats (list[Stat]): A list of YFPY Stat instances containing modifiers for each stat category.
        """
        YahooFantasyObject.__init__(self, extracted_data)
        self.stats: List[Stat] = self._extracted_data.get("stats", [])

__init__

__init__(extracted_data)

Instantiate the StatModifiers child class of YahooFantasyObject.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • stats (list[Stat]) –

    A list of YFPY Stat instances containing modifiers for each stat category.

Source code in yfpy/models.py
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
def __init__(self, extracted_data):
    """Instantiate the StatModifiers child class of YahooFantasyObject.

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

    Attributes:
        stats (list[Stat]): A list of YFPY Stat instances containing modifiers for each stat category.
    """
    YahooFantasyObject.__init__(self, extracted_data)
    self.stats: List[Stat] = self._extracted_data.get("stats", [])

Stat

Bases: YahooFantasyObject

Model class for "stat" data key.

Source code in yfpy/models.py
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
class Stat(YahooFantasyObject):
    """Model class for "stat" data key.
    """

    def __init__(self, extracted_data):
        """Instantiate the Stat child class of YahooFantasyObject.

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

        Attributes:
            abbr (str): The abbreviated display name of the stat.
            bonuses (list[Bonus]): A list of YFPY Bonus instances available for this stat category.
            display_name (str): The display name of the stat.
            enabled (int): Numeric boolean (0 or 1) representing if this stat is enabled for league scoring.
            group (str): The stat category ("misc", "yds_allow", "return", "receiving", "rushing", "passing", etc.)
            is_excluded_from_display (int): Numeric boolean (0 or 1) representing if this stat is not displayed.
            is_only_display_stat (int): Numeric boolean (0 or 1) representing if this stat is only for display.
            name (str): The full name of the stat.
            position_type (str): The player position type eligible for the stat.
            position_types (list[PositionType): A list of YFPY PositionType instances.
            sort_order (int): Numeric boolean (0 or 1) representing if the stat is sorted highest to lowest (1) or
                lowest to highest (0).
            stat_id (int): The unique stat ID number in the league.
            stat_position_types (list[PositionType]): A list of YFPY PositionType instances.
            value (float): The value of the stat (if applicable).
        """
        YahooFantasyObject.__init__(self, extracted_data)
        self.abbr: str = self._extracted_data.get("abbr", "")
        self.bonuses: List[Bonus] = self._extracted_data.get("bonuses", [])
        self.display_name: str = self._extracted_data.get("display_name", "")
        self.enabled: int = self._extracted_data.get("enabled", 0)
        self.group: str = self._extracted_data.get("group", "")
        self.is_excluded_from_display: int = self._extracted_data.get("is_excluded_from_display", 0)
        self.is_only_display_stat: int = self._extracted_data.get("is_only_display_stat", 0)
        self.name: str = self._extracted_data.get("name", "")
        self.position_type: str = self._extracted_data.get("position_type", "")
        self.position_types: List[PositionType] = self._extracted_data.get("position_types", [])
        self.sort_order: int = self._extracted_data.get("sort_order", 0)
        self.stat_id: Optional[int] = self._extracted_data.get("stat_id", None)
        self.stat_position_types: List[PositionType] = self._extracted_data.get("position_types", [])
        self.value: float = self._get_nested_value(self._extracted_data, "value", 0.0, float)

__init__

__init__(extracted_data)

Instantiate the Stat child class of YahooFantasyObject.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • abbr (str) –

    The abbreviated display name of the stat.

  • bonuses (list[Bonus]) –

    A list of YFPY Bonus instances available for this stat category.

  • display_name (str) –

    The display name of the stat.

  • enabled (int) –

    Numeric boolean (0 or 1) representing if this stat is enabled for league scoring.

  • group (str) –

    The stat category ("misc", "yds_allow", "return", "receiving", "rushing", "passing", etc.)

  • is_excluded_from_display (int) –

    Numeric boolean (0 or 1) representing if this stat is not displayed.

  • is_only_display_stat (int) –

    Numeric boolean (0 or 1) representing if this stat is only for display.

  • name (str) –

    The full name of the stat.

  • position_type (str) –

    The player position type eligible for the stat.

  • position_types (list[PositionType) –

    A list of YFPY PositionType instances.

  • sort_order (int) –

    Numeric boolean (0 or 1) representing if the stat is sorted highest to lowest (1) or lowest to highest (0).

  • stat_id (int) –

    The unique stat ID number in the league.

  • stat_position_types (list[PositionType]) –

    A list of YFPY PositionType instances.

  • value (float) –

    The value of the stat (if applicable).

Source code in yfpy/models.py
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
def __init__(self, extracted_data):
    """Instantiate the Stat child class of YahooFantasyObject.

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

    Attributes:
        abbr (str): The abbreviated display name of the stat.
        bonuses (list[Bonus]): A list of YFPY Bonus instances available for this stat category.
        display_name (str): The display name of the stat.
        enabled (int): Numeric boolean (0 or 1) representing if this stat is enabled for league scoring.
        group (str): The stat category ("misc", "yds_allow", "return", "receiving", "rushing", "passing", etc.)
        is_excluded_from_display (int): Numeric boolean (0 or 1) representing if this stat is not displayed.
        is_only_display_stat (int): Numeric boolean (0 or 1) representing if this stat is only for display.
        name (str): The full name of the stat.
        position_type (str): The player position type eligible for the stat.
        position_types (list[PositionType): A list of YFPY PositionType instances.
        sort_order (int): Numeric boolean (0 or 1) representing if the stat is sorted highest to lowest (1) or
            lowest to highest (0).
        stat_id (int): The unique stat ID number in the league.
        stat_position_types (list[PositionType]): A list of YFPY PositionType instances.
        value (float): The value of the stat (if applicable).
    """
    YahooFantasyObject.__init__(self, extracted_data)
    self.abbr: str = self._extracted_data.get("abbr", "")
    self.bonuses: List[Bonus] = self._extracted_data.get("bonuses", [])
    self.display_name: str = self._extracted_data.get("display_name", "")
    self.enabled: int = self._extracted_data.get("enabled", 0)
    self.group: str = self._extracted_data.get("group", "")
    self.is_excluded_from_display: int = self._extracted_data.get("is_excluded_from_display", 0)
    self.is_only_display_stat: int = self._extracted_data.get("is_only_display_stat", 0)
    self.name: str = self._extracted_data.get("name", "")
    self.position_type: str = self._extracted_data.get("position_type", "")
    self.position_types: List[PositionType] = self._extracted_data.get("position_types", [])
    self.sort_order: int = self._extracted_data.get("sort_order", 0)
    self.stat_id: Optional[int] = self._extracted_data.get("stat_id", None)
    self.stat_position_types: List[PositionType] = self._extracted_data.get("position_types", [])
    self.value: float = self._get_nested_value(self._extracted_data, "value", 0.0, float)

StatPositionType

Bases: YahooFantasyObject

Model class for "stat_position_type" data key.

Source code in yfpy/models.py
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
class StatPositionType(YahooFantasyObject):
    """Model class for "stat_position_type" data key.
    """

    def __init__(self, extracted_data):
        """Instantiate the StatPositionType child class of YahooFantasyObject.

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

        Attributes:
            is_only_display_stat (int): Numeric boolean (0 or 1) representing if the stat is only for display (such as
                if it is just the player position string).
            position_type (str): The type of the position ("O" for offense, etc.)
        """
        YahooFantasyObject.__init__(self, extracted_data)
        self.is_only_display_stat: int = self._extracted_data.get("is_only_display_stat", 0)
        self.position_type: str = self._extracted_data.get("position_type", "")

__init__

__init__(extracted_data)

Instantiate the StatPositionType child class of YahooFantasyObject.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • is_only_display_stat (int) –

    Numeric boolean (0 or 1) representing if the stat is only for display (such as if it is just the player position string).

  • position_type (str) –

    The type of the position ("O" for offense, etc.)

Source code in yfpy/models.py
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
def __init__(self, extracted_data):
    """Instantiate the StatPositionType child class of YahooFantasyObject.

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

    Attributes:
        is_only_display_stat (int): Numeric boolean (0 or 1) representing if the stat is only for display (such as
            if it is just the player position string).
        position_type (str): The type of the position ("O" for offense, etc.)
    """
    YahooFantasyObject.__init__(self, extracted_data)
    self.is_only_display_stat: int = self._extracted_data.get("is_only_display_stat", 0)
    self.position_type: str = self._extracted_data.get("position_type", "")

Bonus

Bases: YahooFantasyObject

Model class for "bonus" data key.

Source code in yfpy/models.py
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
class Bonus(YahooFantasyObject):
    """Model class for "bonus" data key.
    """

    def __init__(self, extracted_data):
        """Instantiate the Bonus child class of YahooFantasyObject.

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

        Attributes:
            points (float): The points awarded when the bonus is won.
            target (int): The stat value target required to be awarded the bonus.
        """
        YahooFantasyObject.__init__(self, extracted_data)
        self.points: float = self._get_nested_value(self._extracted_data, "points", 0.0, float)
        self.target: Optional[int] = self._extracted_data.get("target", None)

__init__

__init__(extracted_data)

Instantiate the Bonus child class of YahooFantasyObject.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • points (float) –

    The points awarded when the bonus is won.

  • target (int) –

    The stat value target required to be awarded the bonus.

Source code in yfpy/models.py
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
def __init__(self, extracted_data):
    """Instantiate the Bonus child class of YahooFantasyObject.

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

    Attributes:
        points (float): The points awarded when the bonus is won.
        target (int): The stat value target required to be awarded the bonus.
    """
    YahooFantasyObject.__init__(self, extracted_data)
    self.points: float = self._get_nested_value(self._extracted_data, "points", 0.0, float)
    self.target: Optional[int] = self._extracted_data.get("target", None)

Matchup

Bases: YahooFantasyObject

Model class for "matchup" data key.

Source code in yfpy/models.py
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
class Matchup(YahooFantasyObject):
    """Model class for "matchup" data key.
    """

    def __init__(self, extracted_data):
        """Instantiate the Matchup child class of YahooFantasyObject.

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

        Attributes:
            is_consolation (int): Numeric boolean (0 or 1) representing if the matchup is in a consolation bracket.
            is_matchup_recap_available (int): Numeric boolean (0 or 1) representing if the matchup recap is available.
            is_playoffs (int): Numeric boolean (0 or 1) representing if the matchup is in the playoffs bracket.
            is_tied (int): Numeric boolean (0 or 1) representing if the matchup result is tied.
            matchup_grades (list[MatchupGrade]): A list of YFPY MatchupGrade instances.
            matchup_recap_title (str): The title of the matchup recap.
            matchup_recap_url (str): The direct URL of the matchup recap.
            status (str): The status of the matchup ("postevent", etc.).
            teams (list[Team]): A list of YFPY Team instances for teams in the matchup.
            week (int): The week number of the matchup.
            week_end (str): A date string representing the end of the matchup week (format: "YYYY-MM-DD").
            week_start (str): A date string representing the start of the matchup week (format: "YYYY-MM-DD").
            winner_team_key (str): The Yahoo team key of the team that won the matchup.
        """
        YahooFantasyObject.__init__(self, extracted_data)
        self.is_consolation: int = self._extracted_data.get("is_consolation", 0)
        self.is_matchup_recap_available: int = self._extracted_data.get("is_matchup_recap_available", 0)
        self.is_playoffs: int = self._extracted_data.get("is_playoffs", 0)
        self.is_tied: int = self._extracted_data.get("is_tied", 0)
        self.matchup_grades: List[MatchupGrade] = self._extracted_data.get("matchup_grades", [])
        self.matchup_recap_title: str = self._extracted_data.get("matchup_recap_title", "")
        self.matchup_recap_url: str = self._extracted_data.get("matchup_recap_url", "")
        self.status: str = self._extracted_data.get("status", "")
        self.teams: List[Team] = self._extracted_data.get("teams", [])
        self.week: Optional[int] = self._extracted_data.get("week", None)
        self.week_end: str = self._extracted_data.get("week_end", "")
        self.week_start: str = self._extracted_data.get("week_start", "")
        self.winner_team_key: str = self._extracted_data.get("winner_team_key", "")

__init__

__init__(extracted_data)

Instantiate the Matchup child class of YahooFantasyObject.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • is_consolation (int) –

    Numeric boolean (0 or 1) representing if the matchup is in a consolation bracket.

  • is_matchup_recap_available (int) –

    Numeric boolean (0 or 1) representing if the matchup recap is available.

  • is_playoffs (int) –

    Numeric boolean (0 or 1) representing if the matchup is in the playoffs bracket.

  • is_tied (int) –

    Numeric boolean (0 or 1) representing if the matchup result is tied.

  • matchup_grades (list[MatchupGrade]) –

    A list of YFPY MatchupGrade instances.

  • matchup_recap_title (str) –

    The title of the matchup recap.

  • matchup_recap_url (str) –

    The direct URL of the matchup recap.

  • status (str) –

    The status of the matchup ("postevent", etc.).

  • teams (list[Team]) –

    A list of YFPY Team instances for teams in the matchup.

  • week (int) –

    The week number of the matchup.

  • week_end (str) –

    A date string representing the end of the matchup week (format: "YYYY-MM-DD").

  • week_start (str) –

    A date string representing the start of the matchup week (format: "YYYY-MM-DD").

  • winner_team_key (str) –

    The Yahoo team key of the team that won the matchup.

Source code in yfpy/models.py
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
def __init__(self, extracted_data):
    """Instantiate the Matchup child class of YahooFantasyObject.

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

    Attributes:
        is_consolation (int): Numeric boolean (0 or 1) representing if the matchup is in a consolation bracket.
        is_matchup_recap_available (int): Numeric boolean (0 or 1) representing if the matchup recap is available.
        is_playoffs (int): Numeric boolean (0 or 1) representing if the matchup is in the playoffs bracket.
        is_tied (int): Numeric boolean (0 or 1) representing if the matchup result is tied.
        matchup_grades (list[MatchupGrade]): A list of YFPY MatchupGrade instances.
        matchup_recap_title (str): The title of the matchup recap.
        matchup_recap_url (str): The direct URL of the matchup recap.
        status (str): The status of the matchup ("postevent", etc.).
        teams (list[Team]): A list of YFPY Team instances for teams in the matchup.
        week (int): The week number of the matchup.
        week_end (str): A date string representing the end of the matchup week (format: "YYYY-MM-DD").
        week_start (str): A date string representing the start of the matchup week (format: "YYYY-MM-DD").
        winner_team_key (str): The Yahoo team key of the team that won the matchup.
    """
    YahooFantasyObject.__init__(self, extracted_data)
    self.is_consolation: int = self._extracted_data.get("is_consolation", 0)
    self.is_matchup_recap_available: int = self._extracted_data.get("is_matchup_recap_available", 0)
    self.is_playoffs: int = self._extracted_data.get("is_playoffs", 0)
    self.is_tied: int = self._extracted_data.get("is_tied", 0)
    self.matchup_grades: List[MatchupGrade] = self._extracted_data.get("matchup_grades", [])
    self.matchup_recap_title: str = self._extracted_data.get("matchup_recap_title", "")
    self.matchup_recap_url: str = self._extracted_data.get("matchup_recap_url", "")
    self.status: str = self._extracted_data.get("status", "")
    self.teams: List[Team] = self._extracted_data.get("teams", [])
    self.week: Optional[int] = self._extracted_data.get("week", None)
    self.week_end: str = self._extracted_data.get("week_end", "")
    self.week_start: str = self._extracted_data.get("week_start", "")
    self.winner_team_key: str = self._extracted_data.get("winner_team_key", "")

MatchupGrade

Bases: YahooFantasyObject

Model class for "matchup_grade" data key.

Source code in yfpy/models.py
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
class MatchupGrade(YahooFantasyObject):
    """Model class for "matchup_grade" data key.
    """

    def __init__(self, extracted_data):
        """Instantiate the MatchupGrade child class of YahooFantasyObject.

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

        Attributes:
            grade (str): The letter grade assigned to the matchup performance ("A+", "A", ..., "F-").
            team_key (str): The Yahoo team key for the team receiving the matchup grade.
        """
        YahooFantasyObject.__init__(self, extracted_data)
        self.grade: str = self._extracted_data.get("grade", "")
        self.team_key: str = self._extracted_data.get("team_key", "")

__init__

__init__(extracted_data)

Instantiate the MatchupGrade child class of YahooFantasyObject.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • grade (str) –

    The letter grade assigned to the matchup performance ("A+", "A", ..., "F-").

  • team_key (str) –

    The Yahoo team key for the team receiving the matchup grade.

Source code in yfpy/models.py
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
def __init__(self, extracted_data):
    """Instantiate the MatchupGrade child class of YahooFantasyObject.

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

    Attributes:
        grade (str): The letter grade assigned to the matchup performance ("A+", "A", ..., "F-").
        team_key (str): The Yahoo team key for the team receiving the matchup grade.
    """
    YahooFantasyObject.__init__(self, extracted_data)
    self.grade: str = self._extracted_data.get("grade", "")
    self.team_key: str = self._extracted_data.get("team_key", "")

Player

Bases: YahooFantasyObject

Model class for "player" data key.

Source code in yfpy/models.py
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
class Player(YahooFantasyObject):
    """Model class for "player" data key.
    """

    def __init__(self, extracted_data):
        """Instantiate the Player child class of YahooFantasyObject.

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

        Attributes:
            bye_weeks (ByeWeeks): A YFPY ByeWeeks instance.
            bye (int): The week number that the player is on bye.
            display_position (str): The display string for the player position.
            draft_analysis (DraftAnalysis): A YFPY DraftAnalysis instance.
            average_draft_pick (float): The average pick at which the player was drafted.
            average_draft_round (float): The average round in which the player was drafted.
            average_draft_cost (float): The average price paid for the player to be drafted.
            percent_drafted (float): The overall percentage the player was drafted.
            editorial_player_key (str): The Yahoo player key using the game key.
            editorial_team_abbr (str): The abbreviation of the professional team name for which the player plays.
            editorial_team_full_name (str): The name of the professional team for which the player plays.
            editorial_team_key (str): The Yahoo team key of the professional team for which the player plays using the
                game key.
            editorial_team_url (str): The direct URL of the professional team for which the player plays on Yahoo
                Sports.
            eligible_positions (list[str]): A list of positions for which the player is eligible.
            eligible_positions_to_add (list[str]): A list of positions for which the player can have eligibility added.
            has_player_notes (int): Numeric boolean (0 or 1) representing if the player has any notes.
            has_recent_player_notes (int): Numeric boolean (0 or 1) representing if the player has any recent notes.
            headshot (Headshot): A YFPY Headshot instance.
            headshot_size (str): The player headshot photo size ("small", "large", etc.)
            headshot_url (str): The direct URL of the player headshot photo.
            image_url (str): The direct URL of the player headshot photo.
            injury_note (str): The physical part of the player that is injured if the player has an injury.
            is_editable (int): Numeric boolean (0 or 1) representing if the player is editable.
            is_keeper (int): Numeric boolean (0 or 1) representing if the player is a keeper.
            is_undroppable (int): Numeric boolean (0 or 1) representing if the player is undroppable.
            name (Name): A YFPY Name instance.
            first_name (str): The first name of the player.
            last_name (str): The last name of the player.
            full_name (str): The full name of the player.
            ownership (Ownership): A YFPY Ownership instance.
            percent_owned (PercentOwned): A YFPY PercentOwned instanced.
            percent_owned_value (float): The percentage value the player is/was owned in the coverage timeframe.
            player_id (int): The unique player ID.
            player_key (str): The Yahoo player key.
            player_notes_last_timestamp (int): A timestamp of the most recent players notes.
            player_points (PlayerPoints): A YFPY PlayerPoints instance.
            player_points_value (float): The total points for the player within the coverage timeframe.
            player_stats (PlayerStats): A YFPY PlayerStats instance.
            stats (list[Stat]): A list of YFPY Stat instances.
            position_type (str): The position type of the player ("offense", "defense", etc.).
            primary_position (str): The primary position of the player.
            selected_position (SelectedPosition): A YFPY SelectedPosition instance.
            selected_position_value (str): The selected position of the player.
            status (str): The status abbreviation of the player ("IR", "PUP", "O", "Q", etc.).
            status_full (str): The unabbreviated status of the player ("Questionable", etc.).
            transaction_data (TransactionData): A YFPY TransactionData instance.
            uniform_number (int): The uniform number of the player.
            url (str): The direct URL of the player page on Yahoo Sports.
        """
        YahooFantasyObject.__init__(self, extracted_data)
        self.bye_weeks: ByeWeeks = self._extracted_data.get("bye_weeks", ByeWeeks({}))
        self.bye: int = self._get_nested_value(self.bye_weeks, "week", None, int)
        self.display_position: str = self._extracted_data.get("display_position", "")
        self.draft_analysis: DraftAnalysis = self._extracted_data.get("draft_analysis", DraftAnalysis({}))
        self.average_draft_pick: float = self._get_nested_value(self.draft_analysis, "average_pick", None, float)
        self.average_draft_round: float = self._get_nested_value(self.draft_analysis, "average_round", None, float)
        self.average_draft_cost: float = self._get_nested_value(self.draft_analysis, "average_cost", None, float)
        self.percent_drafted: float = self._get_nested_value(self.draft_analysis, "percent_drafted", None, float)
        self.editorial_player_key: str = self._extracted_data.get("editorial_player_key", "")
        self.editorial_team_abbr: str = self._extracted_data.get("editorial_team_abbr", "")
        self.editorial_team_full_name: str = self._extracted_data.get("editorial_team_full_name", "")
        self.editorial_team_key: str = self._extracted_data.get("editorial_team_key", "")
        self.editorial_team_url: str = self._extracted_data.get("editorial_team_url", "")
        eligible_positions = self._extracted_data.get("eligible_positions")
        self.eligible_positions: List[str] = []
        if isinstance(eligible_positions, dict):
            self.eligible_positions.append(eligible_positions.get("position"))
        elif isinstance(eligible_positions, list):
            for position in eligible_positions:
                if isinstance(position, dict):
                    self.eligible_positions.append(position.get("position"))
                else:
                    self.eligible_positions.append(position)
        elif isinstance(eligible_positions, str):
            self.eligible_positions.append(eligible_positions)
        self.eligible_positions_to_add: List[str] = self._extracted_data.get("eligible_positions_to_add", [])
        self.has_player_notes: int = self._extracted_data.get("has_player_notes", 0)
        self.has_recent_player_notes: int = self._extracted_data.get("has_recent_player_notes", 0)
        self.headshot: Headshot = self._extracted_data.get("headshot", Headshot({}))
        self.headshot_size: str = self._get_nested_value(self.headshot, "size", "")
        self.headshot_url: str = self._get_nested_value(self.headshot, "url", "")
        self.image_url: str = self._extracted_data.get("image_url", "")
        self.injury_note: str = self._extracted_data.get("injury_note", "")
        self.is_editable: int = self._extracted_data.get("is_editable", 0)
        self.is_keeper: int = self._extracted_data.get("is_keeper", 0)
        self.is_undroppable: int = self._extracted_data.get("is_undroppable", 0)
        self.name: Name = self._extracted_data.get("name", Name({}))
        self.first_name: str = self._get_nested_value(self.name, "first", "")
        self.last_name: str = self._get_nested_value(self.name, "last", "")
        self.full_name: str = self._get_nested_value(self.name, "full", "")
        self.ownership: Ownership = self._extracted_data.get("ownership", Ownership({}))
        self.percent_owned: PercentOwned = self._extracted_data.get("percent_owned", PercentOwned({}))
        self.percent_owned_value: float = self._get_nested_value(self.percent_owned, "value", 0.0, float)
        self.player_advanced_stats: PlayerAdvancedStats = self._extracted_data.get("player_advanced_stats",
                                                                                   PlayerAdvancedStats({}))
        self.player_id: Optional[int] = self._extracted_data.get("player_id", None)
        self.player_key: str = self._extracted_data.get("player_key", "")
        self.player_notes_last_timestamp: Optional[int] = self._extracted_data.get("player_notes_last_timestamp", None)
        self.player_points: PlayerPoints = self._extracted_data.get("player_points", PlayerPoints({}))
        self.player_points_value: float = self._get_nested_value(self.player_points, "total", 0.0, float)
        self.player_stats: PlayerStats = self._extracted_data.get("player_stats", PlayerStats({}))
        self.stats: List[Stat] = self._get_nested_value(self.player_stats, "stats", [])
        self.position_type: str = self._extracted_data.get("position_type", "")
        self.primary_position: str = self._extracted_data.get("primary_position", "")
        self.selected_position: SelectedPosition = self._extracted_data.get("selected_position",
                                                                            SelectedPosition({}))
        self.selected_position_value: str = self._get_nested_value(self.selected_position, "position", "")
        self.status: str = self._extracted_data.get("status", "")
        self.status_full: str = self._extracted_data.get("status_full", "")
        self.transaction_data: TransactionData = self._extracted_data.get("transaction_data",
                                                                          TransactionData({}))
        self.uniform_number: Optional[int] = self._extracted_data.get("uniform_number", None)
        self.url: str = self._extracted_data.get("url", "")

__init__

__init__(extracted_data)

Instantiate the Player child class of YahooFantasyObject.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • bye_weeks (ByeWeeks) –

    A YFPY ByeWeeks instance.

  • bye (int) –

    The week number that the player is on bye.

  • display_position (str) –

    The display string for the player position.

  • draft_analysis (DraftAnalysis) –

    A YFPY DraftAnalysis instance.

  • average_draft_pick (float) –

    The average pick at which the player was drafted.

  • average_draft_round (float) –

    The average round in which the player was drafted.

  • average_draft_cost (float) –

    The average price paid for the player to be drafted.

  • percent_drafted (float) –

    The overall percentage the player was drafted.

  • editorial_player_key (str) –

    The Yahoo player key using the game key.

  • editorial_team_abbr (str) –

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

  • editorial_team_full_name (str) –

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

  • editorial_team_key (str) –

    The Yahoo team key of the professional team for which the player plays using the game key.

  • editorial_team_url (str) –

    The direct URL of the professional team for which the player plays on Yahoo Sports.

  • eligible_positions (list[str]) –

    A list of positions for which the player is eligible.

  • eligible_positions_to_add (list[str]) –

    A list of positions for which the player can have eligibility added.

  • has_player_notes (int) –

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

  • has_recent_player_notes (int) –

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

  • headshot (Headshot) –

    A YFPY Headshot instance.

  • headshot_size (str) –

    The player headshot photo size ("small", "large", etc.)

  • headshot_url (str) –

    The direct URL of the player headshot photo.

  • image_url (str) –

    The direct URL of the player headshot photo.

  • injury_note (str) –

    The physical part of the player that is injured if the player has an injury.

  • is_editable (int) –

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

  • is_keeper (int) –

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

  • is_undroppable (int) –

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

  • name (Name) –

    A YFPY Name instance.

  • first_name (str) –

    The first name of the player.

  • last_name (str) –

    The last name of the player.

  • full_name (str) –

    The full name of the player.

  • ownership (Ownership) –

    A YFPY Ownership instance.

  • percent_owned (PercentOwned) –

    A YFPY PercentOwned instanced.

  • percent_owned_value (float) –

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

  • player_id (int) –

    The unique player ID.

  • player_key (str) –

    The Yahoo player key.

  • player_notes_last_timestamp (int) –

    A timestamp of the most recent players notes.

  • player_points (PlayerPoints) –

    A YFPY PlayerPoints instance.

  • player_points_value (float) –

    The total points for the player within the coverage timeframe.

  • player_stats (PlayerStats) –

    A YFPY PlayerStats instance.

  • stats (list[Stat]) –

    A list of YFPY Stat instances.

  • position_type (str) –

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

  • primary_position (str) –

    The primary position of the player.

  • selected_position (SelectedPosition) –

    A YFPY SelectedPosition instance.

  • selected_position_value (str) –

    The selected position of the player.

  • status (str) –

    The status abbreviation of the player ("IR", "PUP", "O", "Q", etc.).

  • status_full (str) –

    The unabbreviated status of the player ("Questionable", etc.).

  • transaction_data (TransactionData) –

    A YFPY TransactionData instance.

  • uniform_number (int) –

    The uniform number of the player.

  • url (str) –

    The direct URL of the player page on Yahoo Sports.

Source code in yfpy/models.py
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
def __init__(self, extracted_data):
    """Instantiate the Player child class of YahooFantasyObject.

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

    Attributes:
        bye_weeks (ByeWeeks): A YFPY ByeWeeks instance.
        bye (int): The week number that the player is on bye.
        display_position (str): The display string for the player position.
        draft_analysis (DraftAnalysis): A YFPY DraftAnalysis instance.
        average_draft_pick (float): The average pick at which the player was drafted.
        average_draft_round (float): The average round in which the player was drafted.
        average_draft_cost (float): The average price paid for the player to be drafted.
        percent_drafted (float): The overall percentage the player was drafted.
        editorial_player_key (str): The Yahoo player key using the game key.
        editorial_team_abbr (str): The abbreviation of the professional team name for which the player plays.
        editorial_team_full_name (str): The name of the professional team for which the player plays.
        editorial_team_key (str): The Yahoo team key of the professional team for which the player plays using the
            game key.
        editorial_team_url (str): The direct URL of the professional team for which the player plays on Yahoo
            Sports.
        eligible_positions (list[str]): A list of positions for which the player is eligible.
        eligible_positions_to_add (list[str]): A list of positions for which the player can have eligibility added.
        has_player_notes (int): Numeric boolean (0 or 1) representing if the player has any notes.
        has_recent_player_notes (int): Numeric boolean (0 or 1) representing if the player has any recent notes.
        headshot (Headshot): A YFPY Headshot instance.
        headshot_size (str): The player headshot photo size ("small", "large", etc.)
        headshot_url (str): The direct URL of the player headshot photo.
        image_url (str): The direct URL of the player headshot photo.
        injury_note (str): The physical part of the player that is injured if the player has an injury.
        is_editable (int): Numeric boolean (0 or 1) representing if the player is editable.
        is_keeper (int): Numeric boolean (0 or 1) representing if the player is a keeper.
        is_undroppable (int): Numeric boolean (0 or 1) representing if the player is undroppable.
        name (Name): A YFPY Name instance.
        first_name (str): The first name of the player.
        last_name (str): The last name of the player.
        full_name (str): The full name of the player.
        ownership (Ownership): A YFPY Ownership instance.
        percent_owned (PercentOwned): A YFPY PercentOwned instanced.
        percent_owned_value (float): The percentage value the player is/was owned in the coverage timeframe.
        player_id (int): The unique player ID.
        player_key (str): The Yahoo player key.
        player_notes_last_timestamp (int): A timestamp of the most recent players notes.
        player_points (PlayerPoints): A YFPY PlayerPoints instance.
        player_points_value (float): The total points for the player within the coverage timeframe.
        player_stats (PlayerStats): A YFPY PlayerStats instance.
        stats (list[Stat]): A list of YFPY Stat instances.
        position_type (str): The position type of the player ("offense", "defense", etc.).
        primary_position (str): The primary position of the player.
        selected_position (SelectedPosition): A YFPY SelectedPosition instance.
        selected_position_value (str): The selected position of the player.
        status (str): The status abbreviation of the player ("IR", "PUP", "O", "Q", etc.).
        status_full (str): The unabbreviated status of the player ("Questionable", etc.).
        transaction_data (TransactionData): A YFPY TransactionData instance.
        uniform_number (int): The uniform number of the player.
        url (str): The direct URL of the player page on Yahoo Sports.
    """
    YahooFantasyObject.__init__(self, extracted_data)
    self.bye_weeks: ByeWeeks = self._extracted_data.get("bye_weeks", ByeWeeks({}))
    self.bye: int = self._get_nested_value(self.bye_weeks, "week", None, int)
    self.display_position: str = self._extracted_data.get("display_position", "")
    self.draft_analysis: DraftAnalysis = self._extracted_data.get("draft_analysis", DraftAnalysis({}))
    self.average_draft_pick: float = self._get_nested_value(self.draft_analysis, "average_pick", None, float)
    self.average_draft_round: float = self._get_nested_value(self.draft_analysis, "average_round", None, float)
    self.average_draft_cost: float = self._get_nested_value(self.draft_analysis, "average_cost", None, float)
    self.percent_drafted: float = self._get_nested_value(self.draft_analysis, "percent_drafted", None, float)
    self.editorial_player_key: str = self._extracted_data.get("editorial_player_key", "")
    self.editorial_team_abbr: str = self._extracted_data.get("editorial_team_abbr", "")
    self.editorial_team_full_name: str = self._extracted_data.get("editorial_team_full_name", "")
    self.editorial_team_key: str = self._extracted_data.get("editorial_team_key", "")
    self.editorial_team_url: str = self._extracted_data.get("editorial_team_url", "")
    eligible_positions = self._extracted_data.get("eligible_positions")
    self.eligible_positions: List[str] = []
    if isinstance(eligible_positions, dict):
        self.eligible_positions.append(eligible_positions.get("position"))
    elif isinstance(eligible_positions, list):
        for position in eligible_positions:
            if isinstance(position, dict):
                self.eligible_positions.append(position.get("position"))
            else:
                self.eligible_positions.append(position)
    elif isinstance(eligible_positions, str):
        self.eligible_positions.append(eligible_positions)
    self.eligible_positions_to_add: List[str] = self._extracted_data.get("eligible_positions_to_add", [])
    self.has_player_notes: int = self._extracted_data.get("has_player_notes", 0)
    self.has_recent_player_notes: int = self._extracted_data.get("has_recent_player_notes", 0)
    self.headshot: Headshot = self._extracted_data.get("headshot", Headshot({}))
    self.headshot_size: str = self._get_nested_value(self.headshot, "size", "")
    self.headshot_url: str = self._get_nested_value(self.headshot, "url", "")
    self.image_url: str = self._extracted_data.get("image_url", "")
    self.injury_note: str = self._extracted_data.get("injury_note", "")
    self.is_editable: int = self._extracted_data.get("is_editable", 0)
    self.is_keeper: int = self._extracted_data.get("is_keeper", 0)
    self.is_undroppable: int = self._extracted_data.get("is_undroppable", 0)
    self.name: Name = self._extracted_data.get("name", Name({}))
    self.first_name: str = self._get_nested_value(self.name, "first", "")
    self.last_name: str = self._get_nested_value(self.name, "last", "")
    self.full_name: str = self._get_nested_value(self.name, "full", "")
    self.ownership: Ownership = self._extracted_data.get("ownership", Ownership({}))
    self.percent_owned: PercentOwned = self._extracted_data.get("percent_owned", PercentOwned({}))
    self.percent_owned_value: float = self._get_nested_value(self.percent_owned, "value", 0.0, float)
    self.player_advanced_stats: PlayerAdvancedStats = self._extracted_data.get("player_advanced_stats",
                                                                               PlayerAdvancedStats({}))
    self.player_id: Optional[int] = self._extracted_data.get("player_id", None)
    self.player_key: str = self._extracted_data.get("player_key", "")
    self.player_notes_last_timestamp: Optional[int] = self._extracted_data.get("player_notes_last_timestamp", None)
    self.player_points: PlayerPoints = self._extracted_data.get("player_points", PlayerPoints({}))
    self.player_points_value: float = self._get_nested_value(self.player_points, "total", 0.0, float)
    self.player_stats: PlayerStats = self._extracted_data.get("player_stats", PlayerStats({}))
    self.stats: List[Stat] = self._get_nested_value(self.player_stats, "stats", [])
    self.position_type: str = self._extracted_data.get("position_type", "")
    self.primary_position: str = self._extracted_data.get("primary_position", "")
    self.selected_position: SelectedPosition = self._extracted_data.get("selected_position",
                                                                        SelectedPosition({}))
    self.selected_position_value: str = self._get_nested_value(self.selected_position, "position", "")
    self.status: str = self._extracted_data.get("status", "")
    self.status_full: str = self._extracted_data.get("status_full", "")
    self.transaction_data: TransactionData = self._extracted_data.get("transaction_data",
                                                                      TransactionData({}))
    self.uniform_number: Optional[int] = self._extracted_data.get("uniform_number", None)
    self.url: str = self._extracted_data.get("url", "")

ByeWeeks

Bases: YahooFantasyObject

Model class for "bye_weeks" data key.

Source code in yfpy/models.py
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
class ByeWeeks(YahooFantasyObject):
    """Model class for "bye_weeks" data key.
    """

    def __init__(self, extracted_data):
        """Instantiate the ByeWeeks child class of YahooFantasyObject.

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

        Attributes:
            week (int): The week number that the player is on bye.
        """
        YahooFantasyObject.__init__(self, extracted_data)
        self.week: Optional[int] = self._extracted_data.get("week", None)

__init__

__init__(extracted_data)

Instantiate the ByeWeeks child class of YahooFantasyObject.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • week (int) –

    The week number that the player is on bye.

Source code in yfpy/models.py
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
def __init__(self, extracted_data):
    """Instantiate the ByeWeeks child class of YahooFantasyObject.

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

    Attributes:
        week (int): The week number that the player is on bye.
    """
    YahooFantasyObject.__init__(self, extracted_data)
    self.week: Optional[int] = self._extracted_data.get("week", None)

DraftAnalysis

Bases: YahooFantasyObject

Model class for "draft_analysis" data key.

Source code in yfpy/models.py
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
class DraftAnalysis(YahooFantasyObject):
    """Model class for "draft_analysis" data key.
    """

    def __init__(self, extracted_data):
        """Instantiate the DraftAnalysis child class of YahooFantasyObject.

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

        Attributes:
            average_pick (float): The average pick at which the player was drafted.
            average_round (float): The average round in which the player was drafted.
            average_cost (float): The average price paid for the player to be drafted.
            percent_drafted (float): The overall percentage the player was drafted.
            preseason_average_cost (float): The average price paid for the player to be drafted in the preseason.
            preseason_average_pick (float): The average pick at which the player was drafted in the preseason.
            preseason_average_round (float): The average round in which the player was drafted in the preseason.
            preseason_percent_drafted (float): The overall percentage the player was drafted in the preseason.
        """
        YahooFantasyObject.__init__(self, extracted_data)
        self.average_pick: float = self._get_nested_value(self._extracted_data, "average_pick", 0.0, float)
        self.average_round: float = self._get_nested_value(self._extracted_data, "average_round", 0.0, float)
        self.average_cost: float = self._get_nested_value(self._extracted_data, "average_cost", 0.0, float)
        self.percent_drafted: float = self._get_nested_value(self._extracted_data, "percent_drafted", 0.0, float)
        self.preseason_average_cost: float = self._get_nested_value(
            self._extracted_data, "preseason_average_cost", 0.0, float
        )
        self.preseason_average_pick: float = self._get_nested_value(
            self._extracted_data, "preseason_average_pick", 0.0, float
        )
        self.preseason_average_round: float = self._get_nested_value(
            self._extracted_data, "preseason_average_round", 0.0, float
        )
        self.preseason_percent_drafted: float = self._get_nested_value(
            self._extracted_data, "preseason_percent_drafted", 0.0, float
        )

__init__

__init__(extracted_data)

Instantiate the DraftAnalysis child class of YahooFantasyObject.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • average_pick (float) –

    The average pick at which the player was drafted.

  • average_round (float) –

    The average round in which the player was drafted.

  • average_cost (float) –

    The average price paid for the player to be drafted.

  • percent_drafted (float) –

    The overall percentage the player was drafted.

  • preseason_average_cost (float) –

    The average price paid for the player to be drafted in the preseason.

  • preseason_average_pick (float) –

    The average pick at which the player was drafted in the preseason.

  • preseason_average_round (float) –

    The average round in which the player was drafted in the preseason.

  • preseason_percent_drafted (float) –

    The overall percentage the player was drafted in the preseason.

Source code in yfpy/models.py
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
def __init__(self, extracted_data):
    """Instantiate the DraftAnalysis child class of YahooFantasyObject.

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

    Attributes:
        average_pick (float): The average pick at which the player was drafted.
        average_round (float): The average round in which the player was drafted.
        average_cost (float): The average price paid for the player to be drafted.
        percent_drafted (float): The overall percentage the player was drafted.
        preseason_average_cost (float): The average price paid for the player to be drafted in the preseason.
        preseason_average_pick (float): The average pick at which the player was drafted in the preseason.
        preseason_average_round (float): The average round in which the player was drafted in the preseason.
        preseason_percent_drafted (float): The overall percentage the player was drafted in the preseason.
    """
    YahooFantasyObject.__init__(self, extracted_data)
    self.average_pick: float = self._get_nested_value(self._extracted_data, "average_pick", 0.0, float)
    self.average_round: float = self._get_nested_value(self._extracted_data, "average_round", 0.0, float)
    self.average_cost: float = self._get_nested_value(self._extracted_data, "average_cost", 0.0, float)
    self.percent_drafted: float = self._get_nested_value(self._extracted_data, "percent_drafted", 0.0, float)
    self.preseason_average_cost: float = self._get_nested_value(
        self._extracted_data, "preseason_average_cost", 0.0, float
    )
    self.preseason_average_pick: float = self._get_nested_value(
        self._extracted_data, "preseason_average_pick", 0.0, float
    )
    self.preseason_average_round: float = self._get_nested_value(
        self._extracted_data, "preseason_average_round", 0.0, float
    )
    self.preseason_percent_drafted: float = self._get_nested_value(
        self._extracted_data, "preseason_percent_drafted", 0.0, float
    )

Headshot

Bases: YahooFantasyObject

Model class for "headshot" data key.

Source code in yfpy/models.py
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
class Headshot(YahooFantasyObject):
    """Model class for "headshot" data key.
    """

    def __init__(self, extracted_data):
        """Instantiate the Headshot child class of YahooFantasyObject.

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

        Attributes:
            size (str): The size of the headshot photo ("small", "large", etc.)
            url (str): The direct URL of the headshot photo.
        """
        YahooFantasyObject.__init__(self, extracted_data)
        self.size: str = self._extracted_data.get("size", "")
        self.url: str = self._extracted_data.get("url", "")

__init__

__init__(extracted_data)

Instantiate the Headshot child class of YahooFantasyObject.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • size (str) –

    The size of the headshot photo ("small", "large", etc.)

  • url (str) –

    The direct URL of the headshot photo.

Source code in yfpy/models.py
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
def __init__(self, extracted_data):
    """Instantiate the Headshot child class of YahooFantasyObject.

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

    Attributes:
        size (str): The size of the headshot photo ("small", "large", etc.)
        url (str): The direct URL of the headshot photo.
    """
    YahooFantasyObject.__init__(self, extracted_data)
    self.size: str = self._extracted_data.get("size", "")
    self.url: str = self._extracted_data.get("url", "")

Name

Bases: YahooFantasyObject

Model class for "name" data key.

Source code in yfpy/models.py
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
class Name(YahooFantasyObject):
    """Model class for "name" data key.
    """

    def __init__(self, extracted_data):
        """Instantiate the Name child class of YahooFantasyObject.

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

        Attributes:
            ascii_first (str): The ASCII encoded string of the first name of the player.
            ascii_last (str): The ASCII encoded string of the last name of the player.
            first (str): The first name of the player.
            full (str): The full name of the player.
            last (str): The last name of teh player.
        """
        YahooFantasyObject.__init__(self, extracted_data)
        self.ascii_first: str = self._extracted_data.get("ascii_first", "")
        self.ascii_last: str = self._extracted_data.get("ascii_last", "")
        self.first: str = self._extracted_data.get("first", "")
        self.full: str = self._extracted_data.get("full", "")
        self.last: str = self._extracted_data.get("last", "")

__init__

__init__(extracted_data)

Instantiate the Name child class of YahooFantasyObject.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • ascii_first (str) –

    The ASCII encoded string of the first name of the player.

  • ascii_last (str) –

    The ASCII encoded string of the last name of the player.

  • first (str) –

    The first name of the player.

  • full (str) –

    The full name of the player.

  • last (str) –

    The last name of teh player.

Source code in yfpy/models.py
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
def __init__(self, extracted_data):
    """Instantiate the Name child class of YahooFantasyObject.

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

    Attributes:
        ascii_first (str): The ASCII encoded string of the first name of the player.
        ascii_last (str): The ASCII encoded string of the last name of the player.
        first (str): The first name of the player.
        full (str): The full name of the player.
        last (str): The last name of teh player.
    """
    YahooFantasyObject.__init__(self, extracted_data)
    self.ascii_first: str = self._extracted_data.get("ascii_first", "")
    self.ascii_last: str = self._extracted_data.get("ascii_last", "")
    self.first: str = self._extracted_data.get("first", "")
    self.full: str = self._extracted_data.get("full", "")
    self.last: str = self._extracted_data.get("last", "")

Ownership

Bases: YahooFantasyObject

Model class for "ownership" data key.

Source code in yfpy/models.py
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
class Ownership(YahooFantasyObject):
    """Model class for "ownership" data key.
    """

    def __init__(self, extracted_data):
        """Instantiate the Ownership child class of YahooFantasyObject.

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

        Attributes:
            display_date (int): The week number the player went on waivers (when applicable).
            ownership_type (str): The current location of the player in the league ("team", "waivers", etc.).
            owner_team_key (str): The Yahoo team key for the team that owns the player.
            owner_team_name (str): The team name for the team that owns the player.
            teams (list[Team]): A list of YFPY Team instances.
            waiver_date (str): The date the player went on waivers (when applicable).
        """
        YahooFantasyObject.__init__(self, extracted_data)
        self.display_date: Optional[int] = self._extracted_data.get("display_date", None)
        self.ownership_type: str = self._extracted_data.get("ownership_type", "")
        self.owner_team_key: str = self._extracted_data.get("owner_team_key", "")
        self.owner_team_name: str = self._extracted_data.get("owner_team_name", "")
        self.teams: List[Team] = self._extracted_data.get("teams", [])
        self.waiver_date: str = self._extracted_data.get("waiver_date", "")

__init__

__init__(extracted_data)

Instantiate the Ownership child class of YahooFantasyObject.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • display_date (int) –

    The week number the player went on waivers (when applicable).

  • ownership_type (str) –

    The current location of the player in the league ("team", "waivers", etc.).

  • owner_team_key (str) –

    The Yahoo team key for the team that owns the player.

  • owner_team_name (str) –

    The team name for the team that owns the player.

  • teams (list[Team]) –

    A list of YFPY Team instances.

  • waiver_date (str) –

    The date the player went on waivers (when applicable).

Source code in yfpy/models.py
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
def __init__(self, extracted_data):
    """Instantiate the Ownership child class of YahooFantasyObject.

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

    Attributes:
        display_date (int): The week number the player went on waivers (when applicable).
        ownership_type (str): The current location of the player in the league ("team", "waivers", etc.).
        owner_team_key (str): The Yahoo team key for the team that owns the player.
        owner_team_name (str): The team name for the team that owns the player.
        teams (list[Team]): A list of YFPY Team instances.
        waiver_date (str): The date the player went on waivers (when applicable).
    """
    YahooFantasyObject.__init__(self, extracted_data)
    self.display_date: Optional[int] = self._extracted_data.get("display_date", None)
    self.ownership_type: str = self._extracted_data.get("ownership_type", "")
    self.owner_team_key: str = self._extracted_data.get("owner_team_key", "")
    self.owner_team_name: str = self._extracted_data.get("owner_team_name", "")
    self.teams: List[Team] = self._extracted_data.get("teams", [])
    self.waiver_date: str = self._extracted_data.get("waiver_date", "")

PercentOwned

Bases: YahooFantasyObject

Model class for "percent_owned" data key.

Source code in yfpy/models.py
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
class PercentOwned(YahooFantasyObject):
    """Model class for "percent_owned" data key.
    """

    def __init__(self, extracted_data):
        """Instantiate the PercentOwned child class of YahooFantasyObject.

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

        Attributes:
            coverage_type (str): The timeframe for the selected player ownership ("week", "date", "season", etc.).
            week (int): The week number (when applicable).
            value (int): The percentage value the player is/was owned in the coverage timeframe.
            delta (float): The change in the percentage value from the previous coverage timeframe to the current
                coverage timeframe.
        """
        YahooFantasyObject.__init__(self, extracted_data)
        self.coverage_type: str = self._extracted_data.get("coverage_type", "")
        self.week: Optional[int] = self._extracted_data.get("week", None)
        self.value: int = self._get_nested_value(self._extracted_data, "value", 0, int)
        self.delta: float = self._get_nested_value(self._extracted_data, "delta", 0.0, float)

__init__

__init__(extracted_data)

Instantiate the PercentOwned child class of YahooFantasyObject.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • coverage_type (str) –

    The timeframe for the selected player ownership ("week", "date", "season", etc.).

  • week (int) –

    The week number (when applicable).

  • value (int) –

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

  • delta (float) –

    The change in the percentage value from the previous coverage timeframe to the current coverage timeframe.

Source code in yfpy/models.py
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
def __init__(self, extracted_data):
    """Instantiate the PercentOwned child class of YahooFantasyObject.

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

    Attributes:
        coverage_type (str): The timeframe for the selected player ownership ("week", "date", "season", etc.).
        week (int): The week number (when applicable).
        value (int): The percentage value the player is/was owned in the coverage timeframe.
        delta (float): The change in the percentage value from the previous coverage timeframe to the current
            coverage timeframe.
    """
    YahooFantasyObject.__init__(self, extracted_data)
    self.coverage_type: str = self._extracted_data.get("coverage_type", "")
    self.week: Optional[int] = self._extracted_data.get("week", None)
    self.value: int = self._get_nested_value(self._extracted_data, "value", 0, int)
    self.delta: float = self._get_nested_value(self._extracted_data, "delta", 0.0, float)

PlayerAdvancedStats

Bases: YahooFantasyObject

Model class for "player_advanced_stats" data key.

Source code in yfpy/models.py
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
class PlayerAdvancedStats(YahooFantasyObject):
    """Model class for "player_advanced_stats" data key.
    """

    def __init__(self, extracted_data):
        """Instantiate the PlayerAdvancedStats child class of YahooFantasyObject.

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

        Attributes:
            coverage_type (str): The timeframe for the selected player advanced stats ("week", "date", "season", etc.).
            season (int): The season year (when applicable).
            stats (list[Stat]): A list of advanced YFPY Stat instances for the player.
            week (int): The week number (when applicable).
        """
        YahooFantasyObject.__init__(self, extracted_data)
        self.coverage_type: str = self._extracted_data.get("coverage_type", "")
        self.season: Optional[int] = self._extracted_data.get("season", None)
        self.stats: List[Stat] = self._extracted_data.get("stats", [])
        self.week: Optional[int] = self._extracted_data.get("week", None)

__init__

__init__(extracted_data)

Instantiate the PlayerAdvancedStats child class of YahooFantasyObject.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • coverage_type (str) –

    The timeframe for the selected player advanced stats ("week", "date", "season", etc.).

  • season (int) –

    The season year (when applicable).

  • stats (list[Stat]) –

    A list of advanced YFPY Stat instances for the player.

  • week (int) –

    The week number (when applicable).

Source code in yfpy/models.py
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
def __init__(self, extracted_data):
    """Instantiate the PlayerAdvancedStats child class of YahooFantasyObject.

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

    Attributes:
        coverage_type (str): The timeframe for the selected player advanced stats ("week", "date", "season", etc.).
        season (int): The season year (when applicable).
        stats (list[Stat]): A list of advanced YFPY Stat instances for the player.
        week (int): The week number (when applicable).
    """
    YahooFantasyObject.__init__(self, extracted_data)
    self.coverage_type: str = self._extracted_data.get("coverage_type", "")
    self.season: Optional[int] = self._extracted_data.get("season", None)
    self.stats: List[Stat] = self._extracted_data.get("stats", [])
    self.week: Optional[int] = self._extracted_data.get("week", None)

PlayerPoints

Bases: YahooFantasyObject

Model class for "player_points" data key.

Source code in yfpy/models.py
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
class PlayerPoints(YahooFantasyObject):
    """Model class for "player_points" data key.
    """

    def __init__(self, extracted_data):
        """Instantiate the PlayerPoints child class of YahooFantasyObject.

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

        Attributes:
            coverage_type (str): The timeframe for the selected player points ("week", "date", "season", etc.).
            season (int): The season year (when applicable).
            total (float): The total points for the player within the coverage timeframe.
            week (int): The week number (when applicable).
        """
        YahooFantasyObject.__init__(self, extracted_data)
        self.coverage_type: str = self._extracted_data.get("coverage_type", "")
        self.season: Optional[int] = self._extracted_data.get("season", None)
        self.total: float = self._get_nested_value(self._extracted_data, "total", 0.0, float)
        self.week: Optional[int] = self._extracted_data.get("week", None)

__init__

__init__(extracted_data)

Instantiate the PlayerPoints child class of YahooFantasyObject.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • coverage_type (str) –

    The timeframe for the selected player points ("week", "date", "season", etc.).

  • season (int) –

    The season year (when applicable).

  • total (float) –

    The total points for the player within the coverage timeframe.

  • week (int) –

    The week number (when applicable).

Source code in yfpy/models.py
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
def __init__(self, extracted_data):
    """Instantiate the PlayerPoints child class of YahooFantasyObject.

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

    Attributes:
        coverage_type (str): The timeframe for the selected player points ("week", "date", "season", etc.).
        season (int): The season year (when applicable).
        total (float): The total points for the player within the coverage timeframe.
        week (int): The week number (when applicable).
    """
    YahooFantasyObject.__init__(self, extracted_data)
    self.coverage_type: str = self._extracted_data.get("coverage_type", "")
    self.season: Optional[int] = self._extracted_data.get("season", None)
    self.total: float = self._get_nested_value(self._extracted_data, "total", 0.0, float)
    self.week: Optional[int] = self._extracted_data.get("week", None)

PlayerStats

Bases: YahooFantasyObject

Model class for "player_stats" data key.

Source code in yfpy/models.py
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
class PlayerStats(YahooFantasyObject):
    """Model class for "player_stats" data key.
    """

    def __init__(self, extracted_data):
        """Instantiate the PlayerStats child class of YahooFantasyObject.

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

        Attributes:
            coverage_type (str): The timeframe for the selected player stats ("week", "date", "season", etc.).
            date (str): The YYYY-MM-DD formatted date string (when applicable).
            season (int): The season year (when applicable).
            stats (list[Stat]): A list of YFPY Stat instances for the player.
            week (int): The week number (when applicable).
        """
        YahooFantasyObject.__init__(self, extracted_data)
        self.coverage_type: str = self._extracted_data.get("coverage_type", "")
        self.date: str = self._extracted_data.get("date", "")
        self.season: Optional[int] = self._extracted_data.get("season", None)
        self.stats: List[Stat] = self._extracted_data.get("stats", [])
        self.week: Optional[int] = self._extracted_data.get("week", None)

__init__

__init__(extracted_data)

Instantiate the PlayerStats child class of YahooFantasyObject.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • coverage_type (str) –

    The timeframe for the selected player stats ("week", "date", "season", etc.).

  • date (str) –

    The YYYY-MM-DD formatted date string (when applicable).

  • season (int) –

    The season year (when applicable).

  • stats (list[Stat]) –

    A list of YFPY Stat instances for the player.

  • week (int) –

    The week number (when applicable).

Source code in yfpy/models.py
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
def __init__(self, extracted_data):
    """Instantiate the PlayerStats child class of YahooFantasyObject.

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

    Attributes:
        coverage_type (str): The timeframe for the selected player stats ("week", "date", "season", etc.).
        date (str): The YYYY-MM-DD formatted date string (when applicable).
        season (int): The season year (when applicable).
        stats (list[Stat]): A list of YFPY Stat instances for the player.
        week (int): The week number (when applicable).
    """
    YahooFantasyObject.__init__(self, extracted_data)
    self.coverage_type: str = self._extracted_data.get("coverage_type", "")
    self.date: str = self._extracted_data.get("date", "")
    self.season: Optional[int] = self._extracted_data.get("season", None)
    self.stats: List[Stat] = self._extracted_data.get("stats", [])
    self.week: Optional[int] = self._extracted_data.get("week", None)

SelectedPosition

Bases: YahooFantasyObject

Model class for "selected_position" data key.

Source code in yfpy/models.py
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
class SelectedPosition(YahooFantasyObject):
    """Model class for "selected_position" data key.
    """

    def __init__(self, extracted_data):
        """Instantiate the SelectedPosition child class of YahooFantasyObject.

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

        Attributes:
            coverage_type (str): The timeframe for the selected position ("week", "date", "season", etc.).
            date (str): The YYYY-MM-DD formatted date string (when applicable).
            is_flex (int): Numeric boolean (0 or 1) representing if the selected player is in a flex roster slot.
            position (str): The selected position of the player.
            week (int): The week number (when applicable).
        """
        YahooFantasyObject.__init__(self, extracted_data)
        self.coverage_type: str = self._extracted_data.get("coverage_type", "")
        self.date: str = self._extracted_data.get("date", "")
        self.is_flex: int = self._extracted_data.get("is_flex", 0)
        self.position: str = self._extracted_data.get("position", "")
        self.week: Optional[int] = self._extracted_data.get("week", None)

__init__

__init__(extracted_data)

Instantiate the SelectedPosition child class of YahooFantasyObject.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • coverage_type (str) –

    The timeframe for the selected position ("week", "date", "season", etc.).

  • date (str) –

    The YYYY-MM-DD formatted date string (when applicable).

  • is_flex (int) –

    Numeric boolean (0 or 1) representing if the selected player is in a flex roster slot.

  • position (str) –

    The selected position of the player.

  • week (int) –

    The week number (when applicable).

Source code in yfpy/models.py
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
def __init__(self, extracted_data):
    """Instantiate the SelectedPosition child class of YahooFantasyObject.

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

    Attributes:
        coverage_type (str): The timeframe for the selected position ("week", "date", "season", etc.).
        date (str): The YYYY-MM-DD formatted date string (when applicable).
        is_flex (int): Numeric boolean (0 or 1) representing if the selected player is in a flex roster slot.
        position (str): The selected position of the player.
        week (int): The week number (when applicable).
    """
    YahooFantasyObject.__init__(self, extracted_data)
    self.coverage_type: str = self._extracted_data.get("coverage_type", "")
    self.date: str = self._extracted_data.get("date", "")
    self.is_flex: int = self._extracted_data.get("is_flex", 0)
    self.position: str = self._extracted_data.get("position", "")
    self.week: Optional[int] = self._extracted_data.get("week", None)

TransactionData

Bases: YahooFantasyObject

Model class for "transaction_data" data key.

Source code in yfpy/models.py
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
class TransactionData(YahooFantasyObject):
    """Model class for "transaction_data" data key.
    """

    def __init__(self, extracted_data):
        """Instantiate the TransactionData child class of YahooFantasyObject.

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

        Attributes:
            destination_team_key (str): The Yahoo team key for the receiving team.
            destination_team_name (str): The name of the receiving team.
            destination_type (str): The destination of the player (waivers, free agency, another team, etc.).
            source_team_key (str): The Yahoo team key of the sending team.
            source_team_name (str): The name of the sending team.
            source_type (str): The origin of the player (waivers, free agency, another team, etc.).
            type (str): The type of the transaction ("add", "drop", "trade", etc.).
        """
        YahooFantasyObject.__init__(self, extracted_data)
        self.destination_team_key: str = self._extracted_data.get("destination_team_key", "")
        self.destination_team_name: str = self._extracted_data.get("destination_team_name", "")
        self.destination_type: str = self._extracted_data.get("destination_type", "")
        self.source_team_key: str = self._extracted_data.get("source_team_key", "")
        self.source_team_name: str = self._extracted_data.get("source_team_name", "")
        self.source_type: str = self._extracted_data.get("source_type", "")
        self.type: str = self._extracted_data.get("type", "")

__init__

__init__(extracted_data)

Instantiate the TransactionData child class of YahooFantasyObject.

Parameters:
  • extracted_data (dict) –

    Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

Attributes:
  • destination_team_key (str) –

    The Yahoo team key for the receiving team.

  • destination_team_name (str) –

    The name of the receiving team.

  • destination_type (str) –

    The destination of the player (waivers, free agency, another team, etc.).

  • source_team_key (str) –

    The Yahoo team key of the sending team.

  • source_team_name (str) –

    The name of the sending team.

  • source_type (str) –

    The origin of the player (waivers, free agency, another team, etc.).

  • type (str) –

    The type of the transaction ("add", "drop", "trade", etc.).

Source code in yfpy/models.py
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
def __init__(self, extracted_data):
    """Instantiate the TransactionData child class of YahooFantasyObject.

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

    Attributes:
        destination_team_key (str): The Yahoo team key for the receiving team.
        destination_team_name (str): The name of the receiving team.
        destination_type (str): The destination of the player (waivers, free agency, another team, etc.).
        source_team_key (str): The Yahoo team key of the sending team.
        source_team_name (str): The name of the sending team.
        source_type (str): The origin of the player (waivers, free agency, another team, etc.).
        type (str): The type of the transaction ("add", "drop", "trade", etc.).
    """
    YahooFantasyObject.__init__(self, extracted_data)
    self.destination_team_key: str = self._extracted_data.get("destination_team_key", "")
    self.destination_team_name: str = self._extracted_data.get("destination_team_name", "")
    self.destination_type: str = self._extracted_data.get("destination_type", "")
    self.source_team_key: str = self._extracted_data.get("source_team_key", "")
    self.source_team_name: str = self._extracted_data.get("source_team_name", "")
    self.source_type: str = self._extracted_data.get("source_type", "")
    self.type: str = self._extracted_data.get("type", "")