From b0af0f25a348d7c08c078b2d97e41293d1cad69f Mon Sep 17 00:00:00 2001 From: uberfastman <4575707+uberfastman@users.noreply.github.com> Date: Sun, 22 Sep 2024 21:55:13 -0400 Subject: [PATCH] update saving yahoo access token as json to replace saving fields to separate env vars --- DEPLOYMENT.md | 2 +- README.md | 20 ++ docs/CNAME | 1 - docs/index.html | 2 +- docs/query/index.html | 623 +++++++++++++++++----------------- docs/quickstart/index.html | 11 +- docs/readme/index.html | 20 ++ docs/search/search_index.json | 2 +- quickstart/quickstart.py | 11 +- yfpy/query.py | 30 +- 10 files changed, 388 insertions(+), 334 deletions(-) delete mode 100644 docs/CNAME diff --git a/DEPLOYMENT.md b/DEPLOYMENT.md index 090d12fe..ee196fba 100644 --- a/DEPLOYMENT.md +++ b/DEPLOYMENT.md @@ -86,7 +86,7 @@ make test_docs ``` -15. *(Optional)* Build the MkDocs documentation and PyPI package independent of deployment: +15. *(Optional)* Build the PyPI package and MkDocs documentation independent of deployment: ```shell make docs diff --git a/README.md b/README.md index 43bbdfa6..66ff79f4 100644 --- a/README.md +++ b/README.md @@ -204,6 +204,26 @@ query = YahooFantasySportsQuery( ##### Persistent Authentication Using Access Token JSON * YFPY *also* supports the use of a **single** environment variable by providing a valid JSON string in `YAHOO_ACCESS_TOKEN_JSON`. This environment variable is only used if `env_var_fallback=True` (default) when instantiating a YFPY query. +* You can save the Yahoo access token fields as valid JSON with escaped double quotes (`"`) by invoking `YahooFantasySportsQuery.save_access_token_data_to_env_file` with `save_json_to_var_only=True` (instead of saving the Yahoo access token fields to individual environment variables as described in [Persistent Authentication Using Access Token Fields](#persistent-authentication-using-access-token-fields)) like below: +```python +from pathlib import Path + +from yfpy.query import YahooFantasySportsQuery + +query = YahooFantasySportsQuery( + league_id="", + game_code="nfl", + game_id=449, + yahoo_consumer_key="", + yahoo_consumer_secret="", + env_file_location=Path(".env") +) + +query.save_access_token_data_to_env_file( + env_file_location=Path(".env"), + save_json_to_var_only=True +) +``` #### Querying the Yahoo Fantasy Sports API diff --git a/docs/CNAME b/docs/CNAME deleted file mode 100644 index cbeddb7d..00000000 --- a/docs/CNAME +++ /dev/null @@ -1 +0,0 @@ -yfpy.uberfastman.com \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 37ff3c69..0f9b29c9 100644 --- a/docs/index.html +++ b/docs/index.html @@ -162,5 +162,5 @@

Welcome to YFPY! 3195 3196 3197 -3198
class YahooFantasySportsQuery(object):
+3198
+3199
+3200
+3201
+3202
class YahooFantasySportsQuery(object):
     """Yahoo Fantasy Sports REST API query CLASS to retrieve all types of fantasy sports data.
     """
 
@@ -3710,23 +3714,25 @@ 

return env_file_content - def save_access_token_data_to_env_file(self, env_file_directory: Path, env_file_name: str = ".env", - save_json_to_var: bool = False) -> None: + def save_access_token_data_to_env_file(self, env_file_location: Path, env_file_name: str = ".env", + save_json_to_var_only: bool = False) -> None: """Saves the fields and values of a Yahoo access token into a .env file. Args: - env_file_directory (Path): The path to the directory where the target .env file is/will be located. + env_file_location (:obj:`Path`, optional): Path to directory where existing .env file is located or new .env + file should be generated. env_file_name (:obj:`str`, optional): The name of the target .env file (defaults to ".env"). - save_json_to_var (:obj:`bool`, optional): Boolean to determine whether or not to write a JSON string of + save_json_to_var_only (:obj:`bool`, optional): Boolean to determine whether or not to write a JSON string of Yahoo access token fields to a YAHOO_ACCESS_TOKEN_JSON environment variable in the target .env file + instead of writing Yahoo access token fields to separate environment variables in the target .env file. (defaults to False). Returns: None """ - if env_file_directory: - env_file_path = env_file_directory / env_file_name + if env_file_location: + env_file_path = env_file_location / env_file_name else: logger.warning("Missing argument env_file_location. Yahoo access token will NOT be saved to .env file.") # exit method without saving Yahoo access token data when no env_file_location argument is provided @@ -3734,14 +3740,16 @@

env_file_content = self._retrieve_env_file_contents(env_file_path) - # replace values of any matching environment variables in .env file with values from Yahoo access token fields - for k, v in self._yahoo_access_token_dict.items(): - env_file_content[f"yahoo_{k}"] = v - - # generate a JSON string with escaped double quotes using nested json.dumps() and write it to a - # YAHOO_ACCESS_TOKEN_JSON environment variable if save_json_to_var is set to True - if save_json_to_var: + if save_json_to_var_only: + # generate a JSON string with escaped double quotes using nested json.dumps() and write it to a + # YAHOO_ACCESS_TOKEN_JSON environment variable if save_json_to_var_only is set to True instead of writing + # Yahoo access token fields to separate environment variables in target .env file env_file_content["yahoo_access_token_json"] = json.dumps(json.dumps(self._yahoo_access_token_dict)) + else: + # replace values of any matching environment variables in .env file with values from Yahoo access token + # fields or add new environment variables to .env file if any fields are missing + for k, v in self._yahoo_access_token_dict.items(): + env_file_content[f"yahoo_{k}"] = v # write contents to .env file (overwrites contents if file exists or creates a new file if not) with open(env_file_path, "w") as env_file: @@ -7196,9 +7204,9 @@

save_access_token_data_to_env_file(
-    env_file_directory,
+    env_file_location,
     env_file_name=".env",
-    save_json_to_var=False,
+    save_json_to_var_only=False,
 )
 
@@ -7218,11 +7226,11 @@

  • - env_file_directory - (Path) + env_file_location
    -

    The path to the directory where the target .env file is/will be located.

    +

    obj:Path, optional): Path to directory where existing .env file is located or new .env +file should be generated.

  • @@ -7233,11 +7241,12 @@

  • - save_json_to_var + save_json_to_var_only

    obj:bool, optional): Boolean to determine whether or not to write a JSON string of Yahoo access token fields to a YAHOO_ACCESS_TOKEN_JSON environment variable in the target .env file +instead of writing Yahoo access token fields to separate environment variables in the target .env file. (defaults to False).

  • @@ -7312,23 +7321,29 @@

    412 413 414 -415

def save_access_token_data_to_env_file(self, env_file_directory: Path, env_file_name: str = ".env",
-                                       save_json_to_var: bool = False) -> None:
+415
+416
+417
+418
+419
def save_access_token_data_to_env_file(self, env_file_location: Path, env_file_name: str = ".env",
+                                       save_json_to_var_only: bool = False) -> None:
     """Saves the fields and values of a Yahoo access token into a .env file.
 
     Args:
-        env_file_directory (Path): The path to the directory where the target .env file is/will be located.
+        env_file_location (:obj:`Path`, optional): Path to directory where existing .env file is located or new .env
+            file should be generated.
         env_file_name (:obj:`str`, optional): The name of the target .env file (defaults to ".env").
-        save_json_to_var (:obj:`bool`, optional): Boolean to determine whether or not to write a JSON string of
+        save_json_to_var_only (:obj:`bool`, optional): Boolean to determine whether or not to write a JSON string of
             Yahoo access token fields to a YAHOO_ACCESS_TOKEN_JSON environment variable in the target .env file
+            instead of writing Yahoo access token fields to separate environment variables in the target .env file.
             (defaults to False).
 
     Returns:
         None
 
     """
-    if env_file_directory:
-        env_file_path = env_file_directory / env_file_name
+    if env_file_location:
+        env_file_path = env_file_location / env_file_name
     else:
         logger.warning("Missing argument env_file_location. Yahoo access token will NOT be saved to .env file.")
         # exit method without saving Yahoo access token data when no env_file_location argument is provided
@@ -7336,14 +7351,16 @@ 

env_file_content = self._retrieve_env_file_contents(env_file_path) - # replace values of any matching environment variables in .env file with values from Yahoo access token fields - for k, v in self._yahoo_access_token_dict.items(): - env_file_content[f"yahoo_{k}"] = v - - # generate a JSON string with escaped double quotes using nested json.dumps() and write it to a - # YAHOO_ACCESS_TOKEN_JSON environment variable if save_json_to_var is set to True - if save_json_to_var: + if save_json_to_var_only: + # generate a JSON string with escaped double quotes using nested json.dumps() and write it to a + # YAHOO_ACCESS_TOKEN_JSON environment variable if save_json_to_var_only is set to True instead of writing + # Yahoo access token fields to separate environment variables in target .env file env_file_content["yahoo_access_token_json"] = json.dumps(json.dumps(self._yahoo_access_token_dict)) + else: + # replace values of any matching environment variables in .env file with values from Yahoo access token + # fields or add new environment variables to .env file if any fields are missing + for k, v in self._yahoo_access_token_dict.items(): + env_file_content[f"yahoo_{k}"] = v # write contents to .env file (overwrites contents if file exists or creates a new file if not) with open(env_file_path, "w") as env_file: @@ -7424,11 +7441,7 @@

Source code in yfpy/query.py -
417
-418
-419
-420
-421
+              
421
 422
 423
 424
@@ -7493,7 +7506,11 @@ 

483 484 485 -486

def get_response(self, url: str) -> Response:
+486
+487
+488
+489
+490
def get_response(self, url: str) -> Response:
     """Retrieve Yahoo Fantasy Sports data from the REST API.
 
     Args:
@@ -7675,11 +7692,7 @@ 

Source code in yfpy/query.py -
489
-490
-491
-492
-493
+              
493
 494
 495
 496
@@ -7758,7 +7771,11 @@ 

569 570 571 -572

def query(self, url: str, data_key_list: Union[List[str], List[List[str]]], data_type_class: Type = None,
+572
+573
+574
+575
+576
def query(self, url: str, data_key_list: Union[List[str], List[List[str]]], data_type_class: Type = None,
           sort_function: Callable = None) -> (Union[str, YFO, List[YFO], Dict[str, YFO]]):
     """Base query class to retrieve requested data from the Yahoo fantasy sports REST API.
 
@@ -7912,11 +7929,7 @@ 

Source code in yfpy/query.py -
574
-575
-576
-577
-578
+              
578
 579
 580
 581
@@ -7945,7 +7958,11 @@ 

604 605 606 -607

def get_all_yahoo_fantasy_game_keys(self) -> List[Game]:
+607
+608
+609
+610
+611
def get_all_yahoo_fantasy_game_keys(self) -> List[Game]:
     """Retrieve all Yahoo Fantasy Sports game keys by ID (from year of inception to present), sorted by season/year.
 
     Examples:
@@ -8058,11 +8075,7 @@ 

Source code in yfpy/query.py -
610
-611
-612
-613
-614
+              
614
 615
 616
 617
@@ -8088,7 +8101,11 @@ 

637 638 639 -640

def get_game_key_by_season(self, season: int) -> str:
+640
+641
+642
+643
+644
def get_game_key_by_season(self, season: int) -> str:
     """Retrieve specific game key by season.
 
     Args:
@@ -8227,11 +8244,7 @@ 

Source code in yfpy/query.py -
642
-643
-644
-645
-646
+              
646
 647
 648
 649
@@ -8299,7 +8312,11 @@ 

711 712 713 -714

def get_current_game_info(self) -> Game:
+714
+715
+716
+717
+718
def get_current_game_info(self) -> Game:
     """Retrieve game info for current fantasy season.
 
     Examples:
@@ -8439,11 +8456,7 @@ 

Source code in yfpy/query.py -
716
-717
-718
-719
-720
+              
720
 721
 722
 723
@@ -8469,7 +8482,11 @@ 

743 744 745 -746

def get_current_game_metadata(self) -> Game:
+746
+747
+748
+749
+750
def get_current_game_metadata(self) -> Game:
     """Retrieve game metadata for current fantasy season.
 
     Examples:
@@ -8632,11 +8649,7 @@ 

Source code in yfpy/query.py -
748
-749
-750
-751
-752
+              
752
 753
 754
 755
@@ -8707,7 +8720,11 @@ 

820 821 822 -823

def get_game_info_by_game_id(self, game_id: int) -> Game:
+823
+824
+825
+826
+827
def get_game_info_by_game_id(self, game_id: int) -> Game:
     """Retrieve game info for specific game by ID.
 
     Args:
@@ -8873,11 +8890,7 @@ 

Source code in yfpy/query.py -
825
-826
-827
-828
-829
+              
829
 830
 831
 832
@@ -8905,7 +8918,11 @@ 

854 855 856 -857

def get_game_metadata_by_game_id(self, game_id: int) -> Game:
+857
+858
+859
+860
+861
def get_game_metadata_by_game_id(self, game_id: int) -> Game:
     """Retrieve game metadata for specific game by ID.
 
     Args:
@@ -9031,11 +9048,7 @@ 

Source code in yfpy/query.py -
859
-860
-861
-862
-863
+              
863
 864
 865
 866
@@ -9065,7 +9078,11 @@ 

890 891 892 -893

def get_game_weeks_by_game_id(self, game_id: int) -> List[GameWeek]:
+893
+894
+895
+896
+897
def get_game_weeks_by_game_id(self, game_id: int) -> List[GameWeek]:
     """Retrieve all valid weeks of a specific game by ID.
 
     Args:
@@ -9199,11 +9216,7 @@ 

Source code in yfpy/query.py -
895
-896
-897
-898
-899
+              
899
 900
 901
 902
@@ -9240,7 +9253,11 @@ 

933 934 935 -936

def get_game_stat_categories_by_game_id(self, game_id: int) -> StatCategories:
+936
+937
+938
+939
+940
def get_game_stat_categories_by_game_id(self, game_id: int) -> StatCategories:
     """Retrieve all valid stat categories of a specific game by ID.
 
     Args:
@@ -9371,11 +9388,7 @@ 

Source code in yfpy/query.py -
938
-939
-940
-941
-942
+              
942
 943
 944
 945
@@ -9402,7 +9415,11 @@ 

966 967 968 -969

def get_game_position_types_by_game_id(self, game_id: int) -> List[PositionType]:
+969
+970
+971
+972
+973
def get_game_position_types_by_game_id(self, game_id: int) -> List[PositionType]:
     """Retrieve all valid position types for specific game by ID sorted alphabetically by type.
 
     Args:
@@ -9522,11 +9539,7 @@ 

Source code in yfpy/query.py -
 971
- 972
- 973
- 974
- 975
+              
 975
  976
  977
  978
@@ -9552,7 +9565,11 @@ 

998 999 1000 -1001

def get_game_roster_positions_by_game_id(self, game_id: int) -> List[RosterPosition]:
+1001
+1002
+1003
+1004
+1005
def get_game_roster_positions_by_game_id(self, game_id: int) -> List[RosterPosition]:
     """Retrieve all valid roster positions for specific game by ID sorted alphabetically by position.
 
     Args:
@@ -9664,11 +9681,7 @@ 

Source code in yfpy/query.py -
1003
-1004
-1005
-1006
-1007
+              
1007
 1008
 1009
 1010
@@ -9691,7 +9704,11 @@ 

1027 1028 1029 -1030

def get_league_key(self, season: int = None) -> str:
+1030
+1031
+1032
+1033
+1034
def get_league_key(self, season: int = None) -> str:
     """Retrieve league key for selected league.
 
     Args:
@@ -9776,11 +9793,7 @@ 

Source code in yfpy/query.py -
1032
-1033
-1034
-1035
-1036
+              
1036
 1037
 1038
 1039
@@ -9796,7 +9809,11 @@ 

1049 1050 1051 -1052

def get_current_user(self) -> User:
+1052
+1053
+1054
+1055
+1056
def get_current_user(self) -> User:
     """Retrieve metadata for current logged-in user.
 
     Examples:
@@ -9887,11 +9904,7 @@ 

Source code in yfpy/query.py -
1054
-1055
-1056
-1057
-1058
+              
1058
 1059
 1060
 1061
@@ -9920,7 +9933,11 @@ 

1084 1085 1086 -1087

def get_user_games(self) -> List[Game]:
+1087
+1088
+1089
+1090
+1091
def get_user_games(self) -> List[Game]:
     """Retrieve game history for current logged-in user sorted by season/year.
 
     Examples:
@@ -10066,11 +10083,7 @@ 

Source code in yfpy/query.py -
1089
-1090
-1091
-1092
-1093
+              
1093
 1094
 1095
 1096
@@ -10121,7 +10134,11 @@ 

1141 1142 1143 -1144

def get_user_leagues_by_game_key(self, game_key: Union[int, str]) -> List[League]:
+1144
+1145
+1146
+1147
+1148
def get_user_leagues_by_game_key(self, game_key: Union[int, str]) -> List[League]:
     """Retrieve league history for current logged-in user for specific game by game IDs/keys sorted by season/year.
 
     Args:
@@ -10288,11 +10305,7 @@ 

Source code in yfpy/query.py -
1146
-1147
-1148
-1149
-1150
+              
1150
 1151
 1152
 1153
@@ -10362,7 +10375,11 @@ 

1217 1218 1219 -1220

def get_user_teams(self) -> List[Game]:
+1220
+1221
+1222
+1223
+1224
def get_user_teams(self) -> List[Game]:
     """Retrieve teams for all leagues for current logged-in user for current game sorted by season/year.
 
     Examples:
@@ -10535,11 +10552,7 @@ 

Source code in yfpy/query.py -
1222
-1223
-1224
-1225
-1226
+              
1226
 1227
 1228
 1229
@@ -10597,7 +10610,11 @@ 

1281 1282 1283 -1284

def get_league_info(self) -> League:
+1284
+1285
+1286
+1287
+1288
def get_league_info(self) -> League:
     """Retrieve info for chosen league.
 
     Examples:
@@ -10742,11 +10759,7 @@ 

Source code in yfpy/query.py -
1286
-1287
-1288
-1289
-1290
+              
1290
 1291
 1292
 1293
@@ -10787,7 +10800,11 @@ 

1328 1329 1330 -1331

def get_league_metadata(self) -> League:
+1331
+1332
+1333
+1334
+1335
def get_league_metadata(self) -> League:
     """Retrieve metadata for chosen league.
 
     Examples:
@@ -10956,11 +10973,7 @@ 

Source code in yfpy/query.py -
1333
-1334
-1335
-1336
-1337
+              
1337
 1338
 1339
 1340
@@ -11042,7 +11055,11 @@ 

1416 1417 1418 -1419

def get_league_settings(self) -> Settings:
+1419
+1420
+1421
+1422
+1423
def get_league_settings(self) -> Settings:
     """Retrieve settings (rules) for chosen league.
 
     Examples:
@@ -11245,11 +11262,7 @@ 

Source code in yfpy/query.py -
1421
-1422
-1423
-1424
-1425
+              
1425
 1426
 1427
 1428
@@ -11324,7 +11337,11 @@ 

1497 1498 1499 -1500

def get_league_standings(self) -> Standings:
+1500
+1501
+1502
+1503
+1504
def get_league_standings(self) -> Standings:
     """Retrieve standings for chosen league.
 
     Examples:
@@ -11496,11 +11513,7 @@ 

Source code in yfpy/query.py -
1502
-1503
-1504
-1505
-1506
+              
1506
 1507
 1508
 1509
@@ -11550,7 +11563,11 @@ 

1553 1554 1555 -1556

def get_league_teams(self) -> List[Team]:
+1556
+1557
+1558
+1559
+1560
def get_league_teams(self) -> List[Team]:
     """Retrieve teams for chosen league.
 
     Examples:
@@ -11748,11 +11765,7 @@ 

Source code in yfpy/query.py -
1558
-1559
-1560
-1561
-1562
+              
1562
 1563
 1564
 1565
@@ -11880,7 +11893,11 @@ 

1687 1688 1689 -1690

def get_league_players(self, player_count_limit: int = None, player_count_start: int = 0,
+1690
+1691
+1692
+1693
+1694
def get_league_players(self, player_count_limit: int = None, player_count_start: int = 0,
                        is_retry: bool = False) -> List[Player]:
     """Retrieve valid players for chosen league.
 
@@ -12077,11 +12094,7 @@ 

Source code in yfpy/query.py -
1692
-1693
-1694
-1695
-1696
+              
1696
 1697
 1698
 1699
@@ -12103,7 +12116,11 @@ 

1715 1716 1717 -1718

def get_league_draft_results(self) -> List[DraftResult]:
+1718
+1719
+1720
+1721
+1722
def get_league_draft_results(self) -> List[DraftResult]:
     """Retrieve draft results for chosen league.
 
     Examples:
@@ -12220,11 +12237,7 @@ 

Source code in yfpy/query.py -
1720
-1721
-1722
-1723
-1724
+              
1724
 1725
 1726
 1727
@@ -12272,7 +12285,11 @@ 

1769 1770 1771 -1772

def get_league_transactions(self) -> List[Transaction]:
+1772
+1773
+1774
+1775
+1776
def get_league_transactions(self) -> List[Transaction]:
     """Retrieve transactions for chosen league.
 
     Examples:
@@ -12452,11 +12469,7 @@ 

Source code in yfpy/query.py -
1774
-1775
-1776
-1777
-1778
+              
1778
 1779
 1780
 1781
@@ -12522,7 +12535,11 @@ 

1841 1842 1843 -1844

def get_league_scoreboard_by_week(self, chosen_week: int) -> Scoreboard:
+1844
+1845
+1846
+1847
+1848
def get_league_scoreboard_by_week(self, chosen_week: int) -> Scoreboard:
     """Retrieve scoreboard for chosen league by week.
 
     Args:
@@ -12716,11 +12733,7 @@ 

Source code in yfpy/query.py -
1846
-1847
-1848
-1849
-1850
+              
1850
 1851
 1852
 1853
@@ -12781,7 +12794,11 @@ 

1908 1909 1910 -1911

def get_league_matchups_by_week(self, chosen_week: int) -> List[Matchup]:
+1911
+1912
+1913
+1914
+1915
def get_league_matchups_by_week(self, chosen_week: int) -> List[Matchup]:
     """Retrieve matchups for chosen league by week.
 
     Args:
@@ -12989,11 +13006,7 @@ 

Source code in yfpy/query.py -
1913
-1914
-1915
-1916
-1917
+              
1917
 1918
 1919
 1920
@@ -13075,7 +13088,11 @@ 

1996 1997 1998 -1999

def get_team_info(self, team_id: Union[str, int]) -> Team:
+1999
+2000
+2001
+2002
+2003
def get_team_info(self, team_id: Union[str, int]) -> Team:
     """Retrieve info of specific team by team_id for chosen league.
 
     Args:
@@ -13274,11 +13291,7 @@ 

Source code in yfpy/query.py -
2001
-2002
-2003
-2004
-2005
+              
2005
 2006
 2007
 2008
@@ -13329,7 +13342,11 @@ 

2053 2054 2055 -2056

def get_team_metadata(self, team_id: Union[str, int]) -> Team:
+2056
+2057
+2058
+2059
+2060
def get_team_metadata(self, team_id: Union[str, int]) -> Team:
     """Retrieve metadata of specific team by team_id for chosen league.
 
     Args:
@@ -13469,11 +13486,7 @@ 

Source code in yfpy/query.py -
2058
-2059
-2060
-2061
-2062
+              
2062
 2063
 2064
 2065
@@ -13496,7 +13509,11 @@ 

2082 2083 2084 -2085

def get_team_stats(self, team_id: Union[str, int]) -> TeamPoints:
+2085
+2086
+2087
+2088
+2089
def get_team_stats(self, team_id: Union[str, int]) -> TeamPoints:
     """Retrieve stats of specific team by team_id for chosen league.
 
     Args:
@@ -13626,11 +13643,7 @@ 

Source code in yfpy/query.py -
2087
-2088
-2089
-2090
-2091
+              
2091
 2092
 2093
 2094
@@ -13663,7 +13676,11 @@ 

2121 2122 2123 -2124

def get_team_stats_by_week(
+2124
+2125
+2126
+2127
+2128
def get_team_stats_by_week(
         self, team_id: Union[str, int], chosen_week: Union[int, str] = "current"
 ) -> Dict[str, Union[TeamPoints, TeamProjectedPoints]]:
     """Retrieve stats of specific team by team_id and by week for chosen league.
@@ -13796,11 +13813,7 @@ 

Source code in yfpy/query.py -
2126
-2127
-2128
-2129
-2130
+              
2130
 2131
 2132
 2133
@@ -13834,7 +13847,11 @@ 

2161 2162 2163 -2164

def get_team_standings(self, team_id: Union[str, int]) -> TeamStandings:
+2164
+2165
+2166
+2167
+2168
def get_team_standings(self, team_id: Union[str, int]) -> TeamStandings:
     """Retrieve standings of specific team by team_id for chosen league.
 
     Args:
@@ -14012,11 +14029,7 @@ 

Source code in yfpy/query.py -
2166
-2167
-2168
-2169
-2170
+              
2170
 2171
 2172
 2173
@@ -14085,7 +14098,11 @@ 

2236 2237 2238 -2239

def get_team_roster_by_week(self, team_id: Union[str, int], chosen_week: Union[int, str] = "current") -> Roster:
+2239
+2240
+2241
+2242
+2243
def get_team_roster_by_week(self, team_id: Union[str, int], chosen_week: Union[int, str] = "current") -> Roster:
     """Retrieve roster of specific team by team_id and by week for chosen league.
 
     Args:
@@ -14330,11 +14347,7 @@ 

Source code in yfpy/query.py -
2241
-2242
-2243
-2244
-2245
+              
2245
 2246
 2247
 2248
@@ -14434,7 +14447,11 @@ 

2342 2343 2344 -2345

def get_team_roster_player_info_by_week(self, team_id: Union[str, int],
+2345
+2346
+2347
+2348
+2349
def get_team_roster_player_info_by_week(self, team_id: Union[str, int],
                                         chosen_week: Union[int, str] = "current") -> List[Player]:
     """Retrieve roster with ALL player info of specific team by team_id and by week for chosen league.
 
@@ -14708,11 +14725,7 @@ 

Source code in yfpy/query.py -
2347
-2348
-2349
-2350
-2351
+              
2351
 2352
 2353
 2354
@@ -14809,7 +14822,11 @@ 

2445 2446 2447 -2448

def get_team_roster_player_info_by_date(self, team_id: Union[str, int],
+2448
+2449
+2450
+2451
+2452
def get_team_roster_player_info_by_date(self, team_id: Union[str, int],
                                         chosen_date: str = None) -> List[Player]:
     """Retrieve roster with ALL player info of specific team by team_id and by date for chosen league.
 
@@ -15057,11 +15074,7 @@ 

Source code in yfpy/query.py -
2450
-2451
-2452
-2453
-2454
+              
2454
 2455
 2456
 2457
@@ -15145,7 +15158,11 @@ 

2535 2536 2537 -2538

def get_team_roster_player_stats(self, team_id: Union[str, int]) -> List[Player]:
+2538
+2539
+2540
+2541
+2542
def get_team_roster_player_stats(self, team_id: Union[str, int]) -> List[Player]:
     """Retrieve roster with ALL player info for the season of specific team by team_id and for chosen league.
 
     Args:
@@ -15387,11 +15404,7 @@ 

Source code in yfpy/query.py -
2540
-2541
-2542
-2543
-2544
+              
2544
 2545
 2546
 2547
@@ -15472,7 +15485,11 @@ 

2622 2623 2624 -2625

def get_team_roster_player_stats_by_week(self, team_id: Union[str, int],
+2625
+2626
+2627
+2628
+2629
def get_team_roster_player_stats_by_week(self, team_id: Union[str, int],
                                          chosen_week: Union[int, str] = "current") -> List[Player]:
     """Retrieve roster with player stats of specific team by team_id and by week for chosen league.
 
@@ -15647,11 +15664,7 @@ 

Source code in yfpy/query.py -
2627
-2628
-2629
-2630
-2631
+              
2631
 2632
 2633
 2634
@@ -15678,7 +15691,11 @@ 

2655 2656 2657 -2658

def get_team_draft_results(self, team_id: Union[str, int]) -> List[DraftResult]:
+2658
+2659
+2660
+2661
+2662
def get_team_draft_results(self, team_id: Union[str, int]) -> List[DraftResult]:
     """Retrieve draft results of specific team by team_id for chosen league.
 
     Args:
@@ -15794,11 +15811,7 @@ 

Source code in yfpy/query.py -
2660
-2661
-2662
-2663
-2664
+              
2664
 2665
 2666
 2667
@@ -15820,7 +15833,11 @@ 

2683 2684 2685 -2686

def get_team_matchups(self, team_id: Union[str, int]) -> List[Matchup]:
+2686
+2687
+2688
+2689
+2690
def get_team_matchups(self, team_id: Union[str, int]) -> List[Matchup]:
     """Retrieve matchups of specific team by team_id for chosen league.
 
     Args:
@@ -15988,11 +16005,7 @@ 

Source code in yfpy/query.py -
2688
-2689
-2690
-2691
-2692
+              
2692
 2693
 2694
 2695
@@ -16069,7 +16082,11 @@ 

2766 2767 2768 -2769

def get_player_stats_for_season(self, player_key: str, limit_to_league_stats: bool = True) -> Player:
+2769
+2770
+2771
+2772
+2773
def get_player_stats_for_season(self, player_key: str, limit_to_league_stats: bool = True) -> Player:
     """Retrieve stats of specific player by player_key for the entire season for chosen league.
 
     Args:
@@ -16306,11 +16323,7 @@ 

Source code in yfpy/query.py -
2771
-2772
-2773
-2774
-2775
+              
2775
 2776
 2777
 2778
@@ -16391,7 +16404,11 @@ 

2853 2854 2855 -2856

def get_player_stats_by_week(self, player_key: str, chosen_week: Union[int, str] = "current",
+2856
+2857
+2858
+2859
+2860
def get_player_stats_by_week(self, player_key: str, chosen_week: Union[int, str] = "current",
                              limit_to_league_stats: bool = True) -> Player:
     """Retrieve stats of specific player by player_key and by week for chosen league.
 
@@ -16662,11 +16679,7 @@ 

Source code in yfpy/query.py -
2858
-2859
-2860
-2861
-2862
+              
2862
 2863
 2864
 2865
@@ -16777,7 +16790,11 @@ 

2970 2971 2972 -2973

def get_player_stats_by_date(self, player_key: str, chosen_date: str = None,
+2973
+2974
+2975
+2976
+2977
def get_player_stats_by_date(self, player_key: str, chosen_date: str = None,
                              limit_to_league_stats: bool = True) -> Player:
     """Retrieve player stats by player_key and by date for chosen league.
 
@@ -17046,11 +17063,7 @@ 

Source code in yfpy/query.py -
2975
-2976
-2977
-2978
-2979
+              
2979
 2980
 2981
 2982
@@ -17142,7 +17155,11 @@ 

3068 3069 3070 -3071

def get_player_ownership(self, player_key: str) -> Player:
+3071
+3072
+3073
+3074
+3075
def get_player_ownership(self, player_key: str) -> Player:
     """Retrieve ownership of specific player by player_key for chosen league.
 
     Args:
@@ -17369,11 +17386,7 @@ 

Source code in yfpy/query.py -
3073
-3074
-3075
-3076
-3077
+              
3077
 3078
 3079
 3080
@@ -17431,7 +17444,11 @@ 

3132 3133 3134 -3135

def get_player_percent_owned_by_week(self, player_key: str, chosen_week: Union[int, str] = "current") -> Player:
+3135
+3136
+3137
+3138
+3139
def get_player_percent_owned_by_week(self, player_key: str, chosen_week: Union[int, str] = "current") -> Player:
     """Retrieve percent-owned of specific player by player_key and by week for chosen league.
 
     Args:
@@ -17612,11 +17629,7 @@ 

Source code in yfpy/query.py -
3137
-3138
-3139
-3140
-3141
+              
3141
 3142
 3143
 3144
@@ -17673,7 +17686,11 @@ 

3195 3196 3197 -3198

def get_player_draft_analysis(self, player_key: str) -> Player:
+3198
+3199
+3200
+3201
+3202
def get_player_draft_analysis(self, player_key: str) -> Player:
     """Retrieve draft analysis of specific player by player_key for chosen league.
 
     Args:
diff --git a/docs/quickstart/index.html b/docs/quickstart/index.html
index ca4dc5a2..3b935331 100644
--- a/docs/quickstart/index.html
+++ b/docs/quickstart/index.html
@@ -378,18 +378,15 @@
 query = YahooFantasySportsQuery(
     test_league_id,
     test_game_code,
-    test_game_id,
+    game_id=test_game_id,
     yahoo_consumer_key=os.environ.get("YAHOO_CONSUMER_KEY"),
     yahoo_consumer_secret=os.environ.get("YAHOO_CONSUMER_SECRET"),
     # yahoo_access_token_json=os.environ.get("YAHOO_ACCESS_TOKEN_JSON"),
-    env_var_fallback=True,
-    env_file_location=Path(__file__).parent.parent,
-    save_token_data_to_env_file=True,
-    all_output_as_json_str=False,
-    offline=False
+    env_file_location=project_dir,
+    save_token_data_to_env_file=True
 )
 
-# query.save_access_token_data_to_env_file(project_dir, save_json_to_var=True)
+# query.save_access_token_data_to_env_file(project_dir, save_json_to_var_only=True)
 
 # Manually override league key for example code to work
 query.league_key = f"{test_game_id}.l.{test_league_id}"
diff --git a/docs/readme/index.html b/docs/readme/index.html
index 4b2c7642..ae820ba2 100644
--- a/docs/readme/index.html
+++ b/docs/readme/index.html
@@ -389,7 +389,27 @@ 
Persistent Authenti
Persistent Authentication Using Access Token JSON
  • YFPY also supports the use of a single environment variable by providing a valid JSON string in YAHOO_ACCESS_TOKEN_JSON. This environment variable is only used if env_var_fallback=True (default) when instantiating a YFPY query.
  • +
  • You can save the Yahoo access token fields as valid JSON with escaped double quotes (") by invoking YahooFantasySportsQuery.save_access_token_data_to_env_file with save_json_to_var_only=True (instead of saving the Yahoo access token fields to individual environment variables as described in Persistent Authentication Using Access Token Fields) like below:
+
from pathlib import Path
+
+from yfpy.query import YahooFantasySportsQuery
+
+query = YahooFantasySportsQuery(
+    league_id="<YAHOO_LEAGUE_ID>",
+    game_code="nfl",
+    game_id=449,
+    yahoo_consumer_key="<YAHOO_CONSUMER_KEY>",
+    yahoo_consumer_secret="<YAHOO_CONSUMER_SECRET>",
+    env_file_location=Path(".env")
+)
+
+query.save_access_token_data_to_env_file(
+    env_file_location=Path(".env"), 
+    save_json_to_var_only=True
+)
+
+

Querying the Yahoo Fantasy Sports API

    diff --git a/docs/search/search_index.json b/docs/search/search_index.json index 0b0cbf25..eb9887d0 100644 --- a/docs/search/search_index.json +++ b/docs/search/search_index.json @@ -1 +1 @@ -{"config":{"indexing":"full","lang":["en"],"min_search_length":3,"prebuild_index":false,"separator":"[\\s\\-]+"},"docs":[{"location":"","text":"Welcome to YFPY! \u00b6 Please check out the README to get started!","title":"Welcome"},{"location":"#welcome-to-yfpy","text":"Please check out the README to get started!","title":"Welcome to YFPY!"},{"location":"data/","text":"Data \u00b6 YFPY module for retrieving, saving, and loading all Yahoo Fantasy Sports data. This module is designed to allow for easy data management, such that both retrieving and managing Yahoo Fantasy Sports data can be done in one place without the need to manually run the queries and manage data saved to JSON files. Example The Data module can be used as follows:: yahoo_query = YahooFantasySportsQuery ( \"\" , \"\" , game_id = \"\" , yahoo_consumer_key = os . environ . get ( \"YFPY_CONSUMER_KEY\" ), yahoo_consumer_secret = os . environ . get ( \"YFPY_CONSUMER_SECRET\" ), all_output_as_json_str = False , browser_callback = True , offline = False ) data_directory = Path ( __file__ ) . parent / \"output\" data = Data ( data_dir ) data . save ( \"file_name\" , yahoo_query . get_all_yahoo_fantasy_game_keys ) data . load ( \"file_name\" ) Attributes: logger ( Logger ) \u2013 Module level logger for usage and debugging. Data \u00b6 Bases: object YFPY Data object for Yahoo Fantasy Sports data retrieval, saving, and loading data as JSON. Source code in yfpy/data.py 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 227 228 class Data ( object ): \"\"\"YFPY Data object for Yahoo Fantasy Sports data retrieval, saving, and loading data as JSON. \"\"\" YFO = TypeVar ( \"YFO\" , bound = YahooFantasyObject ) def __init__ ( self , data_dir : Union [ Path , str ], save_data : bool = False , dev_offline : bool = False ): \"\"\"Instantiate data object to retrieve, save, and load Yahoo Fantasy Sports data. Args: data_dir (Path | str): Directory path where data will be saved/loaded. save_data (bool, optional): Boolean determining whether data is saved after retrieval from the Yahoo FF API. dev_offline (bool, optional): Boolean for offline development (requires a prior online run with save_data = True). \"\"\" self . data_dir : Path = data_dir if isinstance ( data_dir , PosixPath ) else Path ( data_dir ) self . save_data : bool = save_data self . dev_offline : bool = dev_offline def update_data_dir ( self , new_save_dir : Union [ Path , str ]) -> None : \"\"\"Modify the data storage directory if it needs to be updated. Args: new_save_dir (str | Path): Full path to new desired directory where data will be saved/loaded. Returns: None \"\"\" self . data_dir : Path = new_save_dir if isinstance ( new_save_dir , PosixPath ) else Path ( new_save_dir ) @staticmethod def fetch ( yf_query : Callable , params : Union [ Dict [ str , str ], None ] = None ) -> Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]]: \"\"\"Run query to retrieve Yahoo Fantasy Sports data. Args: yf_query (Callable of YahooFantasySportsQuery): Chosen yfpy query method to run. params (dict of str: str, optional): Dictionary of parameters to be passed to chosen yfpy query function. Returns: object: Data retrieved by the yfpy query. \"\"\" if params : return yf_query ( ** params ) else : return yf_query () def save ( self , file_name : str , yf_query : Callable , params : Union [ Dict [ str , Any ], None ] = None , new_data_dir : Union [ Path , str , None ] = None ) -> Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]]: \"\"\"Retrieve and save Yahoo Fantasy Sports data locally. Args: file_name (str): Name of file to which data will be saved. yf_query (Callable of YahooFantasySportsQuery): Chosen yfpy query method to run. params (dict of str: str, optional): Dictionary of parameters to be passed to chosen yfpy query function. new_data_dir (str | Path, optional): Full path to new desired directory to which data will be saved. Returns: object: Data retrieved by the yfpy query. \"\"\" # change data save directory if new_data_dir : new_data_dir = new_data_dir if isinstance ( new_data_dir , PosixPath ) else Path ( new_data_dir ) logger . debug ( f \"Data directory changed from { self . data_dir } to { new_data_dir } .\" ) self . update_data_dir ( new_data_dir ) # create full directory path if any directories in it do not already exist if not self . data_dir . exists (): self . data_dir . mkdir ( parents = True , exist_ok = True ) # check if parent YahooFantasySportsQuery.all_output_as_json_str = True, unset it for data saving, then reset it all_output_as_json = False # noinspection PyUnresolvedReferences if yf_query . __self__ . all_output_as_json_str : if inspect . ismethod ( yf_query ): # noinspection PyUnresolvedReferences for cls in inspect . getmro ( yf_query . __self__ . __class__ ): if yf_query . __name__ in cls . __dict__ : # noinspection PyUnresolvedReferences yf_query . __self__ . all_output_as_json_str = False all_output_as_json = True # run the actual yfpy query and retrieve the query results data = self . fetch ( yf_query , params ) # save the retrieved data locally saved_data_file_path = self . data_dir / f \" { file_name } .json\" with open ( saved_data_file_path , \"w\" , encoding = \"utf-8\" ) as data_file : if isinstance ( data , list ): # unflatten list of object values to list of single-key dictionaries with object values if top level of # data to be saved is a list unnested_data = [{ snakecase ( el . __class__ . __name__ ): el } for el in data ] else : unnested_data = data jsonify_data_to_file ( unnested_data , data_file ) logger . debug ( f \"Data saved locally to: { saved_data_file_path } \" ) # reset parent YahooFantasySportsQuery all_output_as_json_str = True and re-run query for json string return if all_output_as_json : # noinspection PyUnresolvedReferences yf_query . __self__ . all_output_as_json_str = True # data = self.get(yf_query, params) data = jsonify_data ( data ) return data def load ( self , file_name : str , data_type_class : Type [ YahooFantasyObject ] = None , new_data_dir : Union [ Path , str , None ] = None , all_output_as_json_str : bool = False ) -> Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]]: \"\"\"Load Yahoo Fantasy Sports data already stored locally. Note: This method will fail if the `save` method has not been called previously. Args: file_name (str): Name of file from which data will be loaded. data_type_class (Type[YahooFantasyObject], optional): YFPY models.py class for data casting. new_data_dir (str | Path, optional): Full path to new desired directory from which data will be loaded. all_output_as_json_str (bool): Boolean indicating if the output has been requested as a raw JSON string. Returns: object: Data loaded from the selected JSON file. \"\"\" # change data load directory if new_data_dir : new_data_dir = new_data_dir if isinstance ( new_data_dir , PosixPath ) else Path ( new_data_dir ) self . update_data_dir ( new_data_dir ) # load selected data file saved_data_file_path = self . data_dir / f \" { file_name } .json\" if saved_data_file_path . exists (): with open ( saved_data_file_path , \"r\" , encoding = \"utf-8\" ) as data_file : unpacked = unpack_data ( json . load ( data_file ), YahooFantasyObject ) data = data_type_class ( unpacked ) if data_type_class else unpacked if isinstance ( data , list ): # flatten list of single-key dictionaries with object values to list of object values if top level # of loaded data is a list data_element_key = list ( data [ 0 ] . keys ())[ 0 ] data = [ el [ data_element_key ] for el in data ] logger . debug ( f \"Data loaded locally from: { saved_data_file_path } \" ) else : raise FileNotFoundError ( f \"File { saved_data_file_path } does not exist. Cannot load data locally without \" f \"having previously saved data.\" ) if all_output_as_json_str : return jsonify_data ( data ) else : return data def retrieve ( self , file_name : str , yf_query : Callable , params : Union [ Dict [ str , str ], None ] = None , data_type_class : Type [ YahooFantasyObject ] = None , new_data_dir : Union [ Path , str , None ] = None ) -> Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]]: \"\"\"Fetch data from the web or load it locally (combination of the save and load methods). Args: file_name (str): Name of file to/from which data will be saved/loaded. yf_query (Callable of YahooFantasySportsQuery): Chosen yfpy query method to run. params (dict of str: str, optional): Dictionary of parameters to be passed to chosen yfpy query function. data_type_class (Type[YahooFantasyObject], optional): YFPY models.py class for data casting. new_data_dir (str | Path, optional): Full path to new desired directory to/from which data will be saved/loaded. Returns: object: Data retrieved by the yfpy query OR loaded from the selected JSON file. \"\"\" if self . dev_offline : return self . load ( file_name , data_type_class , new_data_dir ) else : if self . save_data : return self . save ( file_name , yf_query , params , new_data_dir ) else : return self . fetch ( yf_query , params ) __init__ \u00b6 __init__ ( data_dir , save_data = False , dev_offline = False ) Instantiate data object to retrieve, save, and load Yahoo Fantasy Sports data. Parameters: data_dir ( Path | str ) \u2013 Directory path where data will be saved/loaded. save_data ( bool , default: False ) \u2013 Boolean determining whether data is saved after retrieval from the Yahoo FF API. dev_offline ( bool , default: False ) \u2013 Boolean for offline development (requires a prior online run with save_data = True). Source code in yfpy/data.py 54 55 56 57 58 59 60 61 62 63 64 65 66 def __init__ ( self , data_dir : Union [ Path , str ], save_data : bool = False , dev_offline : bool = False ): \"\"\"Instantiate data object to retrieve, save, and load Yahoo Fantasy Sports data. Args: data_dir (Path | str): Directory path where data will be saved/loaded. save_data (bool, optional): Boolean determining whether data is saved after retrieval from the Yahoo FF API. dev_offline (bool, optional): Boolean for offline development (requires a prior online run with save_data = True). \"\"\" self . data_dir : Path = data_dir if isinstance ( data_dir , PosixPath ) else Path ( data_dir ) self . save_data : bool = save_data self . dev_offline : bool = dev_offline update_data_dir \u00b6 update_data_dir ( new_save_dir ) Modify the data storage directory if it needs to be updated. Parameters: new_save_dir ( str | Path ) \u2013 Full path to new desired directory where data will be saved/loaded. Returns: None \u2013 None Source code in yfpy/data.py 68 69 70 71 72 73 74 75 76 77 78 def update_data_dir ( self , new_save_dir : Union [ Path , str ]) -> None : \"\"\"Modify the data storage directory if it needs to be updated. Args: new_save_dir (str | Path): Full path to new desired directory where data will be saved/loaded. Returns: None \"\"\" self . data_dir : Path = new_save_dir if isinstance ( new_save_dir , PosixPath ) else Path ( new_save_dir ) fetch staticmethod \u00b6 fetch ( yf_query , params = None ) Run query to retrieve Yahoo Fantasy Sports data. Parameters: yf_query ( Callable of YahooFantasySportsQuery ) \u2013 Chosen yfpy query method to run. params ( dict of str , default: None ) \u2013 str, optional): Dictionary of parameters to be passed to chosen yfpy query function. Returns: object ( Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]] ) \u2013 Data retrieved by the yfpy query. Source code in yfpy/data.py 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 @staticmethod def fetch ( yf_query : Callable , params : Union [ Dict [ str , str ], None ] = None ) -> Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]]: \"\"\"Run query to retrieve Yahoo Fantasy Sports data. Args: yf_query (Callable of YahooFantasySportsQuery): Chosen yfpy query method to run. params (dict of str: str, optional): Dictionary of parameters to be passed to chosen yfpy query function. Returns: object: Data retrieved by the yfpy query. \"\"\" if params : return yf_query ( ** params ) else : return yf_query () save \u00b6 save ( file_name , yf_query , params = None , new_data_dir = None ) Retrieve and save Yahoo Fantasy Sports data locally. Parameters: file_name ( str ) \u2013 Name of file to which data will be saved. yf_query ( Callable of YahooFantasySportsQuery ) \u2013 Chosen yfpy query method to run. params ( dict of str , default: None ) \u2013 str, optional): Dictionary of parameters to be passed to chosen yfpy query function. new_data_dir ( str | Path , default: None ) \u2013 Full path to new desired directory to which data will be saved. Returns: object ( Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]] ) \u2013 Data retrieved by the yfpy query. Source code in yfpy/data.py 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 def save ( self , file_name : str , yf_query : Callable , params : Union [ Dict [ str , Any ], None ] = None , new_data_dir : Union [ Path , str , None ] = None ) -> Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]]: \"\"\"Retrieve and save Yahoo Fantasy Sports data locally. Args: file_name (str): Name of file to which data will be saved. yf_query (Callable of YahooFantasySportsQuery): Chosen yfpy query method to run. params (dict of str: str, optional): Dictionary of parameters to be passed to chosen yfpy query function. new_data_dir (str | Path, optional): Full path to new desired directory to which data will be saved. Returns: object: Data retrieved by the yfpy query. \"\"\" # change data save directory if new_data_dir : new_data_dir = new_data_dir if isinstance ( new_data_dir , PosixPath ) else Path ( new_data_dir ) logger . debug ( f \"Data directory changed from { self . data_dir } to { new_data_dir } .\" ) self . update_data_dir ( new_data_dir ) # create full directory path if any directories in it do not already exist if not self . data_dir . exists (): self . data_dir . mkdir ( parents = True , exist_ok = True ) # check if parent YahooFantasySportsQuery.all_output_as_json_str = True, unset it for data saving, then reset it all_output_as_json = False # noinspection PyUnresolvedReferences if yf_query . __self__ . all_output_as_json_str : if inspect . ismethod ( yf_query ): # noinspection PyUnresolvedReferences for cls in inspect . getmro ( yf_query . __self__ . __class__ ): if yf_query . __name__ in cls . __dict__ : # noinspection PyUnresolvedReferences yf_query . __self__ . all_output_as_json_str = False all_output_as_json = True # run the actual yfpy query and retrieve the query results data = self . fetch ( yf_query , params ) # save the retrieved data locally saved_data_file_path = self . data_dir / f \" { file_name } .json\" with open ( saved_data_file_path , \"w\" , encoding = \"utf-8\" ) as data_file : if isinstance ( data , list ): # unflatten list of object values to list of single-key dictionaries with object values if top level of # data to be saved is a list unnested_data = [{ snakecase ( el . __class__ . __name__ ): el } for el in data ] else : unnested_data = data jsonify_data_to_file ( unnested_data , data_file ) logger . debug ( f \"Data saved locally to: { saved_data_file_path } \" ) # reset parent YahooFantasySportsQuery all_output_as_json_str = True and re-run query for json string return if all_output_as_json : # noinspection PyUnresolvedReferences yf_query . __self__ . all_output_as_json_str = True # data = self.get(yf_query, params) data = jsonify_data ( data ) return data load \u00b6 load ( file_name , data_type_class = None , new_data_dir = None , all_output_as_json_str = False , ) Load Yahoo Fantasy Sports data already stored locally. Note This method will fail if the save method has not been called previously. Parameters: file_name ( str ) \u2013 Name of file from which data will be loaded. data_type_class ( Type [ YahooFantasyObject ] , default: None ) \u2013 YFPY models.py class for data casting. new_data_dir ( str | Path , default: None ) \u2013 Full path to new desired directory from which data will be loaded. all_output_as_json_str ( bool , default: False ) \u2013 Boolean indicating if the output has been requested as a raw JSON string. Returns: object ( Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]] ) \u2013 Data loaded from the selected JSON file. Source code in yfpy/data.py 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 def load ( self , file_name : str , data_type_class : Type [ YahooFantasyObject ] = None , new_data_dir : Union [ Path , str , None ] = None , all_output_as_json_str : bool = False ) -> Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]]: \"\"\"Load Yahoo Fantasy Sports data already stored locally. Note: This method will fail if the `save` method has not been called previously. Args: file_name (str): Name of file from which data will be loaded. data_type_class (Type[YahooFantasyObject], optional): YFPY models.py class for data casting. new_data_dir (str | Path, optional): Full path to new desired directory from which data will be loaded. all_output_as_json_str (bool): Boolean indicating if the output has been requested as a raw JSON string. Returns: object: Data loaded from the selected JSON file. \"\"\" # change data load directory if new_data_dir : new_data_dir = new_data_dir if isinstance ( new_data_dir , PosixPath ) else Path ( new_data_dir ) self . update_data_dir ( new_data_dir ) # load selected data file saved_data_file_path = self . data_dir / f \" { file_name } .json\" if saved_data_file_path . exists (): with open ( saved_data_file_path , \"r\" , encoding = \"utf-8\" ) as data_file : unpacked = unpack_data ( json . load ( data_file ), YahooFantasyObject ) data = data_type_class ( unpacked ) if data_type_class else unpacked if isinstance ( data , list ): # flatten list of single-key dictionaries with object values to list of object values if top level # of loaded data is a list data_element_key = list ( data [ 0 ] . keys ())[ 0 ] data = [ el [ data_element_key ] for el in data ] logger . debug ( f \"Data loaded locally from: { saved_data_file_path } \" ) else : raise FileNotFoundError ( f \"File { saved_data_file_path } does not exist. Cannot load data locally without \" f \"having previously saved data.\" ) if all_output_as_json_str : return jsonify_data ( data ) else : return data retrieve \u00b6 retrieve ( file_name , yf_query , params = None , data_type_class = None , new_data_dir = None , ) Fetch data from the web or load it locally (combination of the save and load methods). Parameters: file_name ( str ) \u2013 Name of file to/from which data will be saved/loaded. yf_query ( Callable of YahooFantasySportsQuery ) \u2013 Chosen yfpy query method to run. params ( dict of str , default: None ) \u2013 str, optional): Dictionary of parameters to be passed to chosen yfpy query function. data_type_class ( Type [ YahooFantasyObject ] , default: None ) \u2013 YFPY models.py class for data casting. new_data_dir ( str | Path , default: None ) \u2013 Full path to new desired directory to/from which data will be saved/loaded. Returns: object ( Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]] ) \u2013 Data retrieved by the yfpy query OR loaded from the selected JSON file. Source code in yfpy/data.py 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 def retrieve ( self , file_name : str , yf_query : Callable , params : Union [ Dict [ str , str ], None ] = None , data_type_class : Type [ YahooFantasyObject ] = None , new_data_dir : Union [ Path , str , None ] = None ) -> Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]]: \"\"\"Fetch data from the web or load it locally (combination of the save and load methods). Args: file_name (str): Name of file to/from which data will be saved/loaded. yf_query (Callable of YahooFantasySportsQuery): Chosen yfpy query method to run. params (dict of str: str, optional): Dictionary of parameters to be passed to chosen yfpy query function. data_type_class (Type[YahooFantasyObject], optional): YFPY models.py class for data casting. new_data_dir (str | Path, optional): Full path to new desired directory to/from which data will be saved/loaded. Returns: object: Data retrieved by the yfpy query OR loaded from the selected JSON file. \"\"\" if self . dev_offline : return self . load ( file_name , data_type_class , new_data_dir ) else : if self . save_data : return self . save ( file_name , yf_query , params , new_data_dir ) else : return self . fetch ( yf_query , params )","title":"Data"},{"location":"data/#data","text":"YFPY module for retrieving, saving, and loading all Yahoo Fantasy Sports data. This module is designed to allow for easy data management, such that both retrieving and managing Yahoo Fantasy Sports data can be done in one place without the need to manually run the queries and manage data saved to JSON files. Example The Data module can be used as follows:: yahoo_query = YahooFantasySportsQuery ( \"\" , \"\" , game_id = \"\" , yahoo_consumer_key = os . environ . get ( \"YFPY_CONSUMER_KEY\" ), yahoo_consumer_secret = os . environ . get ( \"YFPY_CONSUMER_SECRET\" ), all_output_as_json_str = False , browser_callback = True , offline = False ) data_directory = Path ( __file__ ) . parent / \"output\" data = Data ( data_dir ) data . save ( \"file_name\" , yahoo_query . get_all_yahoo_fantasy_game_keys ) data . load ( \"file_name\" ) Attributes: logger ( Logger ) \u2013 Module level logger for usage and debugging.","title":"Data"},{"location":"data/#yfpy.data.Data","text":"Bases: object YFPY Data object for Yahoo Fantasy Sports data retrieval, saving, and loading data as JSON. Source code in yfpy/data.py 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 227 228 class Data ( object ): \"\"\"YFPY Data object for Yahoo Fantasy Sports data retrieval, saving, and loading data as JSON. \"\"\" YFO = TypeVar ( \"YFO\" , bound = YahooFantasyObject ) def __init__ ( self , data_dir : Union [ Path , str ], save_data : bool = False , dev_offline : bool = False ): \"\"\"Instantiate data object to retrieve, save, and load Yahoo Fantasy Sports data. Args: data_dir (Path | str): Directory path where data will be saved/loaded. save_data (bool, optional): Boolean determining whether data is saved after retrieval from the Yahoo FF API. dev_offline (bool, optional): Boolean for offline development (requires a prior online run with save_data = True). \"\"\" self . data_dir : Path = data_dir if isinstance ( data_dir , PosixPath ) else Path ( data_dir ) self . save_data : bool = save_data self . dev_offline : bool = dev_offline def update_data_dir ( self , new_save_dir : Union [ Path , str ]) -> None : \"\"\"Modify the data storage directory if it needs to be updated. Args: new_save_dir (str | Path): Full path to new desired directory where data will be saved/loaded. Returns: None \"\"\" self . data_dir : Path = new_save_dir if isinstance ( new_save_dir , PosixPath ) else Path ( new_save_dir ) @staticmethod def fetch ( yf_query : Callable , params : Union [ Dict [ str , str ], None ] = None ) -> Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]]: \"\"\"Run query to retrieve Yahoo Fantasy Sports data. Args: yf_query (Callable of YahooFantasySportsQuery): Chosen yfpy query method to run. params (dict of str: str, optional): Dictionary of parameters to be passed to chosen yfpy query function. Returns: object: Data retrieved by the yfpy query. \"\"\" if params : return yf_query ( ** params ) else : return yf_query () def save ( self , file_name : str , yf_query : Callable , params : Union [ Dict [ str , Any ], None ] = None , new_data_dir : Union [ Path , str , None ] = None ) -> Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]]: \"\"\"Retrieve and save Yahoo Fantasy Sports data locally. Args: file_name (str): Name of file to which data will be saved. yf_query (Callable of YahooFantasySportsQuery): Chosen yfpy query method to run. params (dict of str: str, optional): Dictionary of parameters to be passed to chosen yfpy query function. new_data_dir (str | Path, optional): Full path to new desired directory to which data will be saved. Returns: object: Data retrieved by the yfpy query. \"\"\" # change data save directory if new_data_dir : new_data_dir = new_data_dir if isinstance ( new_data_dir , PosixPath ) else Path ( new_data_dir ) logger . debug ( f \"Data directory changed from { self . data_dir } to { new_data_dir } .\" ) self . update_data_dir ( new_data_dir ) # create full directory path if any directories in it do not already exist if not self . data_dir . exists (): self . data_dir . mkdir ( parents = True , exist_ok = True ) # check if parent YahooFantasySportsQuery.all_output_as_json_str = True, unset it for data saving, then reset it all_output_as_json = False # noinspection PyUnresolvedReferences if yf_query . __self__ . all_output_as_json_str : if inspect . ismethod ( yf_query ): # noinspection PyUnresolvedReferences for cls in inspect . getmro ( yf_query . __self__ . __class__ ): if yf_query . __name__ in cls . __dict__ : # noinspection PyUnresolvedReferences yf_query . __self__ . all_output_as_json_str = False all_output_as_json = True # run the actual yfpy query and retrieve the query results data = self . fetch ( yf_query , params ) # save the retrieved data locally saved_data_file_path = self . data_dir / f \" { file_name } .json\" with open ( saved_data_file_path , \"w\" , encoding = \"utf-8\" ) as data_file : if isinstance ( data , list ): # unflatten list of object values to list of single-key dictionaries with object values if top level of # data to be saved is a list unnested_data = [{ snakecase ( el . __class__ . __name__ ): el } for el in data ] else : unnested_data = data jsonify_data_to_file ( unnested_data , data_file ) logger . debug ( f \"Data saved locally to: { saved_data_file_path } \" ) # reset parent YahooFantasySportsQuery all_output_as_json_str = True and re-run query for json string return if all_output_as_json : # noinspection PyUnresolvedReferences yf_query . __self__ . all_output_as_json_str = True # data = self.get(yf_query, params) data = jsonify_data ( data ) return data def load ( self , file_name : str , data_type_class : Type [ YahooFantasyObject ] = None , new_data_dir : Union [ Path , str , None ] = None , all_output_as_json_str : bool = False ) -> Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]]: \"\"\"Load Yahoo Fantasy Sports data already stored locally. Note: This method will fail if the `save` method has not been called previously. Args: file_name (str): Name of file from which data will be loaded. data_type_class (Type[YahooFantasyObject], optional): YFPY models.py class for data casting. new_data_dir (str | Path, optional): Full path to new desired directory from which data will be loaded. all_output_as_json_str (bool): Boolean indicating if the output has been requested as a raw JSON string. Returns: object: Data loaded from the selected JSON file. \"\"\" # change data load directory if new_data_dir : new_data_dir = new_data_dir if isinstance ( new_data_dir , PosixPath ) else Path ( new_data_dir ) self . update_data_dir ( new_data_dir ) # load selected data file saved_data_file_path = self . data_dir / f \" { file_name } .json\" if saved_data_file_path . exists (): with open ( saved_data_file_path , \"r\" , encoding = \"utf-8\" ) as data_file : unpacked = unpack_data ( json . load ( data_file ), YahooFantasyObject ) data = data_type_class ( unpacked ) if data_type_class else unpacked if isinstance ( data , list ): # flatten list of single-key dictionaries with object values to list of object values if top level # of loaded data is a list data_element_key = list ( data [ 0 ] . keys ())[ 0 ] data = [ el [ data_element_key ] for el in data ] logger . debug ( f \"Data loaded locally from: { saved_data_file_path } \" ) else : raise FileNotFoundError ( f \"File { saved_data_file_path } does not exist. Cannot load data locally without \" f \"having previously saved data.\" ) if all_output_as_json_str : return jsonify_data ( data ) else : return data def retrieve ( self , file_name : str , yf_query : Callable , params : Union [ Dict [ str , str ], None ] = None , data_type_class : Type [ YahooFantasyObject ] = None , new_data_dir : Union [ Path , str , None ] = None ) -> Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]]: \"\"\"Fetch data from the web or load it locally (combination of the save and load methods). Args: file_name (str): Name of file to/from which data will be saved/loaded. yf_query (Callable of YahooFantasySportsQuery): Chosen yfpy query method to run. params (dict of str: str, optional): Dictionary of parameters to be passed to chosen yfpy query function. data_type_class (Type[YahooFantasyObject], optional): YFPY models.py class for data casting. new_data_dir (str | Path, optional): Full path to new desired directory to/from which data will be saved/loaded. Returns: object: Data retrieved by the yfpy query OR loaded from the selected JSON file. \"\"\" if self . dev_offline : return self . load ( file_name , data_type_class , new_data_dir ) else : if self . save_data : return self . save ( file_name , yf_query , params , new_data_dir ) else : return self . fetch ( yf_query , params )","title":"Data"},{"location":"data/#yfpy.data.Data.__init__","text":"__init__ ( data_dir , save_data = False , dev_offline = False ) Instantiate data object to retrieve, save, and load Yahoo Fantasy Sports data. Parameters: data_dir ( Path | str ) \u2013 Directory path where data will be saved/loaded. save_data ( bool , default: False ) \u2013 Boolean determining whether data is saved after retrieval from the Yahoo FF API. dev_offline ( bool , default: False ) \u2013 Boolean for offline development (requires a prior online run with save_data = True). Source code in yfpy/data.py 54 55 56 57 58 59 60 61 62 63 64 65 66 def __init__ ( self , data_dir : Union [ Path , str ], save_data : bool = False , dev_offline : bool = False ): \"\"\"Instantiate data object to retrieve, save, and load Yahoo Fantasy Sports data. Args: data_dir (Path | str): Directory path where data will be saved/loaded. save_data (bool, optional): Boolean determining whether data is saved after retrieval from the Yahoo FF API. dev_offline (bool, optional): Boolean for offline development (requires a prior online run with save_data = True). \"\"\" self . data_dir : Path = data_dir if isinstance ( data_dir , PosixPath ) else Path ( data_dir ) self . save_data : bool = save_data self . dev_offline : bool = dev_offline","title":"__init__"},{"location":"data/#yfpy.data.Data.update_data_dir","text":"update_data_dir ( new_save_dir ) Modify the data storage directory if it needs to be updated. Parameters: new_save_dir ( str | Path ) \u2013 Full path to new desired directory where data will be saved/loaded. Returns: None \u2013 None Source code in yfpy/data.py 68 69 70 71 72 73 74 75 76 77 78 def update_data_dir ( self , new_save_dir : Union [ Path , str ]) -> None : \"\"\"Modify the data storage directory if it needs to be updated. Args: new_save_dir (str | Path): Full path to new desired directory where data will be saved/loaded. Returns: None \"\"\" self . data_dir : Path = new_save_dir if isinstance ( new_save_dir , PosixPath ) else Path ( new_save_dir )","title":"update_data_dir"},{"location":"data/#yfpy.data.Data.fetch","text":"fetch ( yf_query , params = None ) Run query to retrieve Yahoo Fantasy Sports data. Parameters: yf_query ( Callable of YahooFantasySportsQuery ) \u2013 Chosen yfpy query method to run. params ( dict of str , default: None ) \u2013 str, optional): Dictionary of parameters to be passed to chosen yfpy query function. Returns: object ( Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]] ) \u2013 Data retrieved by the yfpy query. Source code in yfpy/data.py 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 @staticmethod def fetch ( yf_query : Callable , params : Union [ Dict [ str , str ], None ] = None ) -> Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]]: \"\"\"Run query to retrieve Yahoo Fantasy Sports data. Args: yf_query (Callable of YahooFantasySportsQuery): Chosen yfpy query method to run. params (dict of str: str, optional): Dictionary of parameters to be passed to chosen yfpy query function. Returns: object: Data retrieved by the yfpy query. \"\"\" if params : return yf_query ( ** params ) else : return yf_query ()","title":"fetch"},{"location":"data/#yfpy.data.Data.save","text":"save ( file_name , yf_query , params = None , new_data_dir = None ) Retrieve and save Yahoo Fantasy Sports data locally. Parameters: file_name ( str ) \u2013 Name of file to which data will be saved. yf_query ( Callable of YahooFantasySportsQuery ) \u2013 Chosen yfpy query method to run. params ( dict of str , default: None ) \u2013 str, optional): Dictionary of parameters to be passed to chosen yfpy query function. new_data_dir ( str | Path , default: None ) \u2013 Full path to new desired directory to which data will be saved. Returns: object ( Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]] ) \u2013 Data retrieved by the yfpy query. Source code in yfpy/data.py 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 def save ( self , file_name : str , yf_query : Callable , params : Union [ Dict [ str , Any ], None ] = None , new_data_dir : Union [ Path , str , None ] = None ) -> Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]]: \"\"\"Retrieve and save Yahoo Fantasy Sports data locally. Args: file_name (str): Name of file to which data will be saved. yf_query (Callable of YahooFantasySportsQuery): Chosen yfpy query method to run. params (dict of str: str, optional): Dictionary of parameters to be passed to chosen yfpy query function. new_data_dir (str | Path, optional): Full path to new desired directory to which data will be saved. Returns: object: Data retrieved by the yfpy query. \"\"\" # change data save directory if new_data_dir : new_data_dir = new_data_dir if isinstance ( new_data_dir , PosixPath ) else Path ( new_data_dir ) logger . debug ( f \"Data directory changed from { self . data_dir } to { new_data_dir } .\" ) self . update_data_dir ( new_data_dir ) # create full directory path if any directories in it do not already exist if not self . data_dir . exists (): self . data_dir . mkdir ( parents = True , exist_ok = True ) # check if parent YahooFantasySportsQuery.all_output_as_json_str = True, unset it for data saving, then reset it all_output_as_json = False # noinspection PyUnresolvedReferences if yf_query . __self__ . all_output_as_json_str : if inspect . ismethod ( yf_query ): # noinspection PyUnresolvedReferences for cls in inspect . getmro ( yf_query . __self__ . __class__ ): if yf_query . __name__ in cls . __dict__ : # noinspection PyUnresolvedReferences yf_query . __self__ . all_output_as_json_str = False all_output_as_json = True # run the actual yfpy query and retrieve the query results data = self . fetch ( yf_query , params ) # save the retrieved data locally saved_data_file_path = self . data_dir / f \" { file_name } .json\" with open ( saved_data_file_path , \"w\" , encoding = \"utf-8\" ) as data_file : if isinstance ( data , list ): # unflatten list of object values to list of single-key dictionaries with object values if top level of # data to be saved is a list unnested_data = [{ snakecase ( el . __class__ . __name__ ): el } for el in data ] else : unnested_data = data jsonify_data_to_file ( unnested_data , data_file ) logger . debug ( f \"Data saved locally to: { saved_data_file_path } \" ) # reset parent YahooFantasySportsQuery all_output_as_json_str = True and re-run query for json string return if all_output_as_json : # noinspection PyUnresolvedReferences yf_query . __self__ . all_output_as_json_str = True # data = self.get(yf_query, params) data = jsonify_data ( data ) return data","title":"save"},{"location":"data/#yfpy.data.Data.load","text":"load ( file_name , data_type_class = None , new_data_dir = None , all_output_as_json_str = False , ) Load Yahoo Fantasy Sports data already stored locally. Note This method will fail if the save method has not been called previously. Parameters: file_name ( str ) \u2013 Name of file from which data will be loaded. data_type_class ( Type [ YahooFantasyObject ] , default: None ) \u2013 YFPY models.py class for data casting. new_data_dir ( str | Path , default: None ) \u2013 Full path to new desired directory from which data will be loaded. all_output_as_json_str ( bool , default: False ) \u2013 Boolean indicating if the output has been requested as a raw JSON string. Returns: object ( Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]] ) \u2013 Data loaded from the selected JSON file. Source code in yfpy/data.py 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 def load ( self , file_name : str , data_type_class : Type [ YahooFantasyObject ] = None , new_data_dir : Union [ Path , str , None ] = None , all_output_as_json_str : bool = False ) -> Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]]: \"\"\"Load Yahoo Fantasy Sports data already stored locally. Note: This method will fail if the `save` method has not been called previously. Args: file_name (str): Name of file from which data will be loaded. data_type_class (Type[YahooFantasyObject], optional): YFPY models.py class for data casting. new_data_dir (str | Path, optional): Full path to new desired directory from which data will be loaded. all_output_as_json_str (bool): Boolean indicating if the output has been requested as a raw JSON string. Returns: object: Data loaded from the selected JSON file. \"\"\" # change data load directory if new_data_dir : new_data_dir = new_data_dir if isinstance ( new_data_dir , PosixPath ) else Path ( new_data_dir ) self . update_data_dir ( new_data_dir ) # load selected data file saved_data_file_path = self . data_dir / f \" { file_name } .json\" if saved_data_file_path . exists (): with open ( saved_data_file_path , \"r\" , encoding = \"utf-8\" ) as data_file : unpacked = unpack_data ( json . load ( data_file ), YahooFantasyObject ) data = data_type_class ( unpacked ) if data_type_class else unpacked if isinstance ( data , list ): # flatten list of single-key dictionaries with object values to list of object values if top level # of loaded data is a list data_element_key = list ( data [ 0 ] . keys ())[ 0 ] data = [ el [ data_element_key ] for el in data ] logger . debug ( f \"Data loaded locally from: { saved_data_file_path } \" ) else : raise FileNotFoundError ( f \"File { saved_data_file_path } does not exist. Cannot load data locally without \" f \"having previously saved data.\" ) if all_output_as_json_str : return jsonify_data ( data ) else : return data","title":"load"},{"location":"data/#yfpy.data.Data.retrieve","text":"retrieve ( file_name , yf_query , params = None , data_type_class = None , new_data_dir = None , ) Fetch data from the web or load it locally (combination of the save and load methods). Parameters: file_name ( str ) \u2013 Name of file to/from which data will be saved/loaded. yf_query ( Callable of YahooFantasySportsQuery ) \u2013 Chosen yfpy query method to run. params ( dict of str , default: None ) \u2013 str, optional): Dictionary of parameters to be passed to chosen yfpy query function. data_type_class ( Type [ YahooFantasyObject ] , default: None ) \u2013 YFPY models.py class for data casting. new_data_dir ( str | Path , default: None ) \u2013 Full path to new desired directory to/from which data will be saved/loaded. Returns: object ( Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]] ) \u2013 Data retrieved by the yfpy query OR loaded from the selected JSON file. Source code in yfpy/data.py 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 def retrieve ( self , file_name : str , yf_query : Callable , params : Union [ Dict [ str , str ], None ] = None , data_type_class : Type [ YahooFantasyObject ] = None , new_data_dir : Union [ Path , str , None ] = None ) -> Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]]: \"\"\"Fetch data from the web or load it locally (combination of the save and load methods). Args: file_name (str): Name of file to/from which data will be saved/loaded. yf_query (Callable of YahooFantasySportsQuery): Chosen yfpy query method to run. params (dict of str: str, optional): Dictionary of parameters to be passed to chosen yfpy query function. data_type_class (Type[YahooFantasyObject], optional): YFPY models.py class for data casting. new_data_dir (str | Path, optional): Full path to new desired directory to/from which data will be saved/loaded. Returns: object: Data retrieved by the yfpy query OR loaded from the selected JSON file. \"\"\" if self . dev_offline : return self . load ( file_name , data_type_class , new_data_dir ) else : if self . save_data : return self . save ( file_name , yf_query , params , new_data_dir ) else : return self . fetch ( yf_query , params )","title":"retrieve"},{"location":"exceptions/","text":"Exceptions \u00b6 YFPY module for throwing custom exceptions. Attributes: logger ( Logger ) \u2013 Module level logger for usage and debugging. YahooFantasySportsException \u00b6 Bases: Exception Base YFPY exception class for Yahoo Fantasy Sports API exceptions. Source code in yfpy/exceptions.py 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 class YahooFantasySportsException ( Exception ): \"\"\"Base YFPY exception class for Yahoo Fantasy Sports API exceptions. \"\"\" def __init__ ( self , message : str , payload : str = None , url : str = None ): \"\"\"Instantiate YFPY exception. Args: message (str): Human readable string describing the exception. payload (str, optional): The API exception error payload. url (str, optional): Yahoo Fantasy Sports REST API URL. Attributes: message (str): Human readable string describing the exception. payload (str): The API exception error payload. url (str): Yahoo Fantasy Sports REST API URL. \"\"\" self . message : str = message self . payload : str = payload self . url : str = url def __str__ ( self ): return str ( self . message ) __init__ \u00b6 __init__ ( message , payload = None , url = None ) Instantiate YFPY exception. Parameters: message ( str ) \u2013 Human readable string describing the exception. payload ( str , default: None ) \u2013 The API exception error payload. url ( str , default: None ) \u2013 Yahoo Fantasy Sports REST API URL. Attributes: message ( str ) \u2013 Human readable string describing the exception. payload ( str ) \u2013 The API exception error payload. url ( str ) \u2013 Yahoo Fantasy Sports REST API URL. Source code in yfpy/exceptions.py 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 def __init__ ( self , message : str , payload : str = None , url : str = None ): \"\"\"Instantiate YFPY exception. Args: message (str): Human readable string describing the exception. payload (str, optional): The API exception error payload. url (str, optional): Yahoo Fantasy Sports REST API URL. Attributes: message (str): Human readable string describing the exception. payload (str): The API exception error payload. url (str): Yahoo Fantasy Sports REST API URL. \"\"\" self . message : str = message self . payload : str = payload self . url : str = url YahooFantasySportsDataNotFound \u00b6 Bases: YahooFantasySportsException YFPY exception when no data was retrieved from the Yahoo Fantasy Sports REST API. Source code in yfpy/exceptions.py 41 42 class YahooFantasySportsDataNotFound ( YahooFantasySportsException ): \"\"\"YFPY exception when no data was retrieved from the Yahoo Fantasy Sports REST API.\"\"\"","title":"Exceptions"},{"location":"exceptions/#exceptions","text":"YFPY module for throwing custom exceptions. Attributes: logger ( Logger ) \u2013 Module level logger for usage and debugging.","title":"Exceptions"},{"location":"exceptions/#yfpy.exceptions.YahooFantasySportsException","text":"Bases: Exception Base YFPY exception class for Yahoo Fantasy Sports API exceptions. Source code in yfpy/exceptions.py 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 class YahooFantasySportsException ( Exception ): \"\"\"Base YFPY exception class for Yahoo Fantasy Sports API exceptions. \"\"\" def __init__ ( self , message : str , payload : str = None , url : str = None ): \"\"\"Instantiate YFPY exception. Args: message (str): Human readable string describing the exception. payload (str, optional): The API exception error payload. url (str, optional): Yahoo Fantasy Sports REST API URL. Attributes: message (str): Human readable string describing the exception. payload (str): The API exception error payload. url (str): Yahoo Fantasy Sports REST API URL. \"\"\" self . message : str = message self . payload : str = payload self . url : str = url def __str__ ( self ): return str ( self . message )","title":"YahooFantasySportsException"},{"location":"exceptions/#yfpy.exceptions.YahooFantasySportsException.__init__","text":"__init__ ( message , payload = None , url = None ) Instantiate YFPY exception. Parameters: message ( str ) \u2013 Human readable string describing the exception. payload ( str , default: None ) \u2013 The API exception error payload. url ( str , default: None ) \u2013 Yahoo Fantasy Sports REST API URL. Attributes: message ( str ) \u2013 Human readable string describing the exception. payload ( str ) \u2013 The API exception error payload. url ( str ) \u2013 Yahoo Fantasy Sports REST API URL. Source code in yfpy/exceptions.py 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 def __init__ ( self , message : str , payload : str = None , url : str = None ): \"\"\"Instantiate YFPY exception. Args: message (str): Human readable string describing the exception. payload (str, optional): The API exception error payload. url (str, optional): Yahoo Fantasy Sports REST API URL. Attributes: message (str): Human readable string describing the exception. payload (str): The API exception error payload. url (str): Yahoo Fantasy Sports REST API URL. \"\"\" self . message : str = message self . payload : str = payload self . url : str = url","title":"__init__"},{"location":"exceptions/#yfpy.exceptions.YahooFantasySportsDataNotFound","text":"Bases: YahooFantasySportsException YFPY exception when no data was retrieved from the Yahoo Fantasy Sports REST API. Source code in yfpy/exceptions.py 41 42 class YahooFantasySportsDataNotFound ( YahooFantasySportsException ): \"\"\"YFPY exception when no data was retrieved from the Yahoo Fantasy Sports REST API.\"\"\"","title":"YahooFantasySportsDataNotFound"},{"location":"logger/","text":"Logging \u00b6 YFPY module for configuring and formatting the custom logger. get_logger \u00b6 get_logger ( name , level = INFO ) Get custom YFPY logger object. Parameters: name ( str ) \u2013 The module name for the logger. level ( int , default: INFO ) \u2013 The log level for the logger. Default level set to INFO. Returns: Logger ( Logger ) \u2013 A Python Logger object with custom configuration and formatting. Source code in yfpy/logger.py 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 def get_logger ( name : str , level : int = INFO ) -> Logger : \"\"\"Get custom YFPY logger object. Args: name (str): The module name for the logger. level (int): The log level for the logger. Default level set to INFO. Returns: Logger: A Python Logger object with custom configuration and formatting. \"\"\" logger = getLogger ( name ) if len ( logger . handlers ) > 0 : logger . handlers = [] if level : logger . setLevel ( level ) sh = StreamHandler () if level : sh . setLevel ( level ) formatter = Formatter ( fmt = \" %(asctime)s . %(msecs)03d - %(levelname)s - %(filename)s - %(name)s : %(lineno)d - %(message)s \" , datefmt = \"%Y-%m- %d %H:%M:%S\" ) sh . setFormatter ( formatter ) logger . addHandler ( sh ) return logger","title":"Logging"},{"location":"logger/#logging","text":"YFPY module for configuring and formatting the custom logger.","title":"Logging"},{"location":"logger/#yfpy.logger.get_logger","text":"get_logger ( name , level = INFO ) Get custom YFPY logger object. Parameters: name ( str ) \u2013 The module name for the logger. level ( int , default: INFO ) \u2013 The log level for the logger. Default level set to INFO. Returns: Logger ( Logger ) \u2013 A Python Logger object with custom configuration and formatting. Source code in yfpy/logger.py 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 def get_logger ( name : str , level : int = INFO ) -> Logger : \"\"\"Get custom YFPY logger object. Args: name (str): The module name for the logger. level (int): The log level for the logger. Default level set to INFO. Returns: Logger: A Python Logger object with custom configuration and formatting. \"\"\" logger = getLogger ( name ) if len ( logger . handlers ) > 0 : logger . handlers = [] if level : logger . setLevel ( level ) sh = StreamHandler () if level : sh . setLevel ( level ) formatter = Formatter ( fmt = \" %(asctime)s . %(msecs)03d - %(levelname)s - %(filename)s - %(name)s : %(lineno)d - %(message)s \" , datefmt = \"%Y-%m- %d %H:%M:%S\" ) sh . setFormatter ( formatter ) logger . addHandler ( sh ) return logger","title":"get_logger"},{"location":"models/","text":"Models \u00b6 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 ) \u2013 Module level logger for usage and debugging. YahooFantasyObject \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate a Yahoo Fantasy Object. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: extracted_data ( dict ) \u2013 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__ \u00b6 __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__ \u00b6 __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__ \u00b6 __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 \u00b6 subclass_dict () Derive snake case dictionary keys from custom object type camel case class names. Returns: dict ( Dict ) \u2013 Dictionary with snake case strings of all subclasses of YahooFantasyObject as keys and subclasses as Dict \u2013 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 \u00b6 clean_data_dict () Recursive method to un-type custom class type objects for serialization. Returns: dict ( Dict ) \u2013 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 \u00b6 serialized () Pack up all object content into nested dictionaries for JSON serialization. Returns: dict ( Dict ) \u2013 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 \u00b6 to_json () Serialize the class object to JSON. Returns: str ( str ) \u2013 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 \u00b6 from_json ( json_data ) Deserialize JSON to a class object. Returns: object ( object ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the User child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: games ( list [ Game ] ) \u2013 The Yahoo Fantasy games in which the user participates/has participated. guid ( str ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the Game child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: code ( str ) \u2013 The Yahoo Fantasy game code. contest_group_id ( int ) \u2013 The contest group ID of the Yahoo Fantasy game/contest. current_week ( int ) \u2013 The current (or last if complete) week of the Yahoo Fantasy game/contest. editorial_season ( int ) \u2013 The year in which the Yahoo Fantasy game/contest starts. game_id ( int ) \u2013 The Yahoo Fantasy game ID. game_key ( str ) \u2013 The Yahoo Fantasy game key. game_weeks ( list [ GameWeek ] ) \u2013 A list of YFPY GameWeek instances. has_schedule ( int ) \u2013 Numeric boolean (0 or 1) representing if the Yahoo Fantasy contest has a schedule. is_contest_over ( int ) \u2013 Numeric boolean (0 or 1) representing if the Yahoo Fantasy contest is complete. is_contest_reg_active ( int ) \u2013 Numeric boolean (0 or 1) representing if the Yahoo Fantasy contest is active. is_game_over ( int ) \u2013 Numeric boolean (0 or 1) representing if the Yahoo Fantasy game is complete. is_live_draft_lobby_active ( int ) \u2013 Numeric boolean (0 or 1) representing if the draft lobby is active. is_offseason ( int ) \u2013 Numeric boolean (0 or 1) representing if it is the offseason for the respective sport. is_registration_over ( int ) \u2013 Numeric boolean (0 or 1) representing registration for the fantasy game is over. leagues ( list [ League ] ) \u2013 A list of YFPY League instances. name ( str ) \u2013 The name of the Yahoo Fantasy game. picks_status ( str ) \u2013 The status of the Yahoo Fantasy game/contest picks when applicable. players ( list [ Player ] ) \u2013 A list of YFPY Player instances. position_types ( list [ PositionType ] ) \u2013 A list of YFPY PositionType instances. roster_positions ( list [ RosterPosition ] ) \u2013 A list of YFPY RosterPosition instances. scenario_generator ( int ) \u2013 Numeric boolean (0 or 1) representing if the Yahoo Fantasy game has a scenario generator. season ( int ) \u2013 The Yahoo Fantasy game year. stat_categories ( StatCategories ) \u2013 A YFPY StatCategories instance. teams ( list [ Team ] ) \u2013 A list of YFPY Team instances. type ( str ) \u2013 The type of the Yahoo Fantasy game. url ( str ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the GameWeek child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: display_name ( str ) \u2013 The display name of the Yahoo Fantasy game week. end ( str ) \u2013 The end date of the Yahoo Fantasy game week. start ( str ) \u2013 The start date of the Yahoo Fantasy game week. week ( int ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the PositionType child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: type ( str ) \u2013 The type of the player position (\"offense\", \"defense\", etc.). display_name ( str ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the League child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: allow_add_to_dl_extra_pos ( int ) \u2013 Numeric boolean (0 or 1) representing if the leagues allows adding extra positions to the DL (currently uncertain what this is). current_week ( int ) \u2013 The current week number. draft_results ( list [ DraftResult ] ) \u2013 A list of YFPY DraftResult instances. draft_status ( str ) \u2013 The status of the draft (\"postdraft\", etc.). display_name ( str ) \u2013 The display name of the league. edit_key ( int ) \u2013 The Yahoo edit key for the league. end_date ( str ) \u2013 A date string representing the end date of the league (format: \"YYYY-MM-DD\"). end_week ( int ) \u2013 The number of the last week of the league. entry_fee ( str ) \u2013 The entry fee for Yahoo paid leagues (USD). felo_tier ( str ) \u2013 The league fantasy ELO level (Bronze, Silver, Gold, Platinum, Diamond). game_code ( str ) \u2013 The Yahoo game code (\"nfl\", \"nhl\", \"nba\", \"mlb\"). iris_group_chat_id ( str | null ) \u2013 The unique IRIS group chat ID for the league. is_cash_league ( int ) \u2013 Numeric boolean (0 or 1) representing if the league is a Yahoo paid league. is_finished ( int ) \u2013 Numeric boolean (0 or 1) representing if the league season has completed. is_plus_league ( int ) \u2013 Numeric boolean (0 or 1) representing if the league has paid for Yahoo Fantasy Plus. is_pro_league ( str ) \u2013 Numeric boolean (0 or 1) representing if the league is a Yahoo Pro league. league_id ( str ) \u2013 The unique Yahoo league ID. league_key ( str ) \u2013 The Yahoo league key. league_type ( str ) \u2013 The type of the league (\"private\", \"public\"). league_update_timestamp ( int ) \u2013 A timestamp representing the last time the league was updated. logo_url ( str ) \u2013 The direct URL of the league logo photo. name ( str ) \u2013 The name of the league. num_teams ( str ) \u2013 The number of teams in the league. password ( str | null ) \u2013 The password required to join the league (if applicable). payment_deadline ( str ) \u2013 A date string representing the deadline by which all league dues payments must be made (format: \"YYYY-MM-DD\"). players ( list [ Player ] ) \u2013 A list of YFPY Player instances. renew ( str | null ) \u2013 A string indicating the previous Yahoo game code and previous Yahoo league ID (Ex.: \"371_811308\") (if applicable). renewed ( str | null ) \u2013 A string indicating the next Yahoo game code and next Yahoo league ID (Ex.: \"390_303233\") (if applicable). scoreboard ( Scoreboard ) \u2013 A YFPY Scoreboard instance. matchups ( list [ Matchup ] ) \u2013 A list of YFPY Matchup instances. scoring_type ( str ) \u2013 The scoring type of the league (\"head\" for head-to-head, etc.). season ( int ) \u2013 The season year of the league. settings ( Settings ) \u2013 A YFPY Settings instance. short_invitation_url ( str ) \u2013 The sharable short URL sent by invite allowing players to join the league. standings ( Standings ) \u2013 A YFPY Standings instance. start_date ( str ) \u2013 A date string representing the start date of the league (format: \"YYYY-MM-DD\"). start_week ( int ) \u2013 The number of the first week of the league. teams ( list [ Team ] ) \u2013 A list of YFPY Team instances. teams_ordered_by_standings ( list [ Team ] ) \u2013 A list of YFPY Team instances ordered by their ranks in the league standings. transactions ( list [ Transaction ] ) \u2013 A list of YFPY Transaction instances. url ( str ) \u2013 The direct URL of the league. weekly_deadline ( str | null ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the Team child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: can_edit_current_week ( int ) \u2013 (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 ) \u2013 (for Tourney Pick'em) The selected champion for the contest. champion_status ( str ) \u2013 (for Tourney Pick'em) The final status of the selected champion for the contest. clinched_playoffs ( int ) \u2013 Numeric boolean (0 or 1) representing if the team has clinched a playoff berth. division_id ( int ) \u2013 The unique ID number of the division containing the team (if applicable). done_week ( str ) \u2013 (might be for Tourney Pick'em or Survival Football) ATTRIBUTE MEANING UNKNOWN. draft_grade ( str ) \u2013 The letter grade assigned to the draft completed by the team (\"A+\", \"A\", ..., \"F-\"). draft_position ( int ) \u2013 The draft order/position of the team. draft_recap_url ( str ) \u2013 The direct URL of the draft recap for the team. draft_results ( list [ DraftResult ] ) \u2013 A list of YFPY DraftResult instances. elimination_week ( int ) \u2013 (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 ) \u2013 (for Tourney Pick'em) The email address of the user competing in the contest. faab_balance ( int ) \u2013 The available balance of FAAB (Free Agent Acquisition Budget) (if applicable). has_draft_grade ( int ) \u2013 Numeric boolean (0 or 1) representing if the team has a draft grade available. is_in_contest ( int ) \u2013 (for Survival Football) Numeric boolean (0 or 1) representing if the user is in a contest. is_owned_by_current_login ( int ) \u2013 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 ) \u2013 (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 ) \u2013 Value designating the type of scoring used by the league (\"head\" for head-to-head, etc.). logo_type ( str ) \u2013 (for Tourney Pick'em) The team logo type (\"avatar\", etc.) of the user competing in the contest. manager ( Manager ) \u2013 (for Survival Football) A YFPY Manager instance for the user competing in the contest. managers ( list [ Manager ] | dict [ str , Manager ] ) \u2013 A list or dict (depending on source data) of YFPY Manager instances. matchups ( list [ Matchup ] ) \u2013 A list of YFPY Matchup instances. name ( str ) \u2013 The team name. number_of_moves ( int ) \u2013 The number of moves made by the team (adds/drops/trades/etc.). number_of_trades ( int ) \u2013 The number of trades made by the team. roster ( Roster ) \u2013 A YFPY Roster instance. players ( list [ Player ] ) \u2013 A list of YFPY Player instances. roster_adds ( RosterAdds ) \u2013 A YFPY RosterAdds instance. roster_adds_value ( int ) \u2013 The number of roster adds made by the team. team_id ( int ) \u2013 The unique team ID in the league. team_key ( str ) \u2013 The Yahoo team key. team_logo ( str ) \u2013 (for Tourney Pick'em) The direct URL to the team logo of the user competing in the contest. team_logos ( list [ TeamLogo ] ) \u2013 A list of YFPY TeamLogo instances. team_paid ( int ) \u2013 Numeric boolean (0 or 1) representing if the team has paid for Yahoo Fantasy Plus. team_points ( TeamPoints ) \u2013 A YFPY TeamPoints instance. points ( float ) \u2013 The total points scored by the team. team_projected_points ( TeamProjectedPoints ) \u2013 A YFPY TeamProjectedPoints instance. projected_points ( float ) \u2013 The total projected points for the team. team_standings ( TeamStandings ) \u2013 A YFPY TeamStandings instance. wins ( int ) \u2013 The number of wins by the team. losses ( int ) \u2013 The number of losses by the team. ties ( int ) \u2013 The number of ties by the team. percentage ( float ) \u2013 The win percentage of the team. playoff_seed ( int ) \u2013 The playoff seed of the team. points_against ( float ) \u2013 The total team points against. points_for ( float ) \u2013 The total team points for. rank ( int ) \u2013 The rank of the team in the league standings. status ( str ) \u2013 (for Survival Football) The status of user competing in the contest (\"dead\", etc.). streak_type ( str ) \u2013 The active team win/loss/tie streak. streak_length ( int ) \u2013 The length of the streak. total_strikes ( int ) \u2013 (for Survival Football) The total number of strikes (incorrect selections) made by the user competing in the contest. url ( str ) \u2013 The direct URL to the team. user_display_name ( str ) \u2013 (for Tourney Pick'em) The display name for the user competing in the contest. user_profile_image ( str ) \u2013 (for Tourney Pick'em) The direct URL to the profile image of the user competing in the contest. waiver_priority ( int ) \u2013 The waiver priority of the team. win_probability ( float ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the DraftResult child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: cost ( int ) \u2013 The player cost (for auction drafts). pick ( int ) \u2013 The draft pick number. round ( int ) \u2013 The draft round. team_key ( str ) \u2013 The Yahoo team key of the team that made the draft pick. player_key ( str ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the Standings child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: teams ( list [ Team ] ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the Transaction child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: players ( list [ Player ] ) \u2013 A list of YFPY Player instances. status ( str ) \u2013 The transaction status (\"successful\", etc.). timestamp ( int ) \u2013 The timestamp of when the transaction occurred. tradee_team_key ( str ) \u2013 The Yahoo team key for the team receiving the player (if applicable). tradee_team_name ( str ) \u2013 The team name of the team receiving the player (if applicable). trader_team_key ( str ) \u2013 The Yahoo team key for the team sending the player (if applicable). trader_team_name ( str ) \u2013 The team name for the team sending the player (if applicable). transaction_id ( int ) \u2013 The unique transaction ID number. transaction_key ( str ) \u2013 The Yahoo transaction key (Ex.: \"406.l.413954.tr.555\"). type ( str ) \u2013 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 \u00b6 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 .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. \"\"\" 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__ \u00b6 __init__ ( extracted_data ) Instantiate the Pick child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: destination_team_key ( str ) \u2013 Team key in the format .l. .t. of the team receiving the pick in the transaction. destination_team_name ( str ) \u2013 Team name of the team receiving the pick in the transaction. original_team_key ( str ) \u2013 Team key in the format .l. .t. of the team to which the pick in the transaction originally belonged. original_team_name ( str ) \u2013 Team name of the team to which the pick in the transaction originally belonged. round ( int ) \u2013 The draft round of the pick in the transaction. source_team_key ( str ) \u2013 Team key in the format .l. .t. of the team sending the pick in the transaction. source_team_name ( str ) \u2013 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 .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. \"\"\" 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the Manager child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: email ( str ) \u2013 The email address of the manager. emails ( list [ str ] ) \u2013 (for Survival Football) List of email addresses for the manager competing in the contest. fantasy_profile_url ( str ) \u2013 (for Survival Football) The direct URL for the profile of the manager competing in the contest. felo_score ( int ) \u2013 The manager fantasy ELO rating. felo_tier ( str ) \u2013 The manager fantasy ELO level (Bronze, Silver, Gold, Platinum, Diamond). guid ( str ) \u2013 The unique Yahoo GUID of the user account associated with manager. image_url ( str ) \u2013 The direct URL of the manager profile image. is_comanager ( int ) \u2013 Numeric boolean (0 or 1) representing if the manager is a co-manager. is_commissioner ( int ) \u2013 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 ) \u2013 Numeric boolean (0 or 1) representing if the manager is the current user authenticated with the Yahoo Fantasy Sports REST API. manager_id ( int ) \u2013 The unique manager ID in the league. nickname ( str ) \u2013 The display nickname of the manager. profile_image_url ( str ) \u2013 (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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the Roster child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: coverage_type ( str ) \u2013 The timeframe for the selected roster (\"week\", \"date\", \"season\", etc.). week ( int ) \u2013 The week number. is_editable ( int ) \u2013 Numeric boolean (0 or 1) representing if the roster is editable. is_prescoring ( int ) \u2013 Numeric boolean (0 or 1) representing if the roster is in a prescoring state. players ( list [ Player ] ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the RosterAdds child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: coverage_type ( str ) \u2013 The timeframe for the selected roster (\"week\", \"date\", \"season\", etc.). coverage_value ( int ) \u2013 The value of the coverage type (week number, for instance). value ( int ) \u2013 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 ) TeamLogo \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the TeamLogo child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: size ( str ) \u2013 The size of the team logo photo (\"small\", \"large\", etc.) url ( str ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the TeamPoints child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: coverage_type ( str ) \u2013 The timeframe for the selected team points (\"week\", \"date\", \"season\", etc.). season ( int ) \u2013 The season year. total ( float ) \u2013 The total team points for the coverage timeframe. week ( int ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the TeamProjectedPoints child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: coverage_type ( str ) \u2013 The timeframe for the selected team projected points (\"week\", \"date\", \"season\", etc.). total ( float ) \u2013 The total team projected points for the coverage timeframe. week ( int ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the TeamStandings child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: divisional_outcome_totals ( DivisionalOutcomeTotals ) \u2013 A list of YFPY DivisionalOutcomeTotals instances. outcome_totals ( OutcomeTotals ) \u2013 A YFPY OutcomeTotals instance. playoff_seed ( int ) \u2013 The playoff seed position for the team. points_against ( float ) \u2013 The total team points against. points_for ( float ) \u2013 The total team points for. rank ( int ) \u2013 The rank of the team in the league standings. streak ( Streak ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the DivisionOutcomeTotals child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: losses ( int ) \u2013 The number of losses by the team within the division. ties ( int ) \u2013 The number of ties by the team within the division. wins ( int ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the OutcomeTotals child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: losses ( int ) \u2013 The number of losses by the team. percentage ( float ) \u2013 The win percentage of the team. ties ( int ) \u2013 The number of ties by the team. wins ( int ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the Streak child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: type ( str ) \u2013 The streak type (\"W\" for win, \"L\" for loss, \"T\" for tie). value ( int ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the Scoreboard child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: matchups ( list [ Matchup ] ) \u2013 A list of YFPY Matchup instances representing the matchups for the week. week ( int ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the Settings child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: cant_cut_list ( int ) \u2013 Numeric boolean (0 or 1) representing if the league uses the Yahoo \"can't cut list\". divisions ( list [ Division ] ) \u2013 A list of YFPY Division instances for leagues with divisions. draft_pick_time ( int ) \u2013 The number of seconds allowed to make each draft pick. draft_time ( int ) \u2013 A timestamp representing when the draft will start. draft_together ( int ) \u2013 Numeric boolean (0 or 1) representing if the league uses Yahoo Fantasy Draft Together live video chat during online drafts. draft_type ( str ) \u2013 The type of draft (\"live\", \"offline\", etc.) has_multiweek_championship ( int ) \u2013 Numeric boolean (0 or 1) representing if the league has a multi-week championship matchup. has_playoff_consolation_games ( bool ) \u2013 Numeric boolean (0 or 1) representing if the league has a consolation playoff bracket. is_auction_draft ( int ) \u2013 Numeric boolean (0 or 1) representing if the league uses an auction draft. league_premium_features ( List ) \u2013 List of features enables as part of subscription to Yahoo Fantasy Plus or Yahoo Fantasy Commissioner Plus. max_teams ( int ) \u2013 The maximum number of teams allowed in the league. num_playoff_consolation_teams ( int ) \u2013 The number of teams that make the consolation playoff bracket. num_playoff_teams ( int ) \u2013 The number of teams that make the playoffs. persistent_url ( str ) \u2013 Custom URL configured for the league that remains the same every season. pickem_enabled ( int ) \u2013 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 ) \u2013 Value designating what player pool is allowed for the league (\"ALL\", etc.). playoff_start_week ( int ) \u2013 The week number on which the playoffs start. post_draft_players ( str ) \u2013 Value designating what happens to players after the draft (\"W\" for waivers, etc.). roster_positions ( list [ RosterPosition ] ) \u2013 A list of YFPY RosterPosition instances. scoring_type ( str ) \u2013 Value designating what type of scoring the league uses (\"head\" for head-to-head, etc.). sendbird_channel_url ( str ) \u2013 The in-app Sendbird channel ID. stat_categories ( StatCategories ) \u2013 A YFPY StatCategories instance. stat_modifiers ( StatModifiers ) \u2013 A YFPY StatModifiers instance. trade_end_date ( str ) \u2013 A date string representing when trading is no longer allowed (format: \"YYYY-MM-DD\"). trade_ratify_type ( str ) \u2013 Value designating how trades are ratified (\"commish\" for commissioner, etc.). trade_reject_time ( int ) \u2013 The number of days during which a trade can be rejected. uses_faab ( int ) \u2013 Numeric boolean (0 or 1) representing if the league uses FAAB (Free Agent Acquisition Budget). uses_fractional_points ( int ) \u2013 Numeric boolean (0 or 1) representing if the league allows fractional scoring. uses_lock_eliminated_teams ( int ) \u2013 Numeric boolean (0 or 1) representing if the league locks teams eliminated from the playoffs. uses_median_score ( int ) \u2013 (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 ) \u2013 Numeric boolean (0 or 1) representing if the league allows negative scoring. uses_playoffs ( int ) \u2013 Numeric boolean (0 or 1) representing if the league has playoffs. uses_playoff_reseeding ( int ) \u2013 Numeric boolean (0 or 1) representing if the league reseeds the playoffs once the fantasy regular season is complete. waiver_rule ( str ) \u2013 Value designating when players go to waivers (\"gametime\", etc.). waiver_time ( int ) \u2013 The number of days that players remain on waivers. waiver_type ( str ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the Division child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: division_id ( int ) \u2013 The unique division ID number in the league. name ( str ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the RosterPosition child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: abbreviation ( str ) \u2013 The abbreviated position string. count ( int ) \u2013 The number of roster slots available for this position. display_name ( str ) \u2013 The unabbreviated position string. is_bench ( int ) \u2013 Numeric boolean (0 or 1) representing if the roster position is the bench position. is_starting_position ( int ) \u2013 Numeric boolean (0 or 1) representing if the roster position is in the starting lineup and scores points. position ( str ) \u2013 The abbreviated position string. position_type ( str ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the StatCategories child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: groups ( list [ Group ] ) \u2013 A list of YFPY Group instances representing the stat categories groups. stats ( list [ Stat ] ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the Group child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: group_abbr ( str ) \u2013 The abbreviated display name of the stat categories group. group_display_name ( str ) \u2013 The display name of the stat categories group. group_name ( str ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the StatModifiers child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: stats ( list [ Stat ] ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the Stat child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: abbr ( str ) \u2013 The abbreviated display name of the stat. bonuses ( list [ Bonus ] ) \u2013 A list of YFPY Bonus instances available for this stat category. display_name ( str ) \u2013 The display name of the stat. enabled ( int ) \u2013 Numeric boolean (0 or 1) representing if this stat is enabled for league scoring. group ( str ) \u2013 The stat category (\"misc\", \"yds_allow\", \"return\", \"receiving\", \"rushing\", \"passing\", etc.) is_excluded_from_display ( int ) \u2013 Numeric boolean (0 or 1) representing if this stat is not displayed. is_only_display_stat ( int ) \u2013 Numeric boolean (0 or 1) representing if this stat is only for display. name ( str ) \u2013 The full name of the stat. position_type ( str ) \u2013 The player position type eligible for the stat. position_types ( list[PositionType ) \u2013 A list of YFPY PositionType instances. sort_order ( int ) \u2013 Numeric boolean (0 or 1) representing if the stat is sorted highest to lowest (1) or lowest to highest (0). stat_id ( int ) \u2013 The unique stat ID number in the league. stat_position_types ( list [ PositionType ] ) \u2013 A list of YFPY PositionType instances. value ( float ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the StatPositionType child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: is_only_display_stat ( int ) \u2013 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 ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the Bonus child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: points ( float ) \u2013 The points awarded when the bonus is won. target ( int ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the Matchup child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: is_consolation ( int ) \u2013 Numeric boolean (0 or 1) representing if the matchup is in a consolation bracket. is_matchup_recap_available ( int ) \u2013 Numeric boolean (0 or 1) representing if the matchup recap is available. is_playoffs ( int ) \u2013 Numeric boolean (0 or 1) representing if the matchup is in the playoffs bracket. is_tied ( int ) \u2013 Numeric boolean (0 or 1) representing if the matchup result is tied. matchup_grades ( list [ MatchupGrade ] ) \u2013 A list of YFPY MatchupGrade instances. matchup_recap_title ( str ) \u2013 The title of the matchup recap. matchup_recap_url ( str ) \u2013 The direct URL of the matchup recap. status ( str ) \u2013 The status of the matchup (\"postevent\", etc.). teams ( list [ Team ] ) \u2013 A list of YFPY Team instances for teams in the matchup. week ( int ) \u2013 The week number of the matchup. week_end ( str ) \u2013 A date string representing the end of the matchup week (format: \"YYYY-MM-DD\"). week_start ( str ) \u2013 A date string representing the start of the matchup week (format: \"YYYY-MM-DD\"). winner_team_key ( str ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the MatchupGrade child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: grade ( str ) \u2013 The letter grade assigned to the matchup performance (\"A+\", \"A\", ..., \"F-\"). team_key ( str ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the Player child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: bye_weeks ( ByeWeeks ) \u2013 A YFPY ByeWeeks instance. bye ( int ) \u2013 The week number that the player is on bye. display_position ( str ) \u2013 The display string for the player position. draft_analysis ( DraftAnalysis ) \u2013 A YFPY DraftAnalysis instance. average_draft_pick ( float ) \u2013 The average pick at which the player was drafted. average_draft_round ( float ) \u2013 The average round in which the player was drafted. average_draft_cost ( float ) \u2013 The average price paid for the player to be drafted. percent_drafted ( float ) \u2013 The overall percentage the player was drafted. editorial_player_key ( str ) \u2013 The Yahoo player key using the game key. editorial_team_abbr ( str ) \u2013 The abbreviation of the professional team name for which the player plays. editorial_team_full_name ( str ) \u2013 The name of the professional team for which the player plays. editorial_team_key ( str ) \u2013 The Yahoo team key of the professional team for which the player plays using the game key. editorial_team_url ( str ) \u2013 The direct URL of the professional team for which the player plays on Yahoo Sports. eligible_positions ( list [ str ] ) \u2013 A list of positions for which the player is eligible. eligible_positions_to_add ( list [ str ] ) \u2013 A list of positions for which the player can have eligibility added. has_player_notes ( int ) \u2013 Numeric boolean (0 or 1) representing if the player has any notes. has_recent_player_notes ( int ) \u2013 Numeric boolean (0 or 1) representing if the player has any recent notes. headshot ( Headshot ) \u2013 A YFPY Headshot instance. headshot_size ( str ) \u2013 The player headshot photo size (\"small\", \"large\", etc.) headshot_url ( str ) \u2013 The direct URL of the player headshot photo. image_url ( str ) \u2013 The direct URL of the player headshot photo. injury_note ( str ) \u2013 The physical part of the player that is injured if the player has an injury. is_editable ( int ) \u2013 Numeric boolean (0 or 1) representing if the player is editable. is_keeper ( int ) \u2013 Numeric boolean (0 or 1) representing if the player is a keeper. is_undroppable ( int ) \u2013 Numeric boolean (0 or 1) representing if the player is undroppable. name ( Name ) \u2013 A YFPY Name instance. first_name ( str ) \u2013 The first name of the player. last_name ( str ) \u2013 The last name of the player. full_name ( str ) \u2013 The full name of the player. ownership ( Ownership ) \u2013 A YFPY Ownership instance. percent_owned ( PercentOwned ) \u2013 A YFPY PercentOwned instanced. percent_owned_value ( float ) \u2013 The percentage value the player is/was owned in the coverage timeframe. player_id ( int ) \u2013 The unique player ID. player_key ( str ) \u2013 The Yahoo player key. player_notes_last_timestamp ( int ) \u2013 A timestamp of the most recent players notes. player_points ( PlayerPoints ) \u2013 A YFPY PlayerPoints instance. player_points_value ( float ) \u2013 The total points for the player within the coverage timeframe. player_stats ( PlayerStats ) \u2013 A YFPY PlayerStats instance. stats ( list [ Stat ] ) \u2013 A list of YFPY Stat instances. position_type ( str ) \u2013 The position type of the player (\"offense\", \"defense\", etc.). primary_position ( str ) \u2013 The primary position of the player. selected_position ( SelectedPosition ) \u2013 A YFPY SelectedPosition instance. selected_position_value ( str ) \u2013 The selected position of the player. status ( str ) \u2013 The status abbreviation of the player (\"IR\", \"PUP\", \"O\", \"Q\", etc.). status_full ( str ) \u2013 The unabbreviated status of the player (\"Questionable\", etc.). transaction_data ( TransactionData ) \u2013 A YFPY TransactionData instance. uniform_number ( int ) \u2013 The uniform number of the player. url ( str ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the ByeWeeks child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: week ( int ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the DraftAnalysis child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: average_pick ( float ) \u2013 The average pick at which the player was drafted. average_round ( float ) \u2013 The average round in which the player was drafted. average_cost ( float ) \u2013 The average price paid for the player to be drafted. percent_drafted ( float ) \u2013 The overall percentage the player was drafted. preseason_average_cost ( float ) \u2013 The average price paid for the player to be drafted in the preseason. preseason_average_pick ( float ) \u2013 The average pick at which the player was drafted in the preseason. preseason_average_round ( float ) \u2013 The average round in which the player was drafted in the preseason. preseason_percent_drafted ( float ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the Headshot child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: size ( str ) \u2013 The size of the headshot photo (\"small\", \"large\", etc.) url ( str ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the Name child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: ascii_first ( str ) \u2013 The ASCII encoded string of the first name of the player. ascii_last ( str ) \u2013 The ASCII encoded string of the last name of the player. first ( str ) \u2013 The first name of the player. full ( str ) \u2013 The full name of the player. last ( str ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the Ownership child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: display_date ( int ) \u2013 The week number the player went on waivers (when applicable). ownership_type ( str ) \u2013 The current location of the player in the league (\"team\", \"waivers\", etc.). owner_team_key ( str ) \u2013 The Yahoo team key for the team that owns the player. owner_team_name ( str ) \u2013 The team name for the team that owns the player. teams ( list [ Team ] ) \u2013 A list of YFPY Team instances. waiver_date ( str ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the PercentOwned child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: coverage_type ( str ) \u2013 The timeframe for the selected player ownership (\"week\", \"date\", \"season\", etc.). week ( int ) \u2013 The week number (when applicable). value ( int ) \u2013 The percentage value the player is/was owned in the coverage timeframe. delta ( float ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the PlayerAdvancedStats child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: coverage_type ( str ) \u2013 The timeframe for the selected player advanced stats (\"week\", \"date\", \"season\", etc.). season ( int ) \u2013 The season year (when applicable). stats ( list [ Stat ] ) \u2013 A list of advanced YFPY Stat instances for the player. week ( int ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the PlayerPoints child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: coverage_type ( str ) \u2013 The timeframe for the selected player points (\"week\", \"date\", \"season\", etc.). season ( int ) \u2013 The season year (when applicable). total ( float ) \u2013 The total points for the player within the coverage timeframe. week ( int ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the PlayerStats child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: coverage_type ( str ) \u2013 The timeframe for the selected player stats (\"week\", \"date\", \"season\", etc.). date ( str ) \u2013 The YYYY-MM-DD formatted date string (when applicable). season ( int ) \u2013 The season year (when applicable). stats ( list [ Stat ] ) \u2013 A list of YFPY Stat instances for the player. week ( int ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the SelectedPosition child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: coverage_type ( str ) \u2013 The timeframe for the selected position (\"week\", \"date\", \"season\", etc.). date ( str ) \u2013 The YYYY-MM-DD formatted date string (when applicable). is_flex ( int ) \u2013 Numeric boolean (0 or 1) representing if the selected player is in a flex roster slot. position ( str ) \u2013 The selected position of the player. week ( int ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the TransactionData child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: destination_team_key ( str ) \u2013 The Yahoo team key for the receiving team. destination_team_name ( str ) \u2013 The name of the receiving team. destination_type ( str ) \u2013 The destination of the player (waivers, free agency, another team, etc.). source_team_key ( str ) \u2013 The Yahoo team key of the sending team. source_team_name ( str ) \u2013 The name of the sending team. source_type ( str ) \u2013 The origin of the player (waivers, free agency, another team, etc.). type ( str ) \u2013 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\" , \"\" )","title":"Models"},{"location":"models/#models","text":"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 ) \u2013 Module level logger for usage and debugging.","title":"Models"},{"location":"models/#yfpy.models.YahooFantasyObject","text":"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 )","title":"YahooFantasyObject"},{"location":"models/#yfpy.models.YahooFantasyObject.__init__","text":"__init__ ( extracted_data ) Instantiate a Yahoo Fantasy Object. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: extracted_data ( dict ) \u2013 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 ())","title":"__init__"},{"location":"models/#yfpy.models.YahooFantasyObject.__str__","text":"__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 () } )\"","title":"__str__"},{"location":"models/#yfpy.models.YahooFantasyObject.__repr__","text":"__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 () } )\"","title":"__repr__"},{"location":"models/#yfpy.models.YahooFantasyObject.__getattribute__","text":"__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","title":"__getattribute__"},{"location":"models/#yfpy.models.YahooFantasyObject.subclass_dict","text":"subclass_dict () Derive snake case dictionary keys from custom object type camel case class names. Returns: dict ( Dict ) \u2013 Dictionary with snake case strings of all subclasses of YahooFantasyObject as keys and subclasses as Dict \u2013 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__ ()}","title":"subclass_dict"},{"location":"models/#yfpy.models.YahooFantasyObject.clean_data_dict","text":"clean_data_dict () Recursive method to un-type custom class type objects for serialization. Returns: dict ( Dict ) \u2013 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","title":"clean_data_dict"},{"location":"models/#yfpy.models.YahooFantasyObject.serialized","text":"serialized () Pack up all object content into nested dictionaries for JSON serialization. Returns: dict ( Dict ) \u2013 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","title":"serialized"},{"location":"models/#yfpy.models.YahooFantasyObject.to_json","text":"to_json () Serialize the class object to JSON. Returns: str ( str ) \u2013 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 ())","title":"to_json"},{"location":"models/#yfpy.models.YahooFantasyObject.from_json","text":"from_json ( json_data ) Deserialize JSON to a class object. Returns: object ( object ) \u2013 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 )","title":"from_json"},{"location":"models/#yfpy.models.User","text":"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\" , \"\" )","title":"User"},{"location":"models/#yfpy.models.User.__init__","text":"__init__ ( extracted_data ) Instantiate the User child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: games ( list [ Game ] ) \u2013 The Yahoo Fantasy games in which the user participates/has participated. guid ( str ) \u2013 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\" , \"\" )","title":"__init__"},{"location":"models/#yfpy.models.Game","text":"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\" , \"\" )","title":"Game"},{"location":"models/#yfpy.models.Game.__init__","text":"__init__ ( extracted_data ) Instantiate the Game child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: code ( str ) \u2013 The Yahoo Fantasy game code. contest_group_id ( int ) \u2013 The contest group ID of the Yahoo Fantasy game/contest. current_week ( int ) \u2013 The current (or last if complete) week of the Yahoo Fantasy game/contest. editorial_season ( int ) \u2013 The year in which the Yahoo Fantasy game/contest starts. game_id ( int ) \u2013 The Yahoo Fantasy game ID. game_key ( str ) \u2013 The Yahoo Fantasy game key. game_weeks ( list [ GameWeek ] ) \u2013 A list of YFPY GameWeek instances. has_schedule ( int ) \u2013 Numeric boolean (0 or 1) representing if the Yahoo Fantasy contest has a schedule. is_contest_over ( int ) \u2013 Numeric boolean (0 or 1) representing if the Yahoo Fantasy contest is complete. is_contest_reg_active ( int ) \u2013 Numeric boolean (0 or 1) representing if the Yahoo Fantasy contest is active. is_game_over ( int ) \u2013 Numeric boolean (0 or 1) representing if the Yahoo Fantasy game is complete. is_live_draft_lobby_active ( int ) \u2013 Numeric boolean (0 or 1) representing if the draft lobby is active. is_offseason ( int ) \u2013 Numeric boolean (0 or 1) representing if it is the offseason for the respective sport. is_registration_over ( int ) \u2013 Numeric boolean (0 or 1) representing registration for the fantasy game is over. leagues ( list [ League ] ) \u2013 A list of YFPY League instances. name ( str ) \u2013 The name of the Yahoo Fantasy game. picks_status ( str ) \u2013 The status of the Yahoo Fantasy game/contest picks when applicable. players ( list [ Player ] ) \u2013 A list of YFPY Player instances. position_types ( list [ PositionType ] ) \u2013 A list of YFPY PositionType instances. roster_positions ( list [ RosterPosition ] ) \u2013 A list of YFPY RosterPosition instances. scenario_generator ( int ) \u2013 Numeric boolean (0 or 1) representing if the Yahoo Fantasy game has a scenario generator. season ( int ) \u2013 The Yahoo Fantasy game year. stat_categories ( StatCategories ) \u2013 A YFPY StatCategories instance. teams ( list [ Team ] ) \u2013 A list of YFPY Team instances. type ( str ) \u2013 The type of the Yahoo Fantasy game. url ( str ) \u2013 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\" , \"\" )","title":"__init__"},{"location":"models/#yfpy.models.GameWeek","text":"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 )","title":"GameWeek"},{"location":"models/#yfpy.models.GameWeek.__init__","text":"__init__ ( extracted_data ) Instantiate the GameWeek child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: display_name ( str ) \u2013 The display name of the Yahoo Fantasy game week. end ( str ) \u2013 The end date of the Yahoo Fantasy game week. start ( str ) \u2013 The start date of the Yahoo Fantasy game week. week ( int ) \u2013 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 )","title":"__init__"},{"location":"models/#yfpy.models.PositionType","text":"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\" , \"\" )","title":"PositionType"},{"location":"models/#yfpy.models.PositionType.__init__","text":"__init__ ( extracted_data ) Instantiate the PositionType child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: type ( str ) \u2013 The type of the player position (\"offense\", \"defense\", etc.). display_name ( str ) \u2013 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\" , \"\" )","title":"__init__"},{"location":"models/#yfpy.models.League","text":"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\" , \"\" )","title":"League"},{"location":"models/#yfpy.models.League.__init__","text":"__init__ ( extracted_data ) Instantiate the League child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: allow_add_to_dl_extra_pos ( int ) \u2013 Numeric boolean (0 or 1) representing if the leagues allows adding extra positions to the DL (currently uncertain what this is). current_week ( int ) \u2013 The current week number. draft_results ( list [ DraftResult ] ) \u2013 A list of YFPY DraftResult instances. draft_status ( str ) \u2013 The status of the draft (\"postdraft\", etc.). display_name ( str ) \u2013 The display name of the league. edit_key ( int ) \u2013 The Yahoo edit key for the league. end_date ( str ) \u2013 A date string representing the end date of the league (format: \"YYYY-MM-DD\"). end_week ( int ) \u2013 The number of the last week of the league. entry_fee ( str ) \u2013 The entry fee for Yahoo paid leagues (USD). felo_tier ( str ) \u2013 The league fantasy ELO level (Bronze, Silver, Gold, Platinum, Diamond). game_code ( str ) \u2013 The Yahoo game code (\"nfl\", \"nhl\", \"nba\", \"mlb\"). iris_group_chat_id ( str | null ) \u2013 The unique IRIS group chat ID for the league. is_cash_league ( int ) \u2013 Numeric boolean (0 or 1) representing if the league is a Yahoo paid league. is_finished ( int ) \u2013 Numeric boolean (0 or 1) representing if the league season has completed. is_plus_league ( int ) \u2013 Numeric boolean (0 or 1) representing if the league has paid for Yahoo Fantasy Plus. is_pro_league ( str ) \u2013 Numeric boolean (0 or 1) representing if the league is a Yahoo Pro league. league_id ( str ) \u2013 The unique Yahoo league ID. league_key ( str ) \u2013 The Yahoo league key. league_type ( str ) \u2013 The type of the league (\"private\", \"public\"). league_update_timestamp ( int ) \u2013 A timestamp representing the last time the league was updated. logo_url ( str ) \u2013 The direct URL of the league logo photo. name ( str ) \u2013 The name of the league. num_teams ( str ) \u2013 The number of teams in the league. password ( str | null ) \u2013 The password required to join the league (if applicable). payment_deadline ( str ) \u2013 A date string representing the deadline by which all league dues payments must be made (format: \"YYYY-MM-DD\"). players ( list [ Player ] ) \u2013 A list of YFPY Player instances. renew ( str | null ) \u2013 A string indicating the previous Yahoo game code and previous Yahoo league ID (Ex.: \"371_811308\") (if applicable). renewed ( str | null ) \u2013 A string indicating the next Yahoo game code and next Yahoo league ID (Ex.: \"390_303233\") (if applicable). scoreboard ( Scoreboard ) \u2013 A YFPY Scoreboard instance. matchups ( list [ Matchup ] ) \u2013 A list of YFPY Matchup instances. scoring_type ( str ) \u2013 The scoring type of the league (\"head\" for head-to-head, etc.). season ( int ) \u2013 The season year of the league. settings ( Settings ) \u2013 A YFPY Settings instance. short_invitation_url ( str ) \u2013 The sharable short URL sent by invite allowing players to join the league. standings ( Standings ) \u2013 A YFPY Standings instance. start_date ( str ) \u2013 A date string representing the start date of the league (format: \"YYYY-MM-DD\"). start_week ( int ) \u2013 The number of the first week of the league. teams ( list [ Team ] ) \u2013 A list of YFPY Team instances. teams_ordered_by_standings ( list [ Team ] ) \u2013 A list of YFPY Team instances ordered by their ranks in the league standings. transactions ( list [ Transaction ] ) \u2013 A list of YFPY Transaction instances. url ( str ) \u2013 The direct URL of the league. weekly_deadline ( str | null ) \u2013 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\" , \"\" )","title":"__init__"},{"location":"models/#yfpy.models.Team","text":"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 )","title":"Team"},{"location":"models/#yfpy.models.Team.__init__","text":"__init__ ( extracted_data ) Instantiate the Team child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: can_edit_current_week ( int ) \u2013 (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 ) \u2013 (for Tourney Pick'em) The selected champion for the contest. champion_status ( str ) \u2013 (for Tourney Pick'em) The final status of the selected champion for the contest. clinched_playoffs ( int ) \u2013 Numeric boolean (0 or 1) representing if the team has clinched a playoff berth. division_id ( int ) \u2013 The unique ID number of the division containing the team (if applicable). done_week ( str ) \u2013 (might be for Tourney Pick'em or Survival Football) ATTRIBUTE MEANING UNKNOWN. draft_grade ( str ) \u2013 The letter grade assigned to the draft completed by the team (\"A+\", \"A\", ..., \"F-\"). draft_position ( int ) \u2013 The draft order/position of the team. draft_recap_url ( str ) \u2013 The direct URL of the draft recap for the team. draft_results ( list [ DraftResult ] ) \u2013 A list of YFPY DraftResult instances. elimination_week ( int ) \u2013 (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 ) \u2013 (for Tourney Pick'em) The email address of the user competing in the contest. faab_balance ( int ) \u2013 The available balance of FAAB (Free Agent Acquisition Budget) (if applicable). has_draft_grade ( int ) \u2013 Numeric boolean (0 or 1) representing if the team has a draft grade available. is_in_contest ( int ) \u2013 (for Survival Football) Numeric boolean (0 or 1) representing if the user is in a contest. is_owned_by_current_login ( int ) \u2013 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 ) \u2013 (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 ) \u2013 Value designating the type of scoring used by the league (\"head\" for head-to-head, etc.). logo_type ( str ) \u2013 (for Tourney Pick'em) The team logo type (\"avatar\", etc.) of the user competing in the contest. manager ( Manager ) \u2013 (for Survival Football) A YFPY Manager instance for the user competing in the contest. managers ( list [ Manager ] | dict [ str , Manager ] ) \u2013 A list or dict (depending on source data) of YFPY Manager instances. matchups ( list [ Matchup ] ) \u2013 A list of YFPY Matchup instances. name ( str ) \u2013 The team name. number_of_moves ( int ) \u2013 The number of moves made by the team (adds/drops/trades/etc.). number_of_trades ( int ) \u2013 The number of trades made by the team. roster ( Roster ) \u2013 A YFPY Roster instance. players ( list [ Player ] ) \u2013 A list of YFPY Player instances. roster_adds ( RosterAdds ) \u2013 A YFPY RosterAdds instance. roster_adds_value ( int ) \u2013 The number of roster adds made by the team. team_id ( int ) \u2013 The unique team ID in the league. team_key ( str ) \u2013 The Yahoo team key. team_logo ( str ) \u2013 (for Tourney Pick'em) The direct URL to the team logo of the user competing in the contest. team_logos ( list [ TeamLogo ] ) \u2013 A list of YFPY TeamLogo instances. team_paid ( int ) \u2013 Numeric boolean (0 or 1) representing if the team has paid for Yahoo Fantasy Plus. team_points ( TeamPoints ) \u2013 A YFPY TeamPoints instance. points ( float ) \u2013 The total points scored by the team. team_projected_points ( TeamProjectedPoints ) \u2013 A YFPY TeamProjectedPoints instance. projected_points ( float ) \u2013 The total projected points for the team. team_standings ( TeamStandings ) \u2013 A YFPY TeamStandings instance. wins ( int ) \u2013 The number of wins by the team. losses ( int ) \u2013 The number of losses by the team. ties ( int ) \u2013 The number of ties by the team. percentage ( float ) \u2013 The win percentage of the team. playoff_seed ( int ) \u2013 The playoff seed of the team. points_against ( float ) \u2013 The total team points against. points_for ( float ) \u2013 The total team points for. rank ( int ) \u2013 The rank of the team in the league standings. status ( str ) \u2013 (for Survival Football) The status of user competing in the contest (\"dead\", etc.). streak_type ( str ) \u2013 The active team win/loss/tie streak. streak_length ( int ) \u2013 The length of the streak. total_strikes ( int ) \u2013 (for Survival Football) The total number of strikes (incorrect selections) made by the user competing in the contest. url ( str ) \u2013 The direct URL to the team. user_display_name ( str ) \u2013 (for Tourney Pick'em) The display name for the user competing in the contest. user_profile_image ( str ) \u2013 (for Tourney Pick'em) The direct URL to the profile image of the user competing in the contest. waiver_priority ( int ) \u2013 The waiver priority of the team. win_probability ( float ) \u2013 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 )","title":"__init__"},{"location":"models/#yfpy.models.DraftResult","text":"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\" , \"\" )","title":"DraftResult"},{"location":"models/#yfpy.models.DraftResult.__init__","text":"__init__ ( extracted_data ) Instantiate the DraftResult child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: cost ( int ) \u2013 The player cost (for auction drafts). pick ( int ) \u2013 The draft pick number. round ( int ) \u2013 The draft round. team_key ( str ) \u2013 The Yahoo team key of the team that made the draft pick. player_key ( str ) \u2013 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\" , \"\" )","title":"__init__"},{"location":"models/#yfpy.models.Standings","text":"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\" , [])","title":"Standings"},{"location":"models/#yfpy.models.Standings.__init__","text":"__init__ ( extracted_data ) Instantiate the Standings child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: teams ( list [ Team ] ) \u2013 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\" , [])","title":"__init__"},{"location":"models/#yfpy.models.Transaction","text":"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\" , \"\" )","title":"Transaction"},{"location":"models/#yfpy.models.Transaction.__init__","text":"__init__ ( extracted_data ) Instantiate the Transaction child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: players ( list [ Player ] ) \u2013 A list of YFPY Player instances. status ( str ) \u2013 The transaction status (\"successful\", etc.). timestamp ( int ) \u2013 The timestamp of when the transaction occurred. tradee_team_key ( str ) \u2013 The Yahoo team key for the team receiving the player (if applicable). tradee_team_name ( str ) \u2013 The team name of the team receiving the player (if applicable). trader_team_key ( str ) \u2013 The Yahoo team key for the team sending the player (if applicable). trader_team_name ( str ) \u2013 The team name for the team sending the player (if applicable). transaction_id ( int ) \u2013 The unique transaction ID number. transaction_key ( str ) \u2013 The Yahoo transaction key (Ex.: \"406.l.413954.tr.555\"). type ( str ) \u2013 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\" , \"\" )","title":"__init__"},{"location":"models/#yfpy.models.Pick","text":"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 .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. \"\"\" 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\" , \"\" )","title":"Pick"},{"location":"models/#yfpy.models.Pick.__init__","text":"__init__ ( extracted_data ) Instantiate the Pick child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: destination_team_key ( str ) \u2013 Team key in the format .l. .t. of the team receiving the pick in the transaction. destination_team_name ( str ) \u2013 Team name of the team receiving the pick in the transaction. original_team_key ( str ) \u2013 Team key in the format .l. .t. of the team to which the pick in the transaction originally belonged. original_team_name ( str ) \u2013 Team name of the team to which the pick in the transaction originally belonged. round ( int ) \u2013 The draft round of the pick in the transaction. source_team_key ( str ) \u2013 Team key in the format .l. .t. of the team sending the pick in the transaction. source_team_name ( str ) \u2013 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 .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. \"\"\" 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\" , \"\" )","title":"__init__"},{"location":"models/#yfpy.models.Manager","text":"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\" , \"\" )","title":"Manager"},{"location":"models/#yfpy.models.Manager.__init__","text":"__init__ ( extracted_data ) Instantiate the Manager child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: email ( str ) \u2013 The email address of the manager. emails ( list [ str ] ) \u2013 (for Survival Football) List of email addresses for the manager competing in the contest. fantasy_profile_url ( str ) \u2013 (for Survival Football) The direct URL for the profile of the manager competing in the contest. felo_score ( int ) \u2013 The manager fantasy ELO rating. felo_tier ( str ) \u2013 The manager fantasy ELO level (Bronze, Silver, Gold, Platinum, Diamond). guid ( str ) \u2013 The unique Yahoo GUID of the user account associated with manager. image_url ( str ) \u2013 The direct URL of the manager profile image. is_comanager ( int ) \u2013 Numeric boolean (0 or 1) representing if the manager is a co-manager. is_commissioner ( int ) \u2013 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 ) \u2013 Numeric boolean (0 or 1) representing if the manager is the current user authenticated with the Yahoo Fantasy Sports REST API. manager_id ( int ) \u2013 The unique manager ID in the league. nickname ( str ) \u2013 The display nickname of the manager. profile_image_url ( str ) \u2013 (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\" , \"\" )","title":"__init__"},{"location":"models/#yfpy.models.Roster","text":"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\" , [])","title":"Roster"},{"location":"models/#yfpy.models.Roster.__init__","text":"__init__ ( extracted_data ) Instantiate the Roster child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: coverage_type ( str ) \u2013 The timeframe for the selected roster (\"week\", \"date\", \"season\", etc.). week ( int ) \u2013 The week number. is_editable ( int ) \u2013 Numeric boolean (0 or 1) representing if the roster is editable. is_prescoring ( int ) \u2013 Numeric boolean (0 or 1) representing if the roster is in a prescoring state. players ( list [ Player ] ) \u2013 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\" , [])","title":"__init__"},{"location":"models/#yfpy.models.RosterAdds","text":"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 )","title":"RosterAdds"},{"location":"models/#yfpy.models.RosterAdds.__init__","text":"__init__ ( extracted_data ) Instantiate the RosterAdds child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: coverage_type ( str ) \u2013 The timeframe for the selected roster (\"week\", \"date\", \"season\", etc.). coverage_value ( int ) \u2013 The value of the coverage type (week number, for instance). value ( int ) \u2013 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 )","title":"__init__"},{"location":"models/#yfpy.models.TeamLogo","text":"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\" , \"\" )","title":"TeamLogo"},{"location":"models/#yfpy.models.TeamLogo.__init__","text":"__init__ ( extracted_data ) Instantiate the TeamLogo child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: size ( str ) \u2013 The size of the team logo photo (\"small\", \"large\", etc.) url ( str ) \u2013 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\" , \"\" )","title":"__init__"},{"location":"models/#yfpy.models.TeamPoints","text":"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 )","title":"TeamPoints"},{"location":"models/#yfpy.models.TeamPoints.__init__","text":"__init__ ( extracted_data ) Instantiate the TeamPoints child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: coverage_type ( str ) \u2013 The timeframe for the selected team points (\"week\", \"date\", \"season\", etc.). season ( int ) \u2013 The season year. total ( float ) \u2013 The total team points for the coverage timeframe. week ( int ) \u2013 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 )","title":"__init__"},{"location":"models/#yfpy.models.TeamProjectedPoints","text":"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 )","title":"TeamProjectedPoints"},{"location":"models/#yfpy.models.TeamProjectedPoints.__init__","text":"__init__ ( extracted_data ) Instantiate the TeamProjectedPoints child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: coverage_type ( str ) \u2013 The timeframe for the selected team projected points (\"week\", \"date\", \"season\", etc.). total ( float ) \u2013 The total team projected points for the coverage timeframe. week ( int ) \u2013 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 )","title":"__init__"},{"location":"models/#yfpy.models.TeamStandings","text":"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 ({}))","title":"TeamStandings"},{"location":"models/#yfpy.models.TeamStandings.__init__","text":"__init__ ( extracted_data ) Instantiate the TeamStandings child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: divisional_outcome_totals ( DivisionalOutcomeTotals ) \u2013 A list of YFPY DivisionalOutcomeTotals instances. outcome_totals ( OutcomeTotals ) \u2013 A YFPY OutcomeTotals instance. playoff_seed ( int ) \u2013 The playoff seed position for the team. points_against ( float ) \u2013 The total team points against. points_for ( float ) \u2013 The total team points for. rank ( int ) \u2013 The rank of the team in the league standings. streak ( Streak ) \u2013 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 ({}))","title":"__init__"},{"location":"models/#yfpy.models.DivisionalOutcomeTotals","text":"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 )","title":"DivisionalOutcomeTotals"},{"location":"models/#yfpy.models.DivisionalOutcomeTotals.__init__","text":"__init__ ( extracted_data ) Instantiate the DivisionOutcomeTotals child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: losses ( int ) \u2013 The number of losses by the team within the division. ties ( int ) \u2013 The number of ties by the team within the division. wins ( int ) \u2013 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 )","title":"__init__"},{"location":"models/#yfpy.models.OutcomeTotals","text":"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 )","title":"OutcomeTotals"},{"location":"models/#yfpy.models.OutcomeTotals.__init__","text":"__init__ ( extracted_data ) Instantiate the OutcomeTotals child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: losses ( int ) \u2013 The number of losses by the team. percentage ( float ) \u2013 The win percentage of the team. ties ( int ) \u2013 The number of ties by the team. wins ( int ) \u2013 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 )","title":"__init__"},{"location":"models/#yfpy.models.Streak","text":"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 )","title":"Streak"},{"location":"models/#yfpy.models.Streak.__init__","text":"__init__ ( extracted_data ) Instantiate the Streak child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: type ( str ) \u2013 The streak type (\"W\" for win, \"L\" for loss, \"T\" for tie). value ( int ) \u2013 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 )","title":"__init__"},{"location":"models/#yfpy.models.Scoreboard","text":"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 )","title":"Scoreboard"},{"location":"models/#yfpy.models.Scoreboard.__init__","text":"__init__ ( extracted_data ) Instantiate the Scoreboard child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: matchups ( list [ Matchup ] ) \u2013 A list of YFPY Matchup instances representing the matchups for the week. week ( int ) \u2013 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 )","title":"__init__"},{"location":"models/#yfpy.models.Settings","text":"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\" , \"\" )","title":"Settings"},{"location":"models/#yfpy.models.Settings.__init__","text":"__init__ ( extracted_data ) Instantiate the Settings child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: cant_cut_list ( int ) \u2013 Numeric boolean (0 or 1) representing if the league uses the Yahoo \"can't cut list\". divisions ( list [ Division ] ) \u2013 A list of YFPY Division instances for leagues with divisions. draft_pick_time ( int ) \u2013 The number of seconds allowed to make each draft pick. draft_time ( int ) \u2013 A timestamp representing when the draft will start. draft_together ( int ) \u2013 Numeric boolean (0 or 1) representing if the league uses Yahoo Fantasy Draft Together live video chat during online drafts. draft_type ( str ) \u2013 The type of draft (\"live\", \"offline\", etc.) has_multiweek_championship ( int ) \u2013 Numeric boolean (0 or 1) representing if the league has a multi-week championship matchup. has_playoff_consolation_games ( bool ) \u2013 Numeric boolean (0 or 1) representing if the league has a consolation playoff bracket. is_auction_draft ( int ) \u2013 Numeric boolean (0 or 1) representing if the league uses an auction draft. league_premium_features ( List ) \u2013 List of features enables as part of subscription to Yahoo Fantasy Plus or Yahoo Fantasy Commissioner Plus. max_teams ( int ) \u2013 The maximum number of teams allowed in the league. num_playoff_consolation_teams ( int ) \u2013 The number of teams that make the consolation playoff bracket. num_playoff_teams ( int ) \u2013 The number of teams that make the playoffs. persistent_url ( str ) \u2013 Custom URL configured for the league that remains the same every season. pickem_enabled ( int ) \u2013 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 ) \u2013 Value designating what player pool is allowed for the league (\"ALL\", etc.). playoff_start_week ( int ) \u2013 The week number on which the playoffs start. post_draft_players ( str ) \u2013 Value designating what happens to players after the draft (\"W\" for waivers, etc.). roster_positions ( list [ RosterPosition ] ) \u2013 A list of YFPY RosterPosition instances. scoring_type ( str ) \u2013 Value designating what type of scoring the league uses (\"head\" for head-to-head, etc.). sendbird_channel_url ( str ) \u2013 The in-app Sendbird channel ID. stat_categories ( StatCategories ) \u2013 A YFPY StatCategories instance. stat_modifiers ( StatModifiers ) \u2013 A YFPY StatModifiers instance. trade_end_date ( str ) \u2013 A date string representing when trading is no longer allowed (format: \"YYYY-MM-DD\"). trade_ratify_type ( str ) \u2013 Value designating how trades are ratified (\"commish\" for commissioner, etc.). trade_reject_time ( int ) \u2013 The number of days during which a trade can be rejected. uses_faab ( int ) \u2013 Numeric boolean (0 or 1) representing if the league uses FAAB (Free Agent Acquisition Budget). uses_fractional_points ( int ) \u2013 Numeric boolean (0 or 1) representing if the league allows fractional scoring. uses_lock_eliminated_teams ( int ) \u2013 Numeric boolean (0 or 1) representing if the league locks teams eliminated from the playoffs. uses_median_score ( int ) \u2013 (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 ) \u2013 Numeric boolean (0 or 1) representing if the league allows negative scoring. uses_playoffs ( int ) \u2013 Numeric boolean (0 or 1) representing if the league has playoffs. uses_playoff_reseeding ( int ) \u2013 Numeric boolean (0 or 1) representing if the league reseeds the playoffs once the fantasy regular season is complete. waiver_rule ( str ) \u2013 Value designating when players go to waivers (\"gametime\", etc.). waiver_time ( int ) \u2013 The number of days that players remain on waivers. waiver_type ( str ) \u2013 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\" , \"\" )","title":"__init__"},{"location":"models/#yfpy.models.Division","text":"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\" , \"\" )","title":"Division"},{"location":"models/#yfpy.models.Division.__init__","text":"__init__ ( extracted_data ) Instantiate the Division child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: division_id ( int ) \u2013 The unique division ID number in the league. name ( str ) \u2013 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\" , \"\" )","title":"__init__"},{"location":"models/#yfpy.models.RosterPosition","text":"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\" , \"\" )","title":"RosterPosition"},{"location":"models/#yfpy.models.RosterPosition.__init__","text":"__init__ ( extracted_data ) Instantiate the RosterPosition child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: abbreviation ( str ) \u2013 The abbreviated position string. count ( int ) \u2013 The number of roster slots available for this position. display_name ( str ) \u2013 The unabbreviated position string. is_bench ( int ) \u2013 Numeric boolean (0 or 1) representing if the roster position is the bench position. is_starting_position ( int ) \u2013 Numeric boolean (0 or 1) representing if the roster position is in the starting lineup and scores points. position ( str ) \u2013 The abbreviated position string. position_type ( str ) \u2013 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\" , \"\" )","title":"__init__"},{"location":"models/#yfpy.models.StatCategories","text":"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\" , [])","title":"StatCategories"},{"location":"models/#yfpy.models.StatCategories.__init__","text":"__init__ ( extracted_data ) Instantiate the StatCategories child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: groups ( list [ Group ] ) \u2013 A list of YFPY Group instances representing the stat categories groups. stats ( list [ Stat ] ) \u2013 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\" , [])","title":"__init__"},{"location":"models/#yfpy.models.Group","text":"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\" , \"\" )","title":"Group"},{"location":"models/#yfpy.models.Group.__init__","text":"__init__ ( extracted_data ) Instantiate the Group child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: group_abbr ( str ) \u2013 The abbreviated display name of the stat categories group. group_display_name ( str ) \u2013 The display name of the stat categories group. group_name ( str ) \u2013 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\" , \"\" )","title":"__init__"},{"location":"models/#yfpy.models.StatModifiers","text":"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\" , [])","title":"StatModifiers"},{"location":"models/#yfpy.models.StatModifiers.__init__","text":"__init__ ( extracted_data ) Instantiate the StatModifiers child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: stats ( list [ Stat ] ) \u2013 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\" , [])","title":"__init__"},{"location":"models/#yfpy.models.Stat","text":"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 )","title":"Stat"},{"location":"models/#yfpy.models.Stat.__init__","text":"__init__ ( extracted_data ) Instantiate the Stat child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: abbr ( str ) \u2013 The abbreviated display name of the stat. bonuses ( list [ Bonus ] ) \u2013 A list of YFPY Bonus instances available for this stat category. display_name ( str ) \u2013 The display name of the stat. enabled ( int ) \u2013 Numeric boolean (0 or 1) representing if this stat is enabled for league scoring. group ( str ) \u2013 The stat category (\"misc\", \"yds_allow\", \"return\", \"receiving\", \"rushing\", \"passing\", etc.) is_excluded_from_display ( int ) \u2013 Numeric boolean (0 or 1) representing if this stat is not displayed. is_only_display_stat ( int ) \u2013 Numeric boolean (0 or 1) representing if this stat is only for display. name ( str ) \u2013 The full name of the stat. position_type ( str ) \u2013 The player position type eligible for the stat. position_types ( list[PositionType ) \u2013 A list of YFPY PositionType instances. sort_order ( int ) \u2013 Numeric boolean (0 or 1) representing if the stat is sorted highest to lowest (1) or lowest to highest (0). stat_id ( int ) \u2013 The unique stat ID number in the league. stat_position_types ( list [ PositionType ] ) \u2013 A list of YFPY PositionType instances. value ( float ) \u2013 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 )","title":"__init__"},{"location":"models/#yfpy.models.StatPositionType","text":"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\" , \"\" )","title":"StatPositionType"},{"location":"models/#yfpy.models.StatPositionType.__init__","text":"__init__ ( extracted_data ) Instantiate the StatPositionType child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: is_only_display_stat ( int ) \u2013 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 ) \u2013 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\" , \"\" )","title":"__init__"},{"location":"models/#yfpy.models.Bonus","text":"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 )","title":"Bonus"},{"location":"models/#yfpy.models.Bonus.__init__","text":"__init__ ( extracted_data ) Instantiate the Bonus child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: points ( float ) \u2013 The points awarded when the bonus is won. target ( int ) \u2013 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 )","title":"__init__"},{"location":"models/#yfpy.models.Matchup","text":"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\" , \"\" )","title":"Matchup"},{"location":"models/#yfpy.models.Matchup.__init__","text":"__init__ ( extracted_data ) Instantiate the Matchup child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: is_consolation ( int ) \u2013 Numeric boolean (0 or 1) representing if the matchup is in a consolation bracket. is_matchup_recap_available ( int ) \u2013 Numeric boolean (0 or 1) representing if the matchup recap is available. is_playoffs ( int ) \u2013 Numeric boolean (0 or 1) representing if the matchup is in the playoffs bracket. is_tied ( int ) \u2013 Numeric boolean (0 or 1) representing if the matchup result is tied. matchup_grades ( list [ MatchupGrade ] ) \u2013 A list of YFPY MatchupGrade instances. matchup_recap_title ( str ) \u2013 The title of the matchup recap. matchup_recap_url ( str ) \u2013 The direct URL of the matchup recap. status ( str ) \u2013 The status of the matchup (\"postevent\", etc.). teams ( list [ Team ] ) \u2013 A list of YFPY Team instances for teams in the matchup. week ( int ) \u2013 The week number of the matchup. week_end ( str ) \u2013 A date string representing the end of the matchup week (format: \"YYYY-MM-DD\"). week_start ( str ) \u2013 A date string representing the start of the matchup week (format: \"YYYY-MM-DD\"). winner_team_key ( str ) \u2013 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\" , \"\" )","title":"__init__"},{"location":"models/#yfpy.models.MatchupGrade","text":"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\" , \"\" )","title":"MatchupGrade"},{"location":"models/#yfpy.models.MatchupGrade.__init__","text":"__init__ ( extracted_data ) Instantiate the MatchupGrade child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: grade ( str ) \u2013 The letter grade assigned to the matchup performance (\"A+\", \"A\", ..., \"F-\"). team_key ( str ) \u2013 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\" , \"\" )","title":"__init__"},{"location":"models/#yfpy.models.Player","text":"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\" , \"\" )","title":"Player"},{"location":"models/#yfpy.models.Player.__init__","text":"__init__ ( extracted_data ) Instantiate the Player child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: bye_weeks ( ByeWeeks ) \u2013 A YFPY ByeWeeks instance. bye ( int ) \u2013 The week number that the player is on bye. display_position ( str ) \u2013 The display string for the player position. draft_analysis ( DraftAnalysis ) \u2013 A YFPY DraftAnalysis instance. average_draft_pick ( float ) \u2013 The average pick at which the player was drafted. average_draft_round ( float ) \u2013 The average round in which the player was drafted. average_draft_cost ( float ) \u2013 The average price paid for the player to be drafted. percent_drafted ( float ) \u2013 The overall percentage the player was drafted. editorial_player_key ( str ) \u2013 The Yahoo player key using the game key. editorial_team_abbr ( str ) \u2013 The abbreviation of the professional team name for which the player plays. editorial_team_full_name ( str ) \u2013 The name of the professional team for which the player plays. editorial_team_key ( str ) \u2013 The Yahoo team key of the professional team for which the player plays using the game key. editorial_team_url ( str ) \u2013 The direct URL of the professional team for which the player plays on Yahoo Sports. eligible_positions ( list [ str ] ) \u2013 A list of positions for which the player is eligible. eligible_positions_to_add ( list [ str ] ) \u2013 A list of positions for which the player can have eligibility added. has_player_notes ( int ) \u2013 Numeric boolean (0 or 1) representing if the player has any notes. has_recent_player_notes ( int ) \u2013 Numeric boolean (0 or 1) representing if the player has any recent notes. headshot ( Headshot ) \u2013 A YFPY Headshot instance. headshot_size ( str ) \u2013 The player headshot photo size (\"small\", \"large\", etc.) headshot_url ( str ) \u2013 The direct URL of the player headshot photo. image_url ( str ) \u2013 The direct URL of the player headshot photo. injury_note ( str ) \u2013 The physical part of the player that is injured if the player has an injury. is_editable ( int ) \u2013 Numeric boolean (0 or 1) representing if the player is editable. is_keeper ( int ) \u2013 Numeric boolean (0 or 1) representing if the player is a keeper. is_undroppable ( int ) \u2013 Numeric boolean (0 or 1) representing if the player is undroppable. name ( Name ) \u2013 A YFPY Name instance. first_name ( str ) \u2013 The first name of the player. last_name ( str ) \u2013 The last name of the player. full_name ( str ) \u2013 The full name of the player. ownership ( Ownership ) \u2013 A YFPY Ownership instance. percent_owned ( PercentOwned ) \u2013 A YFPY PercentOwned instanced. percent_owned_value ( float ) \u2013 The percentage value the player is/was owned in the coverage timeframe. player_id ( int ) \u2013 The unique player ID. player_key ( str ) \u2013 The Yahoo player key. player_notes_last_timestamp ( int ) \u2013 A timestamp of the most recent players notes. player_points ( PlayerPoints ) \u2013 A YFPY PlayerPoints instance. player_points_value ( float ) \u2013 The total points for the player within the coverage timeframe. player_stats ( PlayerStats ) \u2013 A YFPY PlayerStats instance. stats ( list [ Stat ] ) \u2013 A list of YFPY Stat instances. position_type ( str ) \u2013 The position type of the player (\"offense\", \"defense\", etc.). primary_position ( str ) \u2013 The primary position of the player. selected_position ( SelectedPosition ) \u2013 A YFPY SelectedPosition instance. selected_position_value ( str ) \u2013 The selected position of the player. status ( str ) \u2013 The status abbreviation of the player (\"IR\", \"PUP\", \"O\", \"Q\", etc.). status_full ( str ) \u2013 The unabbreviated status of the player (\"Questionable\", etc.). transaction_data ( TransactionData ) \u2013 A YFPY TransactionData instance. uniform_number ( int ) \u2013 The uniform number of the player. url ( str ) \u2013 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\" , \"\" )","title":"__init__"},{"location":"models/#yfpy.models.ByeWeeks","text":"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 )","title":"ByeWeeks"},{"location":"models/#yfpy.models.ByeWeeks.__init__","text":"__init__ ( extracted_data ) Instantiate the ByeWeeks child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: week ( int ) \u2013 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 )","title":"__init__"},{"location":"models/#yfpy.models.DraftAnalysis","text":"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 )","title":"DraftAnalysis"},{"location":"models/#yfpy.models.DraftAnalysis.__init__","text":"__init__ ( extracted_data ) Instantiate the DraftAnalysis child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: average_pick ( float ) \u2013 The average pick at which the player was drafted. average_round ( float ) \u2013 The average round in which the player was drafted. average_cost ( float ) \u2013 The average price paid for the player to be drafted. percent_drafted ( float ) \u2013 The overall percentage the player was drafted. preseason_average_cost ( float ) \u2013 The average price paid for the player to be drafted in the preseason. preseason_average_pick ( float ) \u2013 The average pick at which the player was drafted in the preseason. preseason_average_round ( float ) \u2013 The average round in which the player was drafted in the preseason. preseason_percent_drafted ( float ) \u2013 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 )","title":"__init__"},{"location":"models/#yfpy.models.Headshot","text":"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\" , \"\" )","title":"Headshot"},{"location":"models/#yfpy.models.Headshot.__init__","text":"__init__ ( extracted_data ) Instantiate the Headshot child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: size ( str ) \u2013 The size of the headshot photo (\"small\", \"large\", etc.) url ( str ) \u2013 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\" , \"\" )","title":"__init__"},{"location":"models/#yfpy.models.Name","text":"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\" , \"\" )","title":"Name"},{"location":"models/#yfpy.models.Name.__init__","text":"__init__ ( extracted_data ) Instantiate the Name child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: ascii_first ( str ) \u2013 The ASCII encoded string of the first name of the player. ascii_last ( str ) \u2013 The ASCII encoded string of the last name of the player. first ( str ) \u2013 The first name of the player. full ( str ) \u2013 The full name of the player. last ( str ) \u2013 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\" , \"\" )","title":"__init__"},{"location":"models/#yfpy.models.Ownership","text":"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\" , \"\" )","title":"Ownership"},{"location":"models/#yfpy.models.Ownership.__init__","text":"__init__ ( extracted_data ) Instantiate the Ownership child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: display_date ( int ) \u2013 The week number the player went on waivers (when applicable). ownership_type ( str ) \u2013 The current location of the player in the league (\"team\", \"waivers\", etc.). owner_team_key ( str ) \u2013 The Yahoo team key for the team that owns the player. owner_team_name ( str ) \u2013 The team name for the team that owns the player. teams ( list [ Team ] ) \u2013 A list of YFPY Team instances. waiver_date ( str ) \u2013 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\" , \"\" )","title":"__init__"},{"location":"models/#yfpy.models.PercentOwned","text":"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 )","title":"PercentOwned"},{"location":"models/#yfpy.models.PercentOwned.__init__","text":"__init__ ( extracted_data ) Instantiate the PercentOwned child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: coverage_type ( str ) \u2013 The timeframe for the selected player ownership (\"week\", \"date\", \"season\", etc.). week ( int ) \u2013 The week number (when applicable). value ( int ) \u2013 The percentage value the player is/was owned in the coverage timeframe. delta ( float ) \u2013 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 )","title":"__init__"},{"location":"models/#yfpy.models.PlayerAdvancedStats","text":"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 )","title":"PlayerAdvancedStats"},{"location":"models/#yfpy.models.PlayerAdvancedStats.__init__","text":"__init__ ( extracted_data ) Instantiate the PlayerAdvancedStats child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: coverage_type ( str ) \u2013 The timeframe for the selected player advanced stats (\"week\", \"date\", \"season\", etc.). season ( int ) \u2013 The season year (when applicable). stats ( list [ Stat ] ) \u2013 A list of advanced YFPY Stat instances for the player. week ( int ) \u2013 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 )","title":"__init__"},{"location":"models/#yfpy.models.PlayerPoints","text":"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 )","title":"PlayerPoints"},{"location":"models/#yfpy.models.PlayerPoints.__init__","text":"__init__ ( extracted_data ) Instantiate the PlayerPoints child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: coverage_type ( str ) \u2013 The timeframe for the selected player points (\"week\", \"date\", \"season\", etc.). season ( int ) \u2013 The season year (when applicable). total ( float ) \u2013 The total points for the player within the coverage timeframe. week ( int ) \u2013 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 )","title":"__init__"},{"location":"models/#yfpy.models.PlayerStats","text":"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 )","title":"PlayerStats"},{"location":"models/#yfpy.models.PlayerStats.__init__","text":"__init__ ( extracted_data ) Instantiate the PlayerStats child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: coverage_type ( str ) \u2013 The timeframe for the selected player stats (\"week\", \"date\", \"season\", etc.). date ( str ) \u2013 The YYYY-MM-DD formatted date string (when applicable). season ( int ) \u2013 The season year (when applicable). stats ( list [ Stat ] ) \u2013 A list of YFPY Stat instances for the player. week ( int ) \u2013 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 )","title":"__init__"},{"location":"models/#yfpy.models.SelectedPosition","text":"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 )","title":"SelectedPosition"},{"location":"models/#yfpy.models.SelectedPosition.__init__","text":"__init__ ( extracted_data ) Instantiate the SelectedPosition child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: coverage_type ( str ) \u2013 The timeframe for the selected position (\"week\", \"date\", \"season\", etc.). date ( str ) \u2013 The YYYY-MM-DD formatted date string (when applicable). is_flex ( int ) \u2013 Numeric boolean (0 or 1) representing if the selected player is in a flex roster slot. position ( str ) \u2013 The selected position of the player. week ( int ) \u2013 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 )","title":"__init__"},{"location":"models/#yfpy.models.TransactionData","text":"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\" , \"\" )","title":"TransactionData"},{"location":"models/#yfpy.models.TransactionData.__init__","text":"__init__ ( extracted_data ) Instantiate the TransactionData child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: destination_team_key ( str ) \u2013 The Yahoo team key for the receiving team. destination_team_name ( str ) \u2013 The name of the receiving team. destination_type ( str ) \u2013 The destination of the player (waivers, free agency, another team, etc.). source_team_key ( str ) \u2013 The Yahoo team key of the sending team. source_team_name ( str ) \u2013 The name of the sending team. source_type ( str ) \u2013 The origin of the player (waivers, free agency, another team, etc.). type ( str ) \u2013 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\" , \"\" )","title":"__init__"},{"location":"query/","text":"Query \u00b6 YFPY module for making Yahoo Fantasy Sports REST API queries. This module provides all available Yahoo Fantasy Sports API queries as callable methods on the YahooFantasySportsQuery class. Attributes: logger ( Logger ) \u2013 Module level logger for usage and debugging. YahooFantasySportsQuery \u00b6 Bases: object Yahoo Fantasy Sports REST API query CLASS to retrieve all types of fantasy sports data. Source code in yfpy/query.py 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 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 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 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 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 470 471 472 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 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 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 695 696 697 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 728 729 730 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 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 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 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 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 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 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 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 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 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 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 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 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 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 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 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 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 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 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 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 class YahooFantasySportsQuery ( object ): \"\"\"Yahoo Fantasy Sports REST API query CLASS to retrieve all types of fantasy sports data. \"\"\" YFO = TypeVar ( \"YFO\" , bound = YahooFantasyObject ) runtime_environment_is_docker = os . environ . get ( \"RUNTIME_ENVIRONMENT\" , None ) == \"docker\" def __init__ ( self , league_id : str , game_code : str , game_id : Optional [ int ] = None , yahoo_consumer_key : Optional [ str ] = None , yahoo_consumer_secret : Optional [ str ] = None , yahoo_access_token_json : Optional [ Union [ str , Dict ]] = None , env_var_fallback : bool = True , env_file_location : Optional [ Path ] = None , save_token_data_to_env_file : Optional [ bool ] = False , all_output_as_json_str : bool = False , browser_callback : bool = not runtime_environment_is_docker , retries : int = 3 , backoff : int = 0 , offline : bool = False ): \"\"\"Instantiate a YahooQueryObject for running queries against the Yahoo fantasy REST API. Args: league_id (str): League ID of selected Yahoo Fantasy league. game_code (str): Game code of selected Yahoo Fantasy game corresponding to a specific sport (refers to the current season if used as the value for game_key), where \"nfl\" is for fantasy football, \"nhl\" is for fantasy hockey, \"mlb\" is for fantasy baseball, and \"nba\" is for fantasy basketball. game_id (:obj:`int`, optional): Game ID of selected Yahoo fantasy game corresponding to a specific year, and defaulting to the game ID for the current year. yahoo_consumer_key (:obj:`str`, optional): User defined Yahoo developer app consumer key (must be provided in conjunction with yahoo_consumer_secret). yahoo_consumer_secret (:obj:`str`, optional): User defined Yahoo developer app consumer secret (must be provided in conjunction with yahoo_consumer_key). yahoo_access_token_json (str | dict, optional): User defined JSON (string or dict) containing refreshable access token generated by the yahoo-oauth library to avoid having to reauthenticate on every access to the Yahoo Fantasy Sports API (overrides yahoo_consumer_key/yahoo_consumer_secret and all Yahoo access token environment variables). env_var_fallback (:obj:`bool`, optional): Fall back to values retrieved from environment variables for any missing arguments or access token fields (defaults to True). env_file_location (:obj:`Path`, optional): Path to directory where existing .env file is located or new .env file should be generated when provided in conjunction with save_access_token_data_to_env_file=True (defaults to None). save_token_data_to_env_file (:obj:`bool`, optional): Boolean to save Yahoo access token data to local .env file (must be provided in conjunction with env_file_location) (defaults to False) all_output_as_json_str (:obj:`bool`, optional): Option to automatically convert all query output to JSON strings. browser_callback (:obj:`bool`, optional): Enable or disable (enabled by default) whether the yahoo-oauth library automatically opens a browser window to authenticate (if disabled, it will output the callback URL). retries (:obj:`int`, optional): Number of times to retry a query if it fails (defaults to 3). backoff (:obj:`int`, optional): Multiplier that incrementally increases the wait time before retrying a failed query request. offline (:obj:`bool`, optional): Boolean to run in offline mode (Only works if all needed Yahoo Fantasy data has been previously saved locally using the Data module in data.py). Attributes: _env_var_fallback (bool): Fall back to values retrieved from environment variables for any missing arguments or access token fields. _yahoo_access_token_dict (dict[str, Any]): Dictionary containing refreshable access token data generated by the yahoo-oauth library to avoid having to reauthenticate on every access to the Yahoo Fantasy Sports API. _yahoo_consumer_key (str): User defined Yahoo developer app consumer key. _yahoo_consumer_secret (str): User defined Yahoo developer app consumer secret. _browser_callback (bool): Enable or disable (enabled by default) whether the yahoo-oauth library automatically opens a browser window to authenticate (if disabled, it will output the callback URL). _retries (int): Number of times to retry a query if it fails (defaults to 3). _backoff (int): Multiplier that incrementally increases the wait time before retrying a failed query request. _fantasy_content_data_field (str): The initial JSON field in which all Yahoo Fantasy Sports API responses store the data output of the submitted query. league_id (str): League ID of selected Yahoo Fantasy league. game_code (str): Game code of selected Yahoo Fantasy game corresponding to a specific sport (refers to the current season if used as the value for game_key), where \"nfl\" is for fantasy football, \"nhl\" is for fantasy hockey, \"mlb\" is for fantasy baseball, and \"nba\" is for fantasy basketball. game_id (int): Game ID of selected Yahoo fantasy game corresponding to a specific year, and defaulting to the game ID for the current year. league_key (str): The Yahoo Fantasy Sports league key formatted as .l.. executed_queries (list[dict[str, Any]]): List of completed queries and their responses. all_output_as_json_str (bool): Option to automatically convert all query output to JSON strings. offline (bool): Boolean to run in offline mode (Only works if all needed Yahoo Fantasy data has been previously saved locally using the Data module in data.py). \"\"\" self . _env_var_fallback = env_var_fallback # load provided .env file if it exists to read any additional environment variables stored there if self . _env_var_fallback and env_file_location : env_file_path = env_file_location / \".env\" if env_file_path . is_file (): load_dotenv ( env_file_path ) self . _yahoo_access_token_dict : Dict [ str , Any ] = self . _get_dict_from_access_token_json ( yahoo_access_token_json ) # warn user that providing Yahoo access token JSON or populating a YAHOO_ACCESS_TOKEN_JSON environment variable # will override any values provided in the yahoo_consumer_key and yahoo_consumer_secret parameters if self . _yahoo_access_token_dict and ( yahoo_consumer_key or yahoo_consumer_secret ): logger . warning ( \"Providing a yahoo_access_token_json argument or setting env_var_fallback to True and having a \" \"YAHOO_ACCESS_TOKEN_JSON will override any values provided for yahoo_consumer_key or \" \"yahoo_consumer_secret.\" ) # retrieve the Yahoo consumer key and Yahoo consumer secret from the access token dict and fall back to the # provided parameters if no dict exists self . _yahoo_consumer_key = self . _yahoo_access_token_dict . get ( \"consumer_key\" , yahoo_consumer_key ) self . _yahoo_consumer_secret = self . _yahoo_access_token_dict . get ( \"consumer_secret\" , yahoo_consumer_secret ) # catch when a Yahoo consumer key was not provided if not self . _yahoo_consumer_key : # check for YAHOO_CONSUMER_KEY environment variable value if env_var_fallback is True if self . _env_var_fallback : if yahoo_consumer_key_env_var := os . environ . get ( \"YAHOO_CONSUMER_KEY\" ): self . _yahoo_consumer_key = yahoo_consumer_key_env_var if not self . _yahoo_consumer_key : logger . error ( \"Missing required Yahoo consumer key (no yahoo_consumer_key argument provided to \" \"YahooFantasySportsQuery, no consumer_key value provided in yahoo_access_token_json, or no \" \"YAHOO_CONSUMER_KEY environment variable value found).\" ) sys . exit ( 1 ) # catch when a Yahoo consumer secret was not provided if not self . _yahoo_consumer_secret : # check for YAHOO_CONSUMER_SECRET environment variable value if env_var_fallback is True if self . _env_var_fallback : if yahoo_consumer_secret_env_var := os . environ . get ( \"YAHOO_CONSUMER_SECRET\" ): self . _yahoo_consumer_secret = yahoo_consumer_secret_env_var if not self . _yahoo_consumer_secret : logger . error ( \"Missing required Yahoo consumer secret (no yahoo_consumer_secret argument provided to \" \"YahooFantasySportsQuery, no consumer_secret value provided in yahoo_access_token_json, or no \" \"YAHOO_CONSUMER_SECRET environment variable value found).\" ) sys . exit ( 1 ) # explicitly check for truthy/falsy value self . _browser_callback : bool = True if browser_callback is True else False self . _retries : int = retries self . _backoff : int = backoff self . _fantasy_content_data_field : str = \"fantasy_content\" self . league_id : str = league_id self . game_code : str = ( game_code if game_code in yahoo_fantasy_sports_game_codes else retrieve_game_code_from_user () ) self . game_id : int = game_id self . league_key : str = None self . executed_queries : List [ Dict [ str , Any ]] = [] # explicitly check for truthy/falsy value self . all_output_as_json_str : bool = True if all_output_as_json_str is True else False # explicitly check for truthy/falsy value self . offline : bool = True if offline is True else False if not self . offline : self . _authenticate () if save_token_data_to_env_file : self . save_access_token_data_to_env_file ( env_file_location ) def _get_dict_from_access_token_json ( self , yahoo_access_token_json : Union [ str , Dict ]) -> Dict [ str , Any ]: \"\"\"Creates a dictionary of Yahoo access token fields extracted from provided JSON (or a provided dictionary). Args: yahoo_access_token_json (str | dict): A valid JSON string or Python dictionary containing Yahoo access token fields and values. Returns: dict[str, Any]: A dictionary of key/value pairs containing the required values to authenticate using a Yahoo access token. \"\"\" yahoo_access_token_dict : Dict [ str , Any ] = {} # check if there is no provided token JSON and attempt to retrieve them from the YAHOO_ACCESS_TOKEN_JSON # environment variable if fallback to environment variables is True if not yahoo_access_token_json and self . _env_var_fallback : yahoo_access_token_json = os . environ . get ( \"YAHOO_ACCESS_TOKEN_JSON\" ) if yahoo_access_token_json : # parse Yahoo access token JSON as needed if isinstance ( yahoo_access_token_json , str ): try : yahoo_access_token_dict = json . loads ( yahoo_access_token_json ) except JSONDecodeError as e : logger . error ( f \"Invalid JSON provided in yahoo_access_token_json: \\n { e } \" ) sys . exit ( 1 ) elif isinstance ( yahoo_access_token_json , dict ): yahoo_access_token_dict = yahoo_access_token_json else : logger . error ( f \"Invalid object type provided in yahoo_access_token_json or YAHOO_ACCESS_TOKEN_JSON environment \" f \"variable: { type ( yahoo_access_token_json ) } \" ) sys . exit ( 1 ) # check if any fields required by a Yahoo access token are missing yahoo_access_token_required_fields = { \"access_token\" , \"consumer_key\" , \"consumer_secret\" , \"guid\" , \"refresh_token\" , \"token_time\" , \"token_type\" } if not set ( yahoo_access_token_dict . keys ()) . issuperset ( yahoo_access_token_required_fields ): logger . error ( f \"Missing required fields in yahoo_access_token_json: \" f \" { yahoo_access_token_required_fields . difference ( yahoo_access_token_dict . keys ()) } \" ) sys . exit ( 1 ) return yahoo_access_token_dict def _authenticate ( self ) -> None : \"\"\"Authenticate with the Yahoo Fantasy Sports REST API using OAuth2. Returns: None \"\"\" logger . debug ( \"Authenticating with Yahoo.\" ) # provide Yahoo access token fields if available or search for them in environment variables if env_var_fallback # is True, and then complete OAuth2 3-legged handshake by either refreshing existing OAuth2 refresh token or # requesting account access and returning a verification code to input to the command line prompt self . oauth = OAuth2 ( self . _yahoo_consumer_key , self . _yahoo_consumer_secret , access_token = self . _yahoo_access_token_dict . get ( \"access_token\" , os . environ . get ( \"YAHOO_ACCESS_TOKEN\" , None ) if self . _env_var_fallback else None ), guid = self . _yahoo_access_token_dict . get ( \"guid\" , os . environ . get ( \"YAHOO_GUID\" , None ) if self . _env_var_fallback else None ), refresh_token = self . _yahoo_access_token_dict . get ( \"refresh_token\" , os . environ . get ( \"YAHOO_REFRESH_TOKEN\" , None ) if self . _env_var_fallback else None ), token_time = self . _yahoo_access_token_dict . get ( \"token_time\" , float ( os . environ . get ( \"YAHOO_TOKEN_TIME\" , 0.0 )) if self . _env_var_fallback else 0.0 ), token_type = self . _yahoo_access_token_dict . get ( \"token_type\" , os . environ . get ( \"YAHOO_TOKEN_TYPE\" , None ) if self . _env_var_fallback else None ), browser_callback = self . _browser_callback , store_file = False ) if not self . oauth . token_is_valid (): self . oauth . refresh_access_token () self . _yahoo_access_token_dict . update ( { \"access_token\" : self . oauth . access_token , \"consumer_key\" : self . oauth . consumer_key , \"consumer_secret\" : self . oauth . consumer_secret , \"guid\" : self . oauth . guid , \"refresh_token\" : self . oauth . refresh_token , \"token_time\" : self . oauth . token_time , \"token_type\" : self . oauth . token_type , } ) @staticmethod def _retrieve_env_file_contents ( env_file_path : Path ) -> Dict [ str , str ]: \"\"\"Creates a dictionary of key/value pairs representing each line of a .env file (stores environment variables). Args: env_file_path (Path): The path to the directory where the target .env file is located. Returns: dict[str, str]: A dictionary of key/value pairs representing each line of a .env file. \"\"\" env_file_content = OrderedDict () if env_file_path . is_file (): with open ( env_file_path , \"r\" ) as env_file : for line_num , env_file_line in enumerate ( env_file , start = 1 ): if env_file_line . startswith ( \" \\n \" ): # track blank lines in .env file using their line number env_file_content [ f \"blank_ { line_num } \" ] = \" \\n \" elif env_file_line . startswith ( \"#\" ): # track comments in .env file using their line number env_file_content [ f \"comment_ { line_num } \" ] = env_file_line . strip () else : # extract and normalize environment variables from .env file env_var_name , env_var_value = env_file_line . split ( \"=\" , 1 ) env_file_content [ env_var_name . lower ()] = env_var_value . strip () return env_file_content def save_access_token_data_to_env_file ( self , env_file_directory : Path , env_file_name : str = \".env\" , save_json_to_var : bool = False ) -> None : \"\"\"Saves the fields and values of a Yahoo access token into a .env file. Args: env_file_directory (Path): The path to the directory where the target .env file is/will be located. env_file_name (:obj:`str`, optional): The name of the target .env file (defaults to \".env\"). save_json_to_var (:obj:`bool`, optional): Boolean to determine whether or not to write a JSON string of Yahoo access token fields to a YAHOO_ACCESS_TOKEN_JSON environment variable in the target .env file (defaults to False). Returns: None \"\"\" if env_file_directory : env_file_path = env_file_directory / env_file_name else : logger . warning ( \"Missing argument env_file_location. Yahoo access token will NOT be saved to .env file.\" ) # exit method without saving Yahoo access token data when no env_file_location argument is provided return env_file_content = self . _retrieve_env_file_contents ( env_file_path ) # replace values of any matching environment variables in .env file with values from Yahoo access token fields for k , v in self . _yahoo_access_token_dict . items (): env_file_content [ f \"yahoo_ { k } \" ] = v # generate a JSON string with escaped double quotes using nested json.dumps() and write it to a # YAHOO_ACCESS_TOKEN_JSON environment variable if save_json_to_var is set to True if save_json_to_var : env_file_content [ \"yahoo_access_token_json\" ] = json . dumps ( json . dumps ( self . _yahoo_access_token_dict )) # write contents to .env file (overwrites contents if file exists or creates a new file if not) with open ( env_file_path , \"w\" ) as env_file : for k , v in env_file_content . items (): if k . startswith ( \"blank\" ): env_file . write ( v ) elif k . startswith ( \"comment\" ): env_file . write ( f \" { v } \\n \" ) else : env_file . write ( f \" { k . upper () } = { v } \\n \" ) def get_response ( self , url : str ) -> Response : \"\"\"Retrieve Yahoo Fantasy Sports data from the REST API. Args: url (str): REST API request URL string. Returns: Response: API response from Yahoo Fantasy Sports API request. \"\"\" logger . debug ( f \"Making request to URL: { url } \" ) response : Response = self . oauth . session . get ( url , params = { \"format\" : \"json\" }) status_code = response . status_code # when you exceed Yahoo's allowed data request limits, they throw a request status code of 999 if status_code == 999 : raise HTTPError ( \"Yahoo data unavailable due to rate limiting. Please try again later.\" ) if status_code == 401 : self . _authenticate () response_json = {} try : response_json = response . json () logger . debug ( f \"Response (JSON): { response_json } \" ) except JSONDecodeError : response . raise_for_status () try : if ( status_code // 100 ) != 2 : # handle if the yahoo query returns an error if response_json . get ( \"error\" ): response_error_msg = response_json . get ( \"error\" ) . get ( \"description\" ) error_msg = f \"Attempt to retrieve data at URL { response . url } failed with error: \" \\ f \" \\\" { response_error_msg } \\\" \" logger . error ( error_msg ) raise YahooFantasySportsDataNotFound ( error_msg , url = response . url ) response . raise_for_status () except HTTPError as e : # retry with incremental back-off if self . _retries > 0 : self . _retries -= 1 self . _backoff += 1 logger . warning ( f \"Request for URL { url } failed with status code { response . status_code } . \" f \"Retrying { self . _retries } more time { 's' if self . _retries > 1 else '' } ...\" ) time . sleep ( 0.3 * self . _backoff ) response = self . get_response ( url ) else : # log error and terminate query if status code is not 200 after 3 retries logger . error ( f \"Request failed with status code: { response . status_code } - { e } \" ) response . raise_for_status () raw_response_data = response_json . get ( self . _fantasy_content_data_field ) # extract data from \"fantasy_content\" field if it exists if raw_response_data : logger . debug ( f \"Data fetched with query URL: { response . url } \" ) logger . debug ( f \"Response (Yahoo fantasy data extracted from: \" f \" \\\" { self . _fantasy_content_data_field } \\\" ): { raw_response_data } \" ) else : error_msg = f \"No data found at URL { response . url } when attempting extraction from field: \" \\ f \" \\\" { self . _fantasy_content_data_field } \\\" \" logger . error ( error_msg ) raise YahooFantasySportsDataNotFound ( error_msg , url = response . url ) return response # noinspection GrazieInspection def query ( self , url : str , data_key_list : Union [ List [ str ], List [ List [ str ]]], data_type_class : Type = None , sort_function : Callable = None ) -> ( Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]]): \"\"\"Base query class to retrieve requested data from the Yahoo fantasy sports REST API. Args: url (str): REST API request URL string. data_key_list (list[str] | list[list[str]]): List of keys used to extract the specific data desired by the given query (supports strings and lists of strings). Supports lists containing only key strings such as [\"game\", \"stat_categories\"], and also supports lists containing key strings followed by lists of key strings such as [\"team\", [\"team_points\", \"team_projected_points\"]]. data_type_class (:obj:`Type`, optional): Highest level data model type (if one exists for the retrieved data). sort_function (Callable of sort function, optional)): Optional lambda function to return sorted query results. Returns: object: Model class instance from yfpy/models.py, dictionary, or list (depending on query), with unpacked and parsed response data. \"\"\" if not self . offline : response = self . get_response ( url ) raw_response_data = response . json () . get ( self . _fantasy_content_data_field ) # print(json.dumps(raw_response_data, indent=2)) # iterate through list of data keys and drill down to final desired data field for i in range ( len ( data_key_list )): if isinstance ( raw_response_data , list ): if isinstance ( data_key_list [ i ], list ): reformatted = reformat_json_list ( raw_response_data ) raw_response_data = [ { data_key_list [ i ][ 0 ]: reformatted [ data_key_list [ i ][ 0 ]]}, { data_key_list [ i ][ 1 ]: reformatted [ data_key_list [ i ][ 1 ]]} ] else : raw_response_data = reformat_json_list ( raw_response_data )[ data_key_list [ i ]] else : if isinstance ( data_key_list [ i ], list ): raw_response_data = [ { data_key_list [ i ][ 0 ]: raw_response_data [ data_key_list [ i ][ 0 ]]}, { data_key_list [ i ][ 1 ]: raw_response_data [ data_key_list [ i ][ 1 ]]} ] else : raw_response_data = raw_response_data . get ( data_key_list [ i ]) if raw_response_data : logger . debug ( f \"Response (Yahoo fantasy data extracted from: { data_key_list } ): { raw_response_data } \" ) else : error_msg = f \"No data found when attempting extraction from fields: { data_key_list } \" logger . error ( error_msg ) raise YahooFantasySportsDataNotFound ( error_msg , payload = data_key_list , url = response . url ) # unpack, parse, and assign data types to all retrieved data content unpacked = unpack_data ( raw_response_data , YahooFantasyObject ) logger . debug ( f \"Unpacked and parsed JSON (Yahoo fantasy data wth parent type: { data_type_class } ): \\n { unpacked } \" ) self . executed_queries . append ({ \"url\" : response . url , \"response_status_code\" : response . status_code , \"response\" : response }) # cast the highest level of data to type corresponding to query (if type exists) query_data = data_type_class ( unpacked ) if data_type_class else unpacked # sort data when applicable if sort_function and not isinstance ( query_data , dict ): query_data = sorted ( query_data , key = sort_function ) # flatten lists of single-key dicts of objects into lists of those objects if isinstance ( query_data , list ): last_data_key = data_key_list [ - 1 ] if last_data_key . endswith ( \"s\" ): query_data = [ el [ last_data_key [: - 1 ]] for el in query_data ] if self . all_output_as_json_str : return jsonify_data ( query_data ) else : return query_data else : logger . error ( \"Cannot run Yahoo query while using offline mode! Please try again with offline=False.\" ) def get_all_yahoo_fantasy_game_keys ( self ) -> List [ Game ]: \"\"\"Retrieve all Yahoo Fantasy Sports game keys by ID (from year of inception to present), sorted by season/year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_all_yahoo_fantasy_game_keys() [ Game({ \"code\": \"nfl\", \"game_id\": \"50\", \"game_key\": \"50\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"1999\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/1999\" }), ..., Game({...}) ] Returns: list[Game]: List of YFPY Game instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/games;game_codes= { self . game_code } \" , [ \"games\" ], sort_function = lambda x : x . get ( \"game\" ) . season ) # noinspection PyUnresolvedReferences def get_game_key_by_season ( self , season : int ) -> str : \"\"\"Retrieve specific game key by season. Args: season (int): User defined season/year for which to retrieve the Yahoo Fantasy Sports game. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_key_by_season(2021) 338 Returns: str: The game key for a Yahoo Fantasy Sports game specified by season. \"\"\" all_output_as_json = False if self . all_output_as_json_str : self . all_output_as_json_str = False all_output_as_json = True game_key = self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/games;game_codes= { self . game_code } ;seasons= { season } \" , [ \"games\" ] ) . get ( \"game\" ) . game_key if all_output_as_json : self . all_output_as_json_str = True return game_key def get_current_game_info ( self ) -> Game : \"\"\"Retrieve game info for current fantasy season. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_current_game_info() Game({ \"code\": \"nfl\", \"game_id\": \"390\", \"game_key\": \"390\", \"game_weeks\": [ { \"game_week\": { \"display_name\": \"1\", \"end\": \"2019-09-09\", \"start\": \"2019-09-05\", \"week\": \"1\" } }, ... ], \"is_game_over\": 0, \"is_live_draft_lobby_active\": 1, \"is_offseason\": 0, \"is_registration_over\": 0, \"name\": \"Football\", \"position_types\": [ { \"position_type\": { \"type\": \"O\", \"display_name\": \"Offense\" } }, ... ], \"roster_positions\": [ { \"roster_position\": { \"position\": \"QB\", \"position_type\": \"O\" } }, ... ], \"season\": \"2019\", \"stat_categories\": { \"stats\": [ { \"stat\": { \"display_name\": \"GP\", \"name\": \"Games Played\", \"sort_order\": \"1\", \"stat_id\": 0 } }, ... }, \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/f1\" }) Returns: Game: YFPY Game instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { self . game_code } ;\" f \"out=metadata,players,game_weeks,stat_categories,position_types,roster_positions\" , [ \"game\" ], Game ) def get_current_game_metadata ( self ) -> Game : \"\"\"Retrieve game metadata for current fantasy season. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_current_game_metadata() Game({ \"code\": \"nfl\", \"game_id\": \"390\", \"game_key\": \"390\", \"is_game_over\": 0, \"is_live_draft_lobby_active\": 1, \"is_offseason\": 0, \"is_registration_over\": 0, \"name\": \"Football\", \"season\": \"2019\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/f1\" }) Returns: Game: YFPY Game instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { self . game_code } /metadata\" , [ \"game\" ], Game ) def get_game_info_by_game_id ( self , game_id : int ) -> Game : \"\"\"Retrieve game info for specific game by ID. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_info_by_game_id(390) Game({ \"code\": \"nfl\", \"game_id\": \"390\", \"game_key\": \"390\", \"game_weeks\": [ { \"game_week\": { \"display_name\": \"1\", \"end\": \"2019-09-09\", \"start\": \"2019-09-05\", \"week\": \"1\" } }, ... ], \"is_game_over\": 0, \"is_live_draft_lobby_active\": 1, \"is_offseason\": 0, \"is_registration_over\": 0, \"name\": \"Football\", \"position_types\": [ { \"position_type\": { \"type\": \"O\", \"display_name\": \"Offense\" } }, ... ], \"roster_positions\": [ { \"roster_position\": { \"position\": \"QB\", \"position_type\": \"O\" } }, ... ], \"season\": \"2019\", \"stat_categories\": { \"stats\": [ { \"stat\": { \"display_name\": \"GP\", \"name\": \"Games Played\", \"sort_order\": \"1\", \"stat_id\": 0 } }, ... }, \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/f1\" }) Returns: Game: YFPY Game instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } ;\" f \"out=metadata,players,game_weeks,stat_categories,position_types,roster_positions\" , [ \"game\" ], Game ) def get_game_metadata_by_game_id ( self , game_id : int ) -> Game : \"\"\"Retrieve game metadata for specific game by ID. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_metadata_by_game_id(331) Game({ \"code\": \"nfl\", \"game_id\": \"331\", \"game_key\": \"331\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"2014\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014\" }) Returns: Game: YFPY Game instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } /metadata\" , [ \"game\" ], Game ) def get_game_weeks_by_game_id ( self , game_id : int ) -> List [ GameWeek ]: \"\"\"Retrieve all valid weeks of a specific game by ID. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_weeks_by_game_id(331) [ GameWeek({ \"display_name\": \"1\", \"end\": \"2014-09-08\", \"start\": \"2014-09-04\", \"week\": \"1\" }), ..., GameWeek({ \"display_name\": \"17\", \"end\": \"2014-12-28\", \"start\": \"2014-12-23\", \"week\": \"17\" }) ] Returns: list[GameWeek]: List of YFPY GameWeek instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } /game_weeks\" , [ \"game\" , \"game_weeks\" ] ) def get_game_stat_categories_by_game_id ( self , game_id : int ) -> StatCategories : \"\"\"Retrieve all valid stat categories of a specific game by ID. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_stat_categories_by_game_id(331) StatCategories({ \"stats\": [ { \"stat\": { \"display_name\": \"GP\", \"name\": \"Games Played\", \"sort_order\": \"1\", \"stat_id\": 0 } }, ..., { \"stat\": { \"display_name\": \"Rush 1st Downs\", \"name\": \"Rushing 1st Downs\", \"sort_order\": \"1\", \"stat_id\": 81 } } ] }) Returns: StatCategories: YFPY StatCategories instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } /stat_categories\" , [ \"game\" , \"stat_categories\" ], StatCategories ) def get_game_position_types_by_game_id ( self , game_id : int ) -> List [ PositionType ]: \"\"\"Retrieve all valid position types for specific game by ID sorted alphabetically by type. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_position_types_by_game_id(331) [ PositionType({ \"type\": \"O\", \"display_name\": \"Offense\" }), ..., PositionType({ \"type\": \"K\", \"display_name\": \"Kickers\" }) ] Returns: list[PositionType]: List of YFPY PositionType instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } /position_types\" , [ \"game\" , \"position_types\" ], sort_function = lambda x : x . get ( \"position_type\" ) . type ) def get_game_roster_positions_by_game_id ( self , game_id : int ) -> List [ RosterPosition ]: \"\"\"Retrieve all valid roster positions for specific game by ID sorted alphabetically by position. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_roster_positions_by_game_id(331) [ {RosterPosition({ \"position\": \"BN\" }), ..., RosterPosition({ \"position\": \"WR\", \"position_type\": \"O\" }) ] Returns: list[RosterPosition]: List of YFPY RosterPosition instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } /roster_positions\" , [ \"game\" , \"roster_positions\" ], sort_function = lambda x : x . get ( \"roster_position\" ) . position ) def get_league_key ( self , season : int = None ) -> str : \"\"\"Retrieve league key for selected league. Args: season (int): User defined season/year for which to retrieve the Yahoo Fantasy Sports league key. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_key(2021) 331.l.729259 Returns: str: League key string for selected league. \"\"\" if not self . league_key : if season : return f \" { self . get_game_key_by_season ( season ) } .l. { self . league_id } \" elif self . game_id : return f \" { self . get_game_metadata_by_game_id ( self . game_id ) . game_key } .l. { self . league_id } \" else : logger . warning ( \"No game id or season/year provided, defaulting to current fantasy season.\" ) return f \" { self . get_current_game_metadata () . game_key } .l. { self . league_id } \" else : return self . league_key def get_current_user ( self ) -> User : \"\"\"Retrieve metadata for current logged-in user. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_current_user() User({ \"guid\": \"USER_GUID_STRING\" }) Returns: User: YFPY User instance. \"\"\" return self . query ( \"https://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/\" , [ \"users\" , \"0\" , \"user\" ], User ) def get_user_games ( self ) -> List [ Game ]: \"\"\"Retrieve game history for current logged-in user sorted by season/year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_user_games() [ Game({ \"code\": \"nfl\", \"game_id\": \"359\", \"game_key\": \"359\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"2016\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2016\" }) ..., Game({...}) ] Returns: list[Game]: List of YFPY Game instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/games;codes= { self . game_code } /\" , [ \"users\" , \"0\" , \"user\" , \"games\" ], sort_function = lambda x : x . get ( \"game\" ) . season ) def get_user_leagues_by_game_key ( self , game_key : Union [ int , str ]) -> List [ League ]: \"\"\"Retrieve league history for current logged-in user for specific game by game IDs/keys sorted by season/year. Args: game_key (int | str): The game_id (int) or game_key (str) for a specific Yahoo Fantasy game. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_user_leagues_by_game_key(331) [ League({ \"allow_add_to_dl_extra_pos\": 0, \"current_week\": \"16\", \"draft_status\": \"postdraft\", \"edit_key\": \"16\", \"end_date\": \"2018-12-24\", \"end_week\": \"16\", \"game_code\": \"nfl\", \"iris_group_chat_id\": \"\", \"is_cash_league\": \"0\", \"is_finished\": 1, \"is_pro_league\": \"0\", \"league_id\": \"169896\", \"league_key\": \"380.l.169896\", \"league_type\": \"private\", \"league_update_timestamp\": \"1546498723\", \"logo_url\": \"\", \"name\": \"League Name\", \"num_teams\": 12, \"password\": null, \"renew\": \"371_52364\", \"renewed\": \"390_78725\", \"scoring_type\": \"head\", \"season\": \"2018\", \"short_invitation_url\": \"\", \"start_date\": \"2018-09-06\", \"start_week\": \"1\", \"url\": \"\", \"weekly_deadline\": null }), ..., League({...}) ] Returns: list[League]: List of YFPY League instances. \"\"\" leagues = self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/games;game_keys= { game_key } /leagues/\" , [ \"users\" , \"0\" , \"user\" , \"games\" , \"0\" , \"game\" , \"leagues\" ], sort_function = lambda x : x . get ( \"league\" ) . season ) return leagues if isinstance ( leagues , list ) else [ leagues . get ( \"league\" )] def get_user_teams ( self ) -> List [ Game ]: \"\"\"Retrieve teams for all leagues for current logged-in user for current game sorted by season/year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_user_teams() [ Game({ \"code\": \"nfl\", \"game_id\": \"359\", \"game_key\": \"359\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"2016\", \"teams\": [ { \"team\": { \"draft_grade\": \"A\", \"draft_position\": 9, \"draft_recap_url\": \"\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": [ { \"manager\": { \"email\": \"\", \"guid\": \"\", \"image_url\": \"\", \"is_comanager\": \"1\", \"manager_id\": \"14\", \"nickname\": \"\" } } ], \"name\": \"Legion\", \"number_of_moves\": \"48\", \"number_of_trades\": \"2\", \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"1\", \"team_key\": \"359.l.5521.t.1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"\" } }, \"url\": \"\", \"waiver_priority\": 11 } } ], \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2016\" }) ..., Game({...}) ] Returns: list[Game]: List of YFPY Game instances with \"teams\" attribute containing list of YFPY Team instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/games;codes= { self . game_code } /teams/\" , [ \"users\" , \"0\" , \"user\" , \"games\" ], sort_function = lambda x : x . get ( \"game\" ) . season ) def get_league_info ( self ) -> League : \"\"\"Retrieve info for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_info() League({ \"allow_add_to_dl_extra_pos\": 0, \"current_week\": \"16\", \"draft_status\": \"postdraft\", \"edit_key\": \"16\", \"end_date\": \"2014-12-22\", \"end_week\": \"16\", \"game_code\": \"nfl\", \"iris_group_chat_id\": null, \"is_cash_league\": \"0\", \"is_finished\": 1, \"is_pro_league\": \"1\", \"league_id\": \"729259\", \"league_key\": \"331.l.729259\", \"league_type\": \"public\", \"league_update_timestamp\": \"1420099793\", \"logo_url\": \"https://s.yimg.com/cv/api/default/20180206/default-league-logo@2x.png\", \"name\": \"Yahoo Public 729259\", \"num_teams\": 10, \"renew\": null, \"renewed\": null, \"scoreboard\": { \"week\": \"16\", \"matchups\": [ ... ] }, \"scoring_type\": \"head\", \"season\": \"2014\", \"settings\": { ... }, \"standings\": { \"teams\": [ ..., ... ], ... }, \"start_date\": \"2014-09-04\", \"start_week\": \"1\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259\", \"weekly_deadline\": null }) Returns: League: YFPY League instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } ;\" f \"out=metadata,settings,standings,scoreboard,teams,players,draftresults,transactions\" , [ \"league\" ], League ) def get_league_metadata ( self ) -> League : \"\"\"Retrieve metadata for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_metadata() League({ \"allow_add_to_dl_extra_pos\": 0, \"current_week\": \"16\", \"draft_status\": \"postdraft\", \"edit_key\": \"16\", \"end_date\": \"2014-12-22\", \"end_week\": \"16\", \"game_code\": \"nfl\", \"iris_group_chat_id\": null, \"is_cash_league\": \"0\", \"is_finished\": 1, \"is_pro_league\": \"1\", \"league_id\": \"729259\", \"league_key\": \"331.l.729259\", \"league_type\": \"public\", \"league_update_timestamp\": \"1420099793\", \"logo_url\": \"https://s.yimg.com/cv/api/default/20180206/default-league-logo@2x.png\", \"name\": \"Yahoo Public 729259\", \"num_teams\": 10, \"renew\": null, \"renewed\": null, \"scoring_type\": \"head\", \"season\": \"2014\", \"start_date\": \"2014-09-04\", \"start_week\": \"1\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259\", \"weekly_deadline\": null }) Returns: League: YFPY League instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /metadata\" , [ \"league\" ], League ) def get_league_settings ( self ) -> Settings : \"\"\"Retrieve settings (rules) for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_settings() Settings({ \"cant_cut_list\": \"yahoo\", \"draft_time\": \"1408410000\", \"draft_type\": \"live\", \"has_multiweek_championship\": 0, \"has_playoff_consolation_games\": true, \"is_auction_draft\": \"0\", \"max_teams\": \"10\", \"num_playoff_consolation_teams\": 4, \"num_playoff_teams\": \"4\", \"pickem_enabled\": \"1\", \"player_pool\": \"ALL\", \"playoff_start_week\": \"15\", \"post_draft_players\": \"W\", \"roster_positions\": [ { \"roster_position\": { \"count\": 1, \"position\": \"QB\", \"position_type\": \"O\" } }, ... ], \"scoring_type\": \"head\", \"stat_categories\": { \"stats\": [ { \"stat\": { \"display_name\": \"Pass Yds\", \"enabled\": \"1\", \"name\": \"Passing Yards\", \"position_type\": \"O\", \"sort_order\": \"1\", \"stat_id\": 4, \"stat_position_types\": { \"stat_position_type\": { \"position_type\": \"O\" } } } }, ... ] }, \"stat_modifiers\": { \"stats\": [ { \"stat\": { \"stat_id\": 4, \"value\": \"0.04\" } }, ... ] }, \"trade_end_date\": \"2014-11-14\", \"trade_ratify_type\": \"yahoo\", \"trade_reject_time\": \"2\", \"uses_faab\": \"0\", \"uses_fractional_points\": \"1\", \"uses_lock_eliminated_teams\": 1, \"uses_negative_points\": \"1\", \"uses_playoff\": \"1\", \"uses_playoff_reseeding\": 0, \"waiver_rule\": \"gametime\", \"waiver_time\": \"2\", \"waiver_type\": \"R\" }) Returns: Settings: YFPY Settings instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /settings\" , [ \"league\" , \"settings\" ], Settings ) def get_league_standings ( self ) -> Standings : \"\"\"Retrieve standings for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_standings() Standings({ \"teams\": [ { \"team\": { \"clinched_playoffs\": 1, \"draft_grade\": \"C+\", \"draft_position\": 7, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/8/draftrecap\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"PMTCFWSK5U5LI4SKWREUR56B5A\", \"manager_id\": \"8\", \"nickname\": \"--hidden--\" } }, \"name\": \"clam dam\", \"number_of_moves\": \"27\", \"number_of_trades\": 0, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"8\", \"team_key\": \"331.l.729259.t.8\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://s.yimg.com/cv/apiv2/default/nfl/nfl_1.png\" } }, \"team_points\": { \"coverage_type\": \"season\", \"season\": \"2014\", \"total\": \"1507.06\" }, \"team_standings\": { \"outcome_totals\": { \"losses\": 2, \"percentage\": 0.857, \"ties\": 0, \"wins\": 12 }, \"playoff_seed\": \"1\", \"points_against\": 1263.78, \"points_for\": 1507.06, \"rank\": 1, \"streak\": { \"type\": \"win\", \"value\": \"2\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/8\", \"waiver_priority\": 10 } }, ... ] }) Returns: Standings: YFPY Standings instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /standings\" , [ \"league\" , \"standings\" ], Standings ) def get_league_teams ( self ) -> List [ Team ]: \"\"\"Retrieve teams for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_teams() [ Team({ \"clinched_playoffs\": 1, \"draft_grade\": \"B\", \"draft_position\": 4, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1/draftrecap\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"BMACD7S5UXV7JIQX4PGGUVQJAU\", \"manager_id\": \"1\", \"nickname\": \"--hidden--\" } }, \"name\": \"Hellacious Hill 12\", \"number_of_moves\": \"71\", \"number_of_trades\": 0, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"1\", \"team_key\": \"331.l.729259.t.1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1441/24935131299_a8242dab70_192sq.jpg?ct=fantasy\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1\", \"waiver_priority\": 9 }), ..., Team({...}) ] Returns: list[Team]: List of YFPY Team instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /teams\" , [ \"league\" , \"teams\" ] ) def get_league_players ( self , player_count_limit : int = None , player_count_start : int = 0 , is_retry : bool = False ) -> List [ Player ]: \"\"\"Retrieve valid players for chosen league. Args: player_count_limit (int): Maximum number of players to retreive. player_count_start (int): Index from which to retrieve all subsequent players. is_retry (bool): Boolean to indicate whether the method is being retried during error handling. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_players(50, 25) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"K\", \"editorial_player_key\": \"nfl.p.3727\", \"editorial_team_abbr\": \"Ind\", \"editorial_team_full_name\": \"Indianapolis Colts\", \"editorial_team_key\": \"nfl.t.11\", \"eligible_positions\": { \"position\": \"K\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/OpHvpCHjl_PQvkeQUgsjsA--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt 3PTQ2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08152019/3727.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Adam\", \"ascii_last\": \"Vinatieri\", \"first\": \"Adam\", \"full\": \"Adam Vinatieri\", \"last\": \"Vinatieri\" }, \"player_id\": \"3727\", \"player_key\": \"331.p.3727\", \"player_notes_last_timestamp\": 1568758320, \"position_type\": \"K\", \"primary_position\": \"K\", \"uniform_number\": \"4\" }), ..., Player({...}) ] Returns: list[Player]: List of YFPY Player instances. \"\"\" league_player_count = player_count_start all_players_retrieved = False league_player_data = [] league_player_retrieval_limit = 25 while not all_players_retrieved : try : league_player_query_data = self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"start= { league_player_count } ;count= { league_player_retrieval_limit if not is_retry else 1 } \" , [ \"league\" , \"players\" ] ) league_players = ( league_player_query_data if isinstance ( league_player_query_data , list ) else [ league_player_query_data ]) league_player_count_from_query = len ( league_players ) if player_count_limit : if ( league_player_count + league_player_count_from_query ) < player_count_limit : league_player_count += league_player_count_from_query league_player_data . extend ( league_players ) else : for ndx in range ( player_count_limit - league_player_count ): league_player_data . append ( league_players [ ndx ]) league_player_count += ( player_count_limit - league_player_count ) all_players_retrieved = True else : league_player_count += league_player_count_from_query league_player_data . extend ( league_players ) except YahooFantasySportsDataNotFound as yfpy_err : if not is_retry : payload = yfpy_err . payload if payload : logger . debug ( \"No more league player data available.\" ) all_players_retrieved = True else : logger . warning ( f \"Error retrieving player batch: \" f \" { league_player_count } - { league_player_count + league_player_retrieval_limit - 1 } . \" f \"Attempting to retrieve individual players from batch.\" ) player_retrieval_successes = [] player_retrieval_failures = [] for i in range ( 25 ): try : player_data = self . get_league_players ( player_count_limit = league_player_count + 1 , player_count_start = league_player_count , is_retry = True ) player_retrieval_successes . extend ( player_data ) except YahooFantasySportsDataNotFound as nested_yfpy_err : player_retrieval_failures . append ( { \"failed_player_retrieval_index\" : league_player_count , \"failed_player_retrieval_url\" : nested_yfpy_err . url , \"failed_player_retrieval_message\" : nested_yfpy_err . message } ) league_player_count += 1 league_player_data . extend ( player_retrieval_successes ) logger . warning ( f \"Players retrieval failures: \\n { prettify_data ( player_retrieval_failures ) } \" ) else : raise yfpy_err logger . debug ( f \"League player count: { league_player_count } \" ) return league_player_data def get_league_draft_results ( self ) -> List [ DraftResult ]: \"\"\"Retrieve draft results for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_draft_results() [ DraftResult({ \"pick\": 1, \"round\": 1, \"team_key\": \"331.l.729259.t.4\", \"player_key\": \"331.p.9317\" }), ..., DraftResult({...}) ] Returns: list[DraftResult]: List of YFPY DraftResult instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /draftresults\" , [ \"league\" , \"draft_results\" ] ) def get_league_transactions ( self ) -> List [ Transaction ]: \"\"\"Retrieve transactions for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_transactions() [ Transaction({ \"players\": [ { \"player\": { \"display_position\": \"RB\", \"editorial_team_abbr\": \"NO\", \"name\": { \"ascii_first\": \"Kerwynn\", \"ascii_last\": \"Williams\", \"first\": \"Kerwynn\", \"full\": \"Kerwynn Williams\", \"last\": \"Williams\" }, \"player_id\": \"26853\", \"player_key\": \"331.p.26853\", \"position_type\": \"O\", \"transaction_data\": { \"destination_team_key\": \"331.l.729259.t.1\", \"destination_team_name\": \"Hellacious Hill 12\", \"destination_type\": \"team\", \"source_type\": \"freeagents\", \"type\": \"add\" } } } ], \"status\": \"successful\", \"timestamp\": \"1419188151\", \"transaction_id\": \"282\", \"transaction_key\": \"331.l.729259.tr.282\", \"type\": \"add/drop\" }), ..., Transaction({...}) ] Returns: list[Transaction]: List of YFPY Transaction instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /transactions\" , [ \"league\" , \"transactions\" ] ) def get_league_scoreboard_by_week ( self , chosen_week : int ) -> Scoreboard : \"\"\"Retrieve scoreboard for chosen league by week. Args: chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_scoreboard_by_week(1) Scoreboard({ \"week\": \"1\", \"matchups\": [ { \"matchup\": { \"is_consolation\": \"0\", \"is_matchup_recap_available\": 1, \"is_playoffs\": \"0\", \"is_tied\": 0, \"matchup_grades\": [ { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.1\" } }, { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.2\" } } ], \"matchup_recap_title\": \"Wax On Wax Off Gets Victory Against Hellacious Hill 12\", \"matchup_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/recap? week=1&mid1=1&mid2=2\", \"status\": \"postevent\", \"teams\": [ { \"team\": { } }, { \"team\": { } } ], \"week\": \"1\", \"week_end\": \"2014-09-08\", \"week_start\": \"2014-09-04\", \"winner_team_key\": \"331.l.729259.t.2\" } }, ... ] }) Returns: Scoreboard: YFPY Scoreboard instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /scoreboard;\" f \"week= { chosen_week } \" , [ \"league\" , \"scoreboard\" ], Scoreboard ) def get_league_matchups_by_week ( self , chosen_week : int ) -> List [ Matchup ]: \"\"\"Retrieve matchups for chosen league by week. Args: chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_matchups_by_week(1) [ Matchup({ \"is_consolation\": \"0\", \"is_matchup_recap_available\": 1, \"is_playoffs\": \"0\", \"is_tied\": 0, \"matchup_grades\": [ { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.1\" } }, { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.2\" } } ], \"matchup_recap_title\": \"Wax On Wax Off Gets Victory Against Hellacious Hill 12\", \"matchup_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/recap? week=1&mid1=1&mid2=2\", \"status\": \"postevent\", \"teams\": [ { \"team\": { } }, { \"team\": { } } ], \"week\": \"1\", \"week_end\": \"2014-09-08\", \"week_start\": \"2014-09-04\", \"winner_team_key\": \"331.l.729259.t.2\" }), ..., Matchup({...}) ] Returns: list[Matchup]: List of YFPY Matchup instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /scoreboard;\" f \"week= { chosen_week } \" , [ \"league\" , \"scoreboard\" , \"0\" , \"matchups\" ] ) def get_team_info ( self , team_id : Union [ str , int ]) -> Team : \"\"\"Retrieve info of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_info(1) Team({ \"clinched_playoffs\": 1, \"draft_grade\": \"B\", \"draft_position\": 4, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1/draftrecap\", \"draft_results\": [ ... ], \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"BMACD7S5UXV7JIQX4PGGUVQJAU\", \"manager_id\": \"1\", \"nickname\": \"--hidden--\" } }, \"matchups\": [ ... ], \"name\": \"Hellacious Hill 12\", \"number_of_moves\": \"71\", \"number_of_trades\": 0, \"roster\": { ... }, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"1\", \"team_key\": \"331.l.729259.t.1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1441/24935131299_a8242dab70_192sq.jpg?ct=fantasy\" } }, \"team_points\": { \"coverage_type\": \"season\", \"season\": \"2014\", \"total\": \"1409.24\" }, \"team_standings\": { \"outcome_totals\": { \"losses\": 5, \"percentage\": 0.643, \"ties\": 0, \"wins\": 9 }, \"playoff_seed\": \"2\", \"points_against\": 1266.6599999999999, \"points_for\": 1409.24, \"rank\": 2, \"streak\": { \"type\": \"win\", \"value\": \"1\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1\", \"waiver_priority\": 9 }) Returns: Team: YFPY Team instance. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } ;\" f \"out=metadata,stats,standings,roster,draftresults,matchups\" , [ \"team\" ], Team ) def get_team_metadata ( self , team_id : Union [ str , int ]) -> Team : \"\"\"Retrieve metadata of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_metadata(1) Team({ \"team_key\": \"331.l.729259.t.1\", \"team_id\": \"1\", \"name\": \"Hellacious Hill 12\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1441/24935131299_a8242dab70_192sq.jpg?ct=fantasy\" } }, \"waiver_priority\": 9, \"number_of_moves\": \"71\", \"number_of_trades\": 0, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"clinched_playoffs\": 1, \"league_scoring_type\": \"head\", \"draft_position\": 4, \"has_draft_grade\": 1, \"draft_grade\": \"B\", \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1/draftrecap\", \"managers\": { \"manager\": { \"guid\": \"BMACD7S5UXV7JIQX4PGGUVQJAU\", \"manager_id\": \"1\", \"nickname\": \"--hidden--\" } } }) Returns: Team: YFPY Team instance. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /metadata\" , [ \"team\" ], Team ) def get_team_stats ( self , team_id : Union [ str , int ]) -> TeamPoints : \"\"\"Retrieve stats of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_stats(1) TeamPoints({ \"coverage_type\": \"season\", \"season\": \"2014\", \"total\": \"1409.24\" }) Returns: TeamPoints: YFPY TeamPoints instance. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /stats\" , [ \"team\" , \"team_points\" ], TeamPoints ) def get_team_stats_by_week ( self , team_id : Union [ str , int ], chosen_week : Union [ int , str ] = \"current\" ) -> Dict [ str , Union [ TeamPoints , TeamProjectedPoints ]]: \"\"\"Retrieve stats of specific team by team_id and by week for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_stats_by_week(1, 1) { \"team_points\": TeamPoints({ \"coverage_type\": \"week\", \"total\": \"95.06\", \"week\": \"1\" }), \"team_projected_points\": TeamProjectedPoints({ \"coverage_type\": \"week\", \"total\": \"78.85\", \"week\": \"1\" }) } Returns: dict[str, TeamPoints | TeamProjectedPoints]: Dictionary containing keys \"team_points\" and \"team_projected_points\" with respective values YFPY TeamPoints and YFPY TeamProjectedPoints instances. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /stats;type=week;week= { chosen_week } \" , [ \"team\" , [ \"team_points\" , \"team_projected_points\" ]] ) def get_team_standings ( self , team_id : Union [ str , int ]) -> TeamStandings : \"\"\"Retrieve standings of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_standings(1) TeamStandings({ \"rank\": 2, \"playoff_seed\": \"2\", \"outcome_totals\": { \"losses\": 5, \"percentage\": 0.643, \"ties\": 0, \"wins\": 9 }, \"streak\": { \"type\": \"win\", \"value\": \"1\" }, \"points_for\": \"1409.24\", \"points_against\": 1266.6599999999999 }) Returns: TeamStandings: YFPY TeamStandings instance. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /standings\" , [ \"team\" , \"team_standings\" ], TeamStandings ) def get_team_roster_by_week ( self , team_id : Union [ str , int ], chosen_week : Union [ int , str ] = \"current\" ) -> Roster : \"\"\"Retrieve roster of specific team by team_id and by week for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_roster_by_week(1, 1) Roster({ \"coverage_type\": \"week\", \"week\": \"1\", \"is_editable\": 0, \"players\": [ { \"player\": { \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt 3PTQ2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"1\" }, \"uniform_number\": \"12\" } }, ... ] }) Returns: Roster: YFPY Roster instance. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /roster;week= { chosen_week } \" , [ \"team\" , \"roster\" ], Roster ) def get_team_roster_player_info_by_week ( self , team_id : Union [ str , int ], chosen_week : Union [ int , str ] = \"current\" ) -> List [ Player ]: \"\"\"Retrieve roster with ALL player info of specific team by team_id and by week for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_roster_player_info_by_week(1, 1) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"draft_analysis\": { \"average_pick\": \"65.9\", \"average_round\": \"7.6\", \"average_cost\": \"5.0\", \"percent_drafted\": \"1.00\" }, \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/ https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"ownership\": { \"ownership_type\": \"team\", \"owner_team_key\": \"331.l.729259.t.1\", \"owner_team_name\": \"Hellacious Hill 12\" }, \"percent_owned\": { \"coverage_type\": \"week\", \"week\": \"17\", \"value\": 99, \"delta\": \"0\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"player_points\": { \"coverage_type\": \"week\", \"week\": \"1\", \"total\": 10.26 }, \"player_stats\": { \"coverage_type\": \"week\", \"week\": \"1\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"249\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"1\" }, \"uniform_number\": \"12\" }), ..., Player({...}) ] Returns: list[Player]: List of YFPY Player instances containing attributes \"draft_analysis\", \"ownership\", \"percent_owned\", and \"player_stats\". \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /roster;week= { chosen_week } /players;\" f \"out=metadata,stats,ownership,percent_owned,draft_analysis\" , [ \"team\" , \"roster\" , \"0\" , \"players\" ] ) def get_team_roster_player_info_by_date ( self , team_id : Union [ str , int ], chosen_date : str = None ) -> List [ Player ]: \"\"\"Retrieve roster with ALL player info of specific team by team_id and by date for chosen league. Note: This applies to MLB, NBA, and NHL leagues, but does NOT apply to NFL leagues. This query will FAIL if you pass it an INVALID date string! Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_date (str): Selected date for which to retrieve data. REQUIRED FORMAT: YYYY-MM-DD (Ex. 2011-05-01) Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nhl\") >>> query.get_team_roster_player_info_by_date(1, \"2011-05-01\") [ Player({ \"display_position\": \"C\", \"draft_analysis\": { \"average_pick\": 33.2, \"average_round\": 3.5, \"average_cost\": 39.2, \"percent_drafted\": 1.0 }, \"editorial_player_key\": \"nhl.p.3981\", \"editorial_team_abbr\": \"Chi\", \"editorial_team_full_name\": \"Chicago Blackhawks\", \"editorial_team_key\": \"nhl.t.4\", \"eligible_positions\": [ \"C\", \"F\" ], \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/tz.KOMoEiBDch6AJAGaUtg--~C/ YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/ https://s.yimg.com/xe/i/us/sp/v/nhl_cutout/players_l/11032021/3981.png\" }, \"is_editable\": 0, \"is_undroppable\": 0, \"name\": { \"ascii_first\": \"Jonathan\", \"ascii_last\": \"Toews\", \"first\": \"Jonathan\", \"full\": \"Jonathan Toews\", \"last\": \"Toews\" }, \"ownership\": { \"ownership_type\": \"team\", \"owner_team_key\": \"303.l.69624.t.2\", \"owner_team_name\": \"The Bateleurs\" }, \"percent_owned\": { \"coverage_type\": \"week\", \"week\": 25, \"value\": 98, \"delta\": -1.0 }, \"player_id\": 3981, \"player_key\": \"303.p.3981\", \"player_notes_last_timestamp\": 1651606838, \"player_stats\": { \"coverage_type\": \"date\", \"stats\": [ { \"stat\": { \"stat_id\": 1, \"value\": 1.0 } }, ... ] }, \"position_type\": \"P\", \"primary_position\": \"C\", \"selected_position\": { \"coverage_type\": \"date\", \"is_flex\": 0, \"position\": \"C\" }, \"uniform_number\": 19 }), ..., Player({...}) ] Returns: list[Player]: List of YFPY Player instances containing attributes \"draft_analysis\", \"ownership\", \"percent_owned\", and \"player_stats\". \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /\" f \"roster { ';date=' + str ( chosen_date ) if chosen_date else '' } /players;\" f \"out=metadata,stats,ownership,percent_owned,draft_analysis\" , [ \"team\" , \"roster\" , \"0\" , \"players\" ] ) def get_team_roster_player_stats ( self , team_id : Union [ str , int ]) -> List [ Player ]: \"\"\"Retrieve roster with ALL player info for the season of specific team by team_id and for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_roster_player_stats(1) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"draft_analysis\": { \"average_pick\": \"65.9\", \"average_round\": \"7.6\", \"average_cost\": \"5.0\", \"percent_drafted\": \"1.00\" }, \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"player_points\": { \"coverage_type\": \"season\", \"total\": 287.06 }, \"player_stats\": { \"coverage_type\": \"season\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"4109\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"16\" }, \"uniform_number\": \"12\" }), ..., Player({...}) ] Returns: list[Player]: List of YFPY Player instances containing attributes \"draft_analysis\", \"ownership\", \"percent_owned\", and \"player_stats\". \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /roster/players/stats;type=season\" , [ \"team\" , \"roster\" , \"0\" , \"players\" ] ) def get_team_roster_player_stats_by_week ( self , team_id : Union [ str , int ], chosen_week : Union [ int , str ] = \"current\" ) -> List [ Player ]: \"\"\"Retrieve roster with player stats of specific team by team_id and by week for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_roster_player_stats_by_week(1, 1) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt 3PTQ2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"player_points\": { \"coverage_type\": \"week\", \"week\": \"1\", \"total\": 10.26 }, \"player_stats\": { \"coverage_type\": \"week\", \"week\": \"1\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"249\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"1\" }, \"uniform_number\": \"12\" }), ..., Player({...}) ] Returns: list[Player]: List of YFPY Player instances containing attribute \"player_stats\". \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /roster;week= { chosen_week } /players/stats\" , [ \"team\" , \"roster\" , \"0\" , \"players\" ] ) def get_team_draft_results ( self , team_id : Union [ str , int ]) -> List [ DraftResult ]: \"\"\"Retrieve draft results of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_draft_results(1) [ DraftResult({ \"pick\": 4, \"round\": 1, \"team_key\": \"331.l.729259.t.1\", \"player_key\": \"331.p.8256\" }), ..., DraftResults({...}) ] Returns: list[DraftResult]: List of YFPY DraftResult instances. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /draftresults\" , [ \"team\" , \"draft_results\" ] ) def get_team_matchups ( self , team_id : Union [ str , int ]) -> List [ Matchup ]: \"\"\"Retrieve matchups of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_matchups(1) [ Matchup({ (see get_league_matchups_by_week docstring for matchup data example) }) ] Returns: list[Matchup]: List of YFPY Matchup instances. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /matchups\" , [ \"team\" , \"matchups\" ] ) def get_player_stats_for_season ( self , player_key : str , limit_to_league_stats : bool = True ) -> Player : \"\"\"Retrieve stats of specific player by player_key for the entire season for chosen league. Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). limit_to_league_stats (bool): Boolean (default: True) to limit the retrieved player stats to those for the selected league. When set to False, query retrieves all player stats for the game (NFL, NHL, NBA, MLB). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_player_stats_for_season(\"331.p.7200\") Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"player_points\": { \"coverage_type\": \"season\", \"total\": 359.14 }, \"player_stats\": { \"coverage_type\": \"season\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"4381\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player: YFPY Player instance. \"\"\" if limit_to_league_stats : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /stats\" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player ) else : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/players;\" f \"player_keys= { player_key } /stats\" , [ \"players\" , \"0\" , \"player\" ], Player ) def get_player_stats_by_week ( self , player_key : str , chosen_week : Union [ int , str ] = \"current\" , limit_to_league_stats : bool = True ) -> Player : \"\"\"Retrieve stats of specific player by player_key and by week for chosen league. Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). chosen_week (int): Selected week for which to retrieve data. limit_to_league_stats (bool): Boolean (default: True) to limit the retrieved player stats to those for the selected league. When set to False, query retrieves all player stats for the game (NFL, NHL, NBA, MLB). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_player_stats_by_week(\"331.p.7200\", 1) Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"player_points\": { \"coverage_type\": \"week\", \"week\": \"1\", \"total\": 10.56 }, \"player_stats\": { \"coverage_type\": \"week\", \"week\": \"1\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"189\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player: YFPY Player instance containing attribute \"player_stats\". \"\"\" if limit_to_league_stats : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /stats;type=week;week= { chosen_week } \" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player ) else : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/players;\" f \"player_keys= { player_key } /stats;type=week;week= { chosen_week } \" , [ \"players\" , \"0\" , \"player\" ], Player ) def get_player_stats_by_date ( self , player_key : str , chosen_date : str = None , limit_to_league_stats : bool = True ) -> Player : \"\"\"Retrieve player stats by player_key and by date for chosen league. Note: This applies to MLB, NBA, and NHL leagues, but does NOT apply to NFL leagues. This query will FAIL if you pass it an INVALID date string! Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). chosen_date (str): Selected date for which to retrieve data. REQUIRED FORMAT: YYYY-MM-DD (Ex. 2011-05-01) limit_to_league_stats (bool): Boolean (default: True) to limit the retrieved player stats to those for the selected league. When set to False, query retrieves all player stats for the game (NFL, NHL, NBA, MLB). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nhl\") >>> query.get_player_stats_by_date(\"nhl.p.4588\", \"2011-05-01\") Player({ \"display_position\": \"G\", \"editorial_player_key\": \"nhl.p.4588\", \"editorial_team_abbr\": \"Was\", \"editorial_team_full_name\": \"Washington Capitals\", \"editorial_team_key\": \"nhl.t.23\", \"eligible_positions\": { \"position\": \"G\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/CzntDh_d59voTqU6fhQy3g--~C/YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2 NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/https://s.yimg.com/ xe/i/us/sp/v/nhl_cutout/players_l/10182019/4588.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Braden\", \"ascii_last\": \"Holtby\", \"first\": \"Braden\", \"full\": \"Braden Holtby\", \"last\": \"Holtby\" }, \"player_id\": \"4588\", \"player_key\": \"303.p.4588\", \"player_notes_last_timestamp\": 1574133600, \"player_stats\": { \"coverage_type\": \"date\", \"stats\": [ { \"stat\": { \"stat_id\": \"19\", \"value\": \"1\" } }, { \"stat\": { \"stat_id\": \"22\", \"value\": \"1\" } }, { \"stat\": { \"stat_id\": \"23\", \"value\": \"1.00\" } }, { \"stat\": { \"stat_id\": \"25\", \"value\": \"29\" } }, { \"stat\": { \"stat_id\": \"24\", \"value\": \"30\" } }, { \"stat\": { \"stat_id\": \"26\", \"value\": \".967\" } }, { \"stat\": { \"stat_id\": \"27\", \"value\": \"0\" } } ] }, \"position_type\": \"G\", \"primary_position\": \"G\", \"uniform_number\": \"70\" }) Returns: Player: YFPY Player instnace containing attribute \"player_stats\". \"\"\" if limit_to_league_stats : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /stats;type=date;date= { chosen_date } \" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player ) else : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/players;\" f \"player_keys= { player_key } /stats;type=date;date= { chosen_date } \" , [ \"players\" , \"0\" , \"player\" ], Player ) def get_player_ownership ( self , player_key : str ) -> Player : \"\"\"Retrieve ownership of specific player by player_key for chosen league. Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_player_ownership(\"331.p.7200\") Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"ownership\": { \"ownership_type\": \"team\", \"owner_team_key\": \"331.l.729259.t.4\", \"owner_team_name\": \"hold my D\", \"teams\": { \"team\": { \"clinched_playoffs\": 1, \"draft_grade\": \"B-\", \"draft_position\": 1, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/4/draftrecap\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"5KLNXUYW5RP22UMRKUXHBCIITI\", \"manager_id\": \"4\", \"nickname\": \"--hidden--\" } }, \"name\": \"hold my D\", \"number_of_moves\": \"27\", \"number_of_trades\": \"1\", \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"4\", \"team_key\": \"331.l.729259.t.4\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1589/24677593583_68859308dd_192sq.jpg?ct=fantasy\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/4\", \"waiver_priority\": 7 } } }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player: YFPY Player instance containing attribute \"ownership\". \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /ownership\" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player ) def get_player_percent_owned_by_week ( self , player_key : str , chosen_week : Union [ int , str ] = \"current\" ) -> Player : \"\"\"Retrieve percent-owned of specific player by player_key and by week for chosen league. Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_player_percent_owned_by_week(\"331.p.7200\", 1) Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/ https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"percent_owned\": { \"coverage_type\": \"week\", \"week\": \"1\", \"value\": 100, \"delta\": \"0\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player: YFPY Player instance containing attribute \"percent_owned\". \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /percent_owned;type=week;week= { chosen_week } \" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player ) def get_player_draft_analysis ( self , player_key : str ) -> Player : \"\"\"Retrieve draft analysis of specific player by player_key for chosen league. Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_player_draft_analysis(\"331.p.7200\") Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"draft_analysis\": { \"average_pick\": \"19.9\", \"average_round\": \"2.8\", \"average_cost\": \"38.5\", \"percent_drafted\": \"1.00\" }, \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player: YFPY Player instance containing attribute \"draft_analysis\". \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /draft_analysis\" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player ) __init__ \u00b6 __init__ ( league_id , game_code , game_id = None , yahoo_consumer_key = None , yahoo_consumer_secret = None , yahoo_access_token_json = None , env_var_fallback = True , env_file_location = None , save_token_data_to_env_file = False , all_output_as_json_str = False , browser_callback = not runtime_environment_is_docker , retries = 3 , backoff = 0 , offline = False , ) Instantiate a YahooQueryObject for running queries against the Yahoo fantasy REST API. Parameters: league_id ( str ) \u2013 League ID of selected Yahoo Fantasy league. game_code ( str ) \u2013 Game code of selected Yahoo Fantasy game corresponding to a specific sport (refers to the current season if used as the value for game_key), where \"nfl\" is for fantasy football, \"nhl\" is for fantasy hockey, \"mlb\" is for fantasy baseball, and \"nba\" is for fantasy basketball. game_id \u2013 obj: int , optional): Game ID of selected Yahoo fantasy game corresponding to a specific year, and defaulting to the game ID for the current year. yahoo_consumer_key \u2013 obj: str , optional): User defined Yahoo developer app consumer key (must be provided in conjunction with yahoo_consumer_secret). yahoo_consumer_secret \u2013 obj: str , optional): User defined Yahoo developer app consumer secret (must be provided in conjunction with yahoo_consumer_key). yahoo_access_token_json ( str | dict , default: None ) \u2013 User defined JSON (string or dict) containing refreshable access token generated by the yahoo-oauth library to avoid having to reauthenticate on every access to the Yahoo Fantasy Sports API (overrides yahoo_consumer_key/yahoo_consumer_secret and all Yahoo access token environment variables). env_var_fallback \u2013 obj: bool , optional): Fall back to values retrieved from environment variables for any missing arguments or access token fields (defaults to True). env_file_location \u2013 obj: Path , optional): Path to directory where existing .env file is located or new .env file should be generated when provided in conjunction with save_access_token_data_to_env_file=True (defaults to None). save_token_data_to_env_file \u2013 obj: bool , optional): Boolean to save Yahoo access token data to local .env file (must be provided in conjunction with env_file_location) (defaults to False) all_output_as_json_str \u2013 obj: bool , optional): Option to automatically convert all query output to JSON strings. browser_callback \u2013 obj: bool , optional): Enable or disable (enabled by default) whether the yahoo-oauth library automatically opens a browser window to authenticate (if disabled, it will output the callback URL). retries \u2013 obj: int , optional): Number of times to retry a query if it fails (defaults to 3). backoff \u2013 obj: int , optional): Multiplier that incrementally increases the wait time before retrying a failed query request. offline \u2013 obj: bool , optional): Boolean to run in offline mode (Only works if all needed Yahoo Fantasy data has been previously saved locally using the Data module in data.py). Attributes: _env_var_fallback ( bool ) \u2013 Fall back to values retrieved from environment variables for any missing arguments or access token fields. _yahoo_access_token_dict ( dict [ str , Any ] ) \u2013 Dictionary containing refreshable access token data generated by the yahoo-oauth library to avoid having to reauthenticate on every access to the Yahoo Fantasy Sports API. _yahoo_consumer_key ( str ) \u2013 User defined Yahoo developer app consumer key. _yahoo_consumer_secret ( str ) \u2013 User defined Yahoo developer app consumer secret. _browser_callback ( bool ) \u2013 Enable or disable (enabled by default) whether the yahoo-oauth library automatically opens a browser window to authenticate (if disabled, it will output the callback URL). _retries ( int ) \u2013 Number of times to retry a query if it fails (defaults to 3). _backoff ( int ) \u2013 Multiplier that incrementally increases the wait time before retrying a failed query request. _fantasy_content_data_field ( str ) \u2013 The initial JSON field in which all Yahoo Fantasy Sports API responses store the data output of the submitted query. league_id ( str ) \u2013 League ID of selected Yahoo Fantasy league. game_code ( str ) \u2013 Game code of selected Yahoo Fantasy game corresponding to a specific sport (refers to the current season if used as the value for game_key), where \"nfl\" is for fantasy football, \"nhl\" is for fantasy hockey, \"mlb\" is for fantasy baseball, and \"nba\" is for fantasy basketball. game_id ( int ) \u2013 Game ID of selected Yahoo fantasy game corresponding to a specific year, and defaulting to the game ID for the current year. league_key ( str ) \u2013 The Yahoo Fantasy Sports league key formatted as .l. . executed_queries ( list [ dict [ str , Any ]] ) \u2013 List of completed queries and their responses. all_output_as_json_str ( bool ) \u2013 Option to automatically convert all query output to JSON strings. offline ( bool ) \u2013 Boolean to run in offline mode (Only works if all needed Yahoo Fantasy data has been previously saved locally using the Data module in data.py). Source code in yfpy/query.py 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 227 228 229 230 231 232 233 234 def __init__ ( self , league_id : str , game_code : str , game_id : Optional [ int ] = None , yahoo_consumer_key : Optional [ str ] = None , yahoo_consumer_secret : Optional [ str ] = None , yahoo_access_token_json : Optional [ Union [ str , Dict ]] = None , env_var_fallback : bool = True , env_file_location : Optional [ Path ] = None , save_token_data_to_env_file : Optional [ bool ] = False , all_output_as_json_str : bool = False , browser_callback : bool = not runtime_environment_is_docker , retries : int = 3 , backoff : int = 0 , offline : bool = False ): \"\"\"Instantiate a YahooQueryObject for running queries against the Yahoo fantasy REST API. Args: league_id (str): League ID of selected Yahoo Fantasy league. game_code (str): Game code of selected Yahoo Fantasy game corresponding to a specific sport (refers to the current season if used as the value for game_key), where \"nfl\" is for fantasy football, \"nhl\" is for fantasy hockey, \"mlb\" is for fantasy baseball, and \"nba\" is for fantasy basketball. game_id (:obj:`int`, optional): Game ID of selected Yahoo fantasy game corresponding to a specific year, and defaulting to the game ID for the current year. yahoo_consumer_key (:obj:`str`, optional): User defined Yahoo developer app consumer key (must be provided in conjunction with yahoo_consumer_secret). yahoo_consumer_secret (:obj:`str`, optional): User defined Yahoo developer app consumer secret (must be provided in conjunction with yahoo_consumer_key). yahoo_access_token_json (str | dict, optional): User defined JSON (string or dict) containing refreshable access token generated by the yahoo-oauth library to avoid having to reauthenticate on every access to the Yahoo Fantasy Sports API (overrides yahoo_consumer_key/yahoo_consumer_secret and all Yahoo access token environment variables). env_var_fallback (:obj:`bool`, optional): Fall back to values retrieved from environment variables for any missing arguments or access token fields (defaults to True). env_file_location (:obj:`Path`, optional): Path to directory where existing .env file is located or new .env file should be generated when provided in conjunction with save_access_token_data_to_env_file=True (defaults to None). save_token_data_to_env_file (:obj:`bool`, optional): Boolean to save Yahoo access token data to local .env file (must be provided in conjunction with env_file_location) (defaults to False) all_output_as_json_str (:obj:`bool`, optional): Option to automatically convert all query output to JSON strings. browser_callback (:obj:`bool`, optional): Enable or disable (enabled by default) whether the yahoo-oauth library automatically opens a browser window to authenticate (if disabled, it will output the callback URL). retries (:obj:`int`, optional): Number of times to retry a query if it fails (defaults to 3). backoff (:obj:`int`, optional): Multiplier that incrementally increases the wait time before retrying a failed query request. offline (:obj:`bool`, optional): Boolean to run in offline mode (Only works if all needed Yahoo Fantasy data has been previously saved locally using the Data module in data.py). Attributes: _env_var_fallback (bool): Fall back to values retrieved from environment variables for any missing arguments or access token fields. _yahoo_access_token_dict (dict[str, Any]): Dictionary containing refreshable access token data generated by the yahoo-oauth library to avoid having to reauthenticate on every access to the Yahoo Fantasy Sports API. _yahoo_consumer_key (str): User defined Yahoo developer app consumer key. _yahoo_consumer_secret (str): User defined Yahoo developer app consumer secret. _browser_callback (bool): Enable or disable (enabled by default) whether the yahoo-oauth library automatically opens a browser window to authenticate (if disabled, it will output the callback URL). _retries (int): Number of times to retry a query if it fails (defaults to 3). _backoff (int): Multiplier that incrementally increases the wait time before retrying a failed query request. _fantasy_content_data_field (str): The initial JSON field in which all Yahoo Fantasy Sports API responses store the data output of the submitted query. league_id (str): League ID of selected Yahoo Fantasy league. game_code (str): Game code of selected Yahoo Fantasy game corresponding to a specific sport (refers to the current season if used as the value for game_key), where \"nfl\" is for fantasy football, \"nhl\" is for fantasy hockey, \"mlb\" is for fantasy baseball, and \"nba\" is for fantasy basketball. game_id (int): Game ID of selected Yahoo fantasy game corresponding to a specific year, and defaulting to the game ID for the current year. league_key (str): The Yahoo Fantasy Sports league key formatted as .l.. executed_queries (list[dict[str, Any]]): List of completed queries and their responses. all_output_as_json_str (bool): Option to automatically convert all query output to JSON strings. offline (bool): Boolean to run in offline mode (Only works if all needed Yahoo Fantasy data has been previously saved locally using the Data module in data.py). \"\"\" self . _env_var_fallback = env_var_fallback # load provided .env file if it exists to read any additional environment variables stored there if self . _env_var_fallback and env_file_location : env_file_path = env_file_location / \".env\" if env_file_path . is_file (): load_dotenv ( env_file_path ) self . _yahoo_access_token_dict : Dict [ str , Any ] = self . _get_dict_from_access_token_json ( yahoo_access_token_json ) # warn user that providing Yahoo access token JSON or populating a YAHOO_ACCESS_TOKEN_JSON environment variable # will override any values provided in the yahoo_consumer_key and yahoo_consumer_secret parameters if self . _yahoo_access_token_dict and ( yahoo_consumer_key or yahoo_consumer_secret ): logger . warning ( \"Providing a yahoo_access_token_json argument or setting env_var_fallback to True and having a \" \"YAHOO_ACCESS_TOKEN_JSON will override any values provided for yahoo_consumer_key or \" \"yahoo_consumer_secret.\" ) # retrieve the Yahoo consumer key and Yahoo consumer secret from the access token dict and fall back to the # provided parameters if no dict exists self . _yahoo_consumer_key = self . _yahoo_access_token_dict . get ( \"consumer_key\" , yahoo_consumer_key ) self . _yahoo_consumer_secret = self . _yahoo_access_token_dict . get ( \"consumer_secret\" , yahoo_consumer_secret ) # catch when a Yahoo consumer key was not provided if not self . _yahoo_consumer_key : # check for YAHOO_CONSUMER_KEY environment variable value if env_var_fallback is True if self . _env_var_fallback : if yahoo_consumer_key_env_var := os . environ . get ( \"YAHOO_CONSUMER_KEY\" ): self . _yahoo_consumer_key = yahoo_consumer_key_env_var if not self . _yahoo_consumer_key : logger . error ( \"Missing required Yahoo consumer key (no yahoo_consumer_key argument provided to \" \"YahooFantasySportsQuery, no consumer_key value provided in yahoo_access_token_json, or no \" \"YAHOO_CONSUMER_KEY environment variable value found).\" ) sys . exit ( 1 ) # catch when a Yahoo consumer secret was not provided if not self . _yahoo_consumer_secret : # check for YAHOO_CONSUMER_SECRET environment variable value if env_var_fallback is True if self . _env_var_fallback : if yahoo_consumer_secret_env_var := os . environ . get ( \"YAHOO_CONSUMER_SECRET\" ): self . _yahoo_consumer_secret = yahoo_consumer_secret_env_var if not self . _yahoo_consumer_secret : logger . error ( \"Missing required Yahoo consumer secret (no yahoo_consumer_secret argument provided to \" \"YahooFantasySportsQuery, no consumer_secret value provided in yahoo_access_token_json, or no \" \"YAHOO_CONSUMER_SECRET environment variable value found).\" ) sys . exit ( 1 ) # explicitly check for truthy/falsy value self . _browser_callback : bool = True if browser_callback is True else False self . _retries : int = retries self . _backoff : int = backoff self . _fantasy_content_data_field : str = \"fantasy_content\" self . league_id : str = league_id self . game_code : str = ( game_code if game_code in yahoo_fantasy_sports_game_codes else retrieve_game_code_from_user () ) self . game_id : int = game_id self . league_key : str = None self . executed_queries : List [ Dict [ str , Any ]] = [] # explicitly check for truthy/falsy value self . all_output_as_json_str : bool = True if all_output_as_json_str is True else False # explicitly check for truthy/falsy value self . offline : bool = True if offline is True else False if not self . offline : self . _authenticate () if save_token_data_to_env_file : self . save_access_token_data_to_env_file ( env_file_location ) save_access_token_data_to_env_file \u00b6 save_access_token_data_to_env_file ( env_file_directory , env_file_name = \".env\" , save_json_to_var = False , ) Saves the fields and values of a Yahoo access token into a .env file. Parameters: env_file_directory ( Path ) \u2013 The path to the directory where the target .env file is/will be located. env_file_name \u2013 obj: str , optional): The name of the target .env file (defaults to \".env\"). save_json_to_var \u2013 obj: bool , optional): Boolean to determine whether or not to write a JSON string of Yahoo access token fields to a YAHOO_ACCESS_TOKEN_JSON environment variable in the target .env file (defaults to False). Returns: None \u2013 None Source code in yfpy/query.py 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 def save_access_token_data_to_env_file ( self , env_file_directory : Path , env_file_name : str = \".env\" , save_json_to_var : bool = False ) -> None : \"\"\"Saves the fields and values of a Yahoo access token into a .env file. Args: env_file_directory (Path): The path to the directory where the target .env file is/will be located. env_file_name (:obj:`str`, optional): The name of the target .env file (defaults to \".env\"). save_json_to_var (:obj:`bool`, optional): Boolean to determine whether or not to write a JSON string of Yahoo access token fields to a YAHOO_ACCESS_TOKEN_JSON environment variable in the target .env file (defaults to False). Returns: None \"\"\" if env_file_directory : env_file_path = env_file_directory / env_file_name else : logger . warning ( \"Missing argument env_file_location. Yahoo access token will NOT be saved to .env file.\" ) # exit method without saving Yahoo access token data when no env_file_location argument is provided return env_file_content = self . _retrieve_env_file_contents ( env_file_path ) # replace values of any matching environment variables in .env file with values from Yahoo access token fields for k , v in self . _yahoo_access_token_dict . items (): env_file_content [ f \"yahoo_ { k } \" ] = v # generate a JSON string with escaped double quotes using nested json.dumps() and write it to a # YAHOO_ACCESS_TOKEN_JSON environment variable if save_json_to_var is set to True if save_json_to_var : env_file_content [ \"yahoo_access_token_json\" ] = json . dumps ( json . dumps ( self . _yahoo_access_token_dict )) # write contents to .env file (overwrites contents if file exists or creates a new file if not) with open ( env_file_path , \"w\" ) as env_file : for k , v in env_file_content . items (): if k . startswith ( \"blank\" ): env_file . write ( v ) elif k . startswith ( \"comment\" ): env_file . write ( f \" { v } \\n \" ) else : env_file . write ( f \" { k . upper () } = { v } \\n \" ) get_response \u00b6 get_response ( url ) Retrieve Yahoo Fantasy Sports data from the REST API. Parameters: url ( str ) \u2013 REST API request URL string. Returns: Response ( Response ) \u2013 API response from Yahoo Fantasy Sports API request. Source code in yfpy/query.py 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 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 def get_response ( self , url : str ) -> Response : \"\"\"Retrieve Yahoo Fantasy Sports data from the REST API. Args: url (str): REST API request URL string. Returns: Response: API response from Yahoo Fantasy Sports API request. \"\"\" logger . debug ( f \"Making request to URL: { url } \" ) response : Response = self . oauth . session . get ( url , params = { \"format\" : \"json\" }) status_code = response . status_code # when you exceed Yahoo's allowed data request limits, they throw a request status code of 999 if status_code == 999 : raise HTTPError ( \"Yahoo data unavailable due to rate limiting. Please try again later.\" ) if status_code == 401 : self . _authenticate () response_json = {} try : response_json = response . json () logger . debug ( f \"Response (JSON): { response_json } \" ) except JSONDecodeError : response . raise_for_status () try : if ( status_code // 100 ) != 2 : # handle if the yahoo query returns an error if response_json . get ( \"error\" ): response_error_msg = response_json . get ( \"error\" ) . get ( \"description\" ) error_msg = f \"Attempt to retrieve data at URL { response . url } failed with error: \" \\ f \" \\\" { response_error_msg } \\\" \" logger . error ( error_msg ) raise YahooFantasySportsDataNotFound ( error_msg , url = response . url ) response . raise_for_status () except HTTPError as e : # retry with incremental back-off if self . _retries > 0 : self . _retries -= 1 self . _backoff += 1 logger . warning ( f \"Request for URL { url } failed with status code { response . status_code } . \" f \"Retrying { self . _retries } more time { 's' if self . _retries > 1 else '' } ...\" ) time . sleep ( 0.3 * self . _backoff ) response = self . get_response ( url ) else : # log error and terminate query if status code is not 200 after 3 retries logger . error ( f \"Request failed with status code: { response . status_code } - { e } \" ) response . raise_for_status () raw_response_data = response_json . get ( self . _fantasy_content_data_field ) # extract data from \"fantasy_content\" field if it exists if raw_response_data : logger . debug ( f \"Data fetched with query URL: { response . url } \" ) logger . debug ( f \"Response (Yahoo fantasy data extracted from: \" f \" \\\" { self . _fantasy_content_data_field } \\\" ): { raw_response_data } \" ) else : error_msg = f \"No data found at URL { response . url } when attempting extraction from field: \" \\ f \" \\\" { self . _fantasy_content_data_field } \\\" \" logger . error ( error_msg ) raise YahooFantasySportsDataNotFound ( error_msg , url = response . url ) return response query \u00b6 query ( url , data_key_list , data_type_class = None , sort_function = None , ) Base query class to retrieve requested data from the Yahoo fantasy sports REST API. Parameters: url ( str ) \u2013 REST API request URL string. data_key_list ( list [ str ] | list [ list [ str ]] ) \u2013 List of keys used to extract the specific data desired by the given query (supports strings and lists of strings). Supports lists containing only key strings such as [\"game\", \"stat_categories\"], and also supports lists containing key strings followed by lists of key strings such as [\"team\", [\"team_points\", \"team_projected_points\"]]. data_type_class \u2013 obj: Type , optional): Highest level data model type (if one exists for the retrieved data). sort_function ( Callable of sort function , default: None ) \u2013 Optional lambda function to return sorted query results. Returns: object ( Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]] ) \u2013 Model class instance from yfpy/models.py, dictionary, or list (depending on query), with unpacked Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]] \u2013 and parsed response data. Source code in yfpy/query.py 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 def query ( self , url : str , data_key_list : Union [ List [ str ], List [ List [ str ]]], data_type_class : Type = None , sort_function : Callable = None ) -> ( Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]]): \"\"\"Base query class to retrieve requested data from the Yahoo fantasy sports REST API. Args: url (str): REST API request URL string. data_key_list (list[str] | list[list[str]]): List of keys used to extract the specific data desired by the given query (supports strings and lists of strings). Supports lists containing only key strings such as [\"game\", \"stat_categories\"], and also supports lists containing key strings followed by lists of key strings such as [\"team\", [\"team_points\", \"team_projected_points\"]]. data_type_class (:obj:`Type`, optional): Highest level data model type (if one exists for the retrieved data). sort_function (Callable of sort function, optional)): Optional lambda function to return sorted query results. Returns: object: Model class instance from yfpy/models.py, dictionary, or list (depending on query), with unpacked and parsed response data. \"\"\" if not self . offline : response = self . get_response ( url ) raw_response_data = response . json () . get ( self . _fantasy_content_data_field ) # print(json.dumps(raw_response_data, indent=2)) # iterate through list of data keys and drill down to final desired data field for i in range ( len ( data_key_list )): if isinstance ( raw_response_data , list ): if isinstance ( data_key_list [ i ], list ): reformatted = reformat_json_list ( raw_response_data ) raw_response_data = [ { data_key_list [ i ][ 0 ]: reformatted [ data_key_list [ i ][ 0 ]]}, { data_key_list [ i ][ 1 ]: reformatted [ data_key_list [ i ][ 1 ]]} ] else : raw_response_data = reformat_json_list ( raw_response_data )[ data_key_list [ i ]] else : if isinstance ( data_key_list [ i ], list ): raw_response_data = [ { data_key_list [ i ][ 0 ]: raw_response_data [ data_key_list [ i ][ 0 ]]}, { data_key_list [ i ][ 1 ]: raw_response_data [ data_key_list [ i ][ 1 ]]} ] else : raw_response_data = raw_response_data . get ( data_key_list [ i ]) if raw_response_data : logger . debug ( f \"Response (Yahoo fantasy data extracted from: { data_key_list } ): { raw_response_data } \" ) else : error_msg = f \"No data found when attempting extraction from fields: { data_key_list } \" logger . error ( error_msg ) raise YahooFantasySportsDataNotFound ( error_msg , payload = data_key_list , url = response . url ) # unpack, parse, and assign data types to all retrieved data content unpacked = unpack_data ( raw_response_data , YahooFantasyObject ) logger . debug ( f \"Unpacked and parsed JSON (Yahoo fantasy data wth parent type: { data_type_class } ): \\n { unpacked } \" ) self . executed_queries . append ({ \"url\" : response . url , \"response_status_code\" : response . status_code , \"response\" : response }) # cast the highest level of data to type corresponding to query (if type exists) query_data = data_type_class ( unpacked ) if data_type_class else unpacked # sort data when applicable if sort_function and not isinstance ( query_data , dict ): query_data = sorted ( query_data , key = sort_function ) # flatten lists of single-key dicts of objects into lists of those objects if isinstance ( query_data , list ): last_data_key = data_key_list [ - 1 ] if last_data_key . endswith ( \"s\" ): query_data = [ el [ last_data_key [: - 1 ]] for el in query_data ] if self . all_output_as_json_str : return jsonify_data ( query_data ) else : return query_data else : logger . error ( \"Cannot run Yahoo query while using offline mode! Please try again with offline=False.\" ) get_all_yahoo_fantasy_game_keys \u00b6 get_all_yahoo_fantasy_game_keys () Retrieve all Yahoo Fantasy Sports game keys by ID (from year of inception to present), sorted by season/year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_all_yahoo_fantasy_game_keys () [ Game({ \"code\": \"nfl\", \"game_id\": \"50\", \"game_key\": \"50\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"1999\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/1999\" }), ..., Game({...}) ] Returns: List [ Game ] \u2013 list[Game]: List of YFPY Game instances. Source code in yfpy/query.py 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 def get_all_yahoo_fantasy_game_keys ( self ) -> List [ Game ]: \"\"\"Retrieve all Yahoo Fantasy Sports game keys by ID (from year of inception to present), sorted by season/year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_all_yahoo_fantasy_game_keys() [ Game({ \"code\": \"nfl\", \"game_id\": \"50\", \"game_key\": \"50\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"1999\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/1999\" }), ..., Game({...}) ] Returns: list[Game]: List of YFPY Game instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/games;game_codes= { self . game_code } \" , [ \"games\" ], sort_function = lambda x : x . get ( \"game\" ) . season ) get_game_key_by_season \u00b6 get_game_key_by_season ( season ) Retrieve specific game key by season. Parameters: season ( int ) \u2013 User defined season/year for which to retrieve the Yahoo Fantasy Sports game. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_game_key_by_season ( 2021 ) 338 Returns: str ( str ) \u2013 The game key for a Yahoo Fantasy Sports game specified by season. Source code in yfpy/query.py 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 def get_game_key_by_season ( self , season : int ) -> str : \"\"\"Retrieve specific game key by season. Args: season (int): User defined season/year for which to retrieve the Yahoo Fantasy Sports game. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_key_by_season(2021) 338 Returns: str: The game key for a Yahoo Fantasy Sports game specified by season. \"\"\" all_output_as_json = False if self . all_output_as_json_str : self . all_output_as_json_str = False all_output_as_json = True game_key = self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/games;game_codes= { self . game_code } ;seasons= { season } \" , [ \"games\" ] ) . get ( \"game\" ) . game_key if all_output_as_json : self . all_output_as_json_str = True return game_key get_current_game_info \u00b6 get_current_game_info () Retrieve game info for current fantasy season. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_current_game_info () Game({ \"code\": \"nfl\", \"game_id\": \"390\", \"game_key\": \"390\", \"game_weeks\": [ { \"game_week\": { \"display_name\": \"1\", \"end\": \"2019-09-09\", \"start\": \"2019-09-05\", \"week\": \"1\" } }, ... ], \"is_game_over\": 0, \"is_live_draft_lobby_active\": 1, \"is_offseason\": 0, \"is_registration_over\": 0, \"name\": \"Football\", \"position_types\": [ { \"position_type\": { \"type\": \"O\", \"display_name\": \"Offense\" } }, ... ], \"roster_positions\": [ { \"roster_position\": { \"position\": \"QB\", \"position_type\": \"O\" } }, ... ], \"season\": \"2019\", \"stat_categories\": { \"stats\": [ { \"stat\": { \"display_name\": \"GP\", \"name\": \"Games Played\", \"sort_order\": \"1\", \"stat_id\": 0 } }, ... }, \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/f1\" }) Returns: Game ( Game ) \u2013 YFPY Game instance. Source code in yfpy/query.py 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 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 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 def get_current_game_info ( self ) -> Game : \"\"\"Retrieve game info for current fantasy season. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_current_game_info() Game({ \"code\": \"nfl\", \"game_id\": \"390\", \"game_key\": \"390\", \"game_weeks\": [ { \"game_week\": { \"display_name\": \"1\", \"end\": \"2019-09-09\", \"start\": \"2019-09-05\", \"week\": \"1\" } }, ... ], \"is_game_over\": 0, \"is_live_draft_lobby_active\": 1, \"is_offseason\": 0, \"is_registration_over\": 0, \"name\": \"Football\", \"position_types\": [ { \"position_type\": { \"type\": \"O\", \"display_name\": \"Offense\" } }, ... ], \"roster_positions\": [ { \"roster_position\": { \"position\": \"QB\", \"position_type\": \"O\" } }, ... ], \"season\": \"2019\", \"stat_categories\": { \"stats\": [ { \"stat\": { \"display_name\": \"GP\", \"name\": \"Games Played\", \"sort_order\": \"1\", \"stat_id\": 0 } }, ... }, \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/f1\" }) Returns: Game: YFPY Game instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { self . game_code } ;\" f \"out=metadata,players,game_weeks,stat_categories,position_types,roster_positions\" , [ \"game\" ], Game ) get_current_game_metadata \u00b6 get_current_game_metadata () Retrieve game metadata for current fantasy season. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_current_game_metadata () Game({ \"code\": \"nfl\", \"game_id\": \"390\", \"game_key\": \"390\", \"is_game_over\": 0, \"is_live_draft_lobby_active\": 1, \"is_offseason\": 0, \"is_registration_over\": 0, \"name\": \"Football\", \"season\": \"2019\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/f1\" }) Returns: Game ( Game ) \u2013 YFPY Game instance. Source code in yfpy/query.py 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 def get_current_game_metadata ( self ) -> Game : \"\"\"Retrieve game metadata for current fantasy season. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_current_game_metadata() Game({ \"code\": \"nfl\", \"game_id\": \"390\", \"game_key\": \"390\", \"is_game_over\": 0, \"is_live_draft_lobby_active\": 1, \"is_offseason\": 0, \"is_registration_over\": 0, \"name\": \"Football\", \"season\": \"2019\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/f1\" }) Returns: Game: YFPY Game instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { self . game_code } /metadata\" , [ \"game\" ], Game ) get_game_info_by_game_id \u00b6 get_game_info_by_game_id ( game_id ) Retrieve game info for specific game by ID. Parameters: game_id ( int ) \u2013 Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_game_info_by_game_id ( 390 ) Game({ \"code\": \"nfl\", \"game_id\": \"390\", \"game_key\": \"390\", \"game_weeks\": [ { \"game_week\": { \"display_name\": \"1\", \"end\": \"2019-09-09\", \"start\": \"2019-09-05\", \"week\": \"1\" } }, ... ], \"is_game_over\": 0, \"is_live_draft_lobby_active\": 1, \"is_offseason\": 0, \"is_registration_over\": 0, \"name\": \"Football\", \"position_types\": [ { \"position_type\": { \"type\": \"O\", \"display_name\": \"Offense\" } }, ... ], \"roster_positions\": [ { \"roster_position\": { \"position\": \"QB\", \"position_type\": \"O\" } }, ... ], \"season\": \"2019\", \"stat_categories\": { \"stats\": [ { \"stat\": { \"display_name\": \"GP\", \"name\": \"Games Played\", \"sort_order\": \"1\", \"stat_id\": 0 } }, ... }, \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/f1\" }) Returns: Game ( Game ) \u2013 YFPY Game instance. Source code in yfpy/query.py 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 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 def get_game_info_by_game_id ( self , game_id : int ) -> Game : \"\"\"Retrieve game info for specific game by ID. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_info_by_game_id(390) Game({ \"code\": \"nfl\", \"game_id\": \"390\", \"game_key\": \"390\", \"game_weeks\": [ { \"game_week\": { \"display_name\": \"1\", \"end\": \"2019-09-09\", \"start\": \"2019-09-05\", \"week\": \"1\" } }, ... ], \"is_game_over\": 0, \"is_live_draft_lobby_active\": 1, \"is_offseason\": 0, \"is_registration_over\": 0, \"name\": \"Football\", \"position_types\": [ { \"position_type\": { \"type\": \"O\", \"display_name\": \"Offense\" } }, ... ], \"roster_positions\": [ { \"roster_position\": { \"position\": \"QB\", \"position_type\": \"O\" } }, ... ], \"season\": \"2019\", \"stat_categories\": { \"stats\": [ { \"stat\": { \"display_name\": \"GP\", \"name\": \"Games Played\", \"sort_order\": \"1\", \"stat_id\": 0 } }, ... }, \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/f1\" }) Returns: Game: YFPY Game instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } ;\" f \"out=metadata,players,game_weeks,stat_categories,position_types,roster_positions\" , [ \"game\" ], Game ) get_game_metadata_by_game_id \u00b6 get_game_metadata_by_game_id ( game_id ) Retrieve game metadata for specific game by ID. Parameters: game_id ( int ) \u2013 Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_game_metadata_by_game_id ( 331 ) Game({ \"code\": \"nfl\", \"game_id\": \"331\", \"game_key\": \"331\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"2014\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014\" }) Returns: Game ( Game ) \u2013 YFPY Game instance. Source code in yfpy/query.py 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 def get_game_metadata_by_game_id ( self , game_id : int ) -> Game : \"\"\"Retrieve game metadata for specific game by ID. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_metadata_by_game_id(331) Game({ \"code\": \"nfl\", \"game_id\": \"331\", \"game_key\": \"331\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"2014\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014\" }) Returns: Game: YFPY Game instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } /metadata\" , [ \"game\" ], Game ) get_game_weeks_by_game_id \u00b6 get_game_weeks_by_game_id ( game_id ) Retrieve all valid weeks of a specific game by ID. Parameters: game_id ( int ) \u2013 Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_game_weeks_by_game_id ( 331 ) [ GameWeek({ \"display_name\": \"1\", \"end\": \"2014-09-08\", \"start\": \"2014-09-04\", \"week\": \"1\" }), ..., GameWeek({ \"display_name\": \"17\", \"end\": \"2014-12-28\", \"start\": \"2014-12-23\", \"week\": \"17\" }) ] Returns: List [ GameWeek ] \u2013 list[GameWeek]: List of YFPY GameWeek instances. Source code in yfpy/query.py 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 def get_game_weeks_by_game_id ( self , game_id : int ) -> List [ GameWeek ]: \"\"\"Retrieve all valid weeks of a specific game by ID. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_weeks_by_game_id(331) [ GameWeek({ \"display_name\": \"1\", \"end\": \"2014-09-08\", \"start\": \"2014-09-04\", \"week\": \"1\" }), ..., GameWeek({ \"display_name\": \"17\", \"end\": \"2014-12-28\", \"start\": \"2014-12-23\", \"week\": \"17\" }) ] Returns: list[GameWeek]: List of YFPY GameWeek instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } /game_weeks\" , [ \"game\" , \"game_weeks\" ] ) get_game_stat_categories_by_game_id \u00b6 get_game_stat_categories_by_game_id ( game_id ) Retrieve all valid stat categories of a specific game by ID. Parameters: game_id ( int ) \u2013 Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_game_stat_categories_by_game_id ( 331 ) StatCategories({ \"stats\": [ { \"stat\": { \"display_name\": \"GP\", \"name\": \"Games Played\", \"sort_order\": \"1\", \"stat_id\": 0 } }, ..., { \"stat\": { \"display_name\": \"Rush 1st Downs\", \"name\": \"Rushing 1st Downs\", \"sort_order\": \"1\", \"stat_id\": 81 } } ] }) Returns: StatCategories ( StatCategories ) \u2013 YFPY StatCategories instance. Source code in yfpy/query.py 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 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 def get_game_stat_categories_by_game_id ( self , game_id : int ) -> StatCategories : \"\"\"Retrieve all valid stat categories of a specific game by ID. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_stat_categories_by_game_id(331) StatCategories({ \"stats\": [ { \"stat\": { \"display_name\": \"GP\", \"name\": \"Games Played\", \"sort_order\": \"1\", \"stat_id\": 0 } }, ..., { \"stat\": { \"display_name\": \"Rush 1st Downs\", \"name\": \"Rushing 1st Downs\", \"sort_order\": \"1\", \"stat_id\": 81 } } ] }) Returns: StatCategories: YFPY StatCategories instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } /stat_categories\" , [ \"game\" , \"stat_categories\" ], StatCategories ) get_game_position_types_by_game_id \u00b6 get_game_position_types_by_game_id ( game_id ) Retrieve all valid position types for specific game by ID sorted alphabetically by type. Parameters: game_id ( int ) \u2013 Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_game_position_types_by_game_id ( 331 ) [ PositionType({ \"type\": \"O\", \"display_name\": \"Offense\" }), ..., PositionType({ \"type\": \"K\", \"display_name\": \"Kickers\" }) ] Returns: List [ PositionType ] \u2013 list[PositionType]: List of YFPY PositionType instances. Source code in yfpy/query.py 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 def get_game_position_types_by_game_id ( self , game_id : int ) -> List [ PositionType ]: \"\"\"Retrieve all valid position types for specific game by ID sorted alphabetically by type. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_position_types_by_game_id(331) [ PositionType({ \"type\": \"O\", \"display_name\": \"Offense\" }), ..., PositionType({ \"type\": \"K\", \"display_name\": \"Kickers\" }) ] Returns: list[PositionType]: List of YFPY PositionType instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } /position_types\" , [ \"game\" , \"position_types\" ], sort_function = lambda x : x . get ( \"position_type\" ) . type ) get_game_roster_positions_by_game_id \u00b6 get_game_roster_positions_by_game_id ( game_id ) Retrieve all valid roster positions for specific game by ID sorted alphabetically by position. Parameters: game_id ( int ) \u2013 Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_game_roster_positions_by_game_id ( 331 ) [ {RosterPosition({ \"position\": \"BN\" }), ..., RosterPosition({ \"position\": \"WR\", \"position_type\": \"O\" }) ] Returns: List [ RosterPosition ] \u2013 list[RosterPosition]: List of YFPY RosterPosition instances. Source code in yfpy/query.py 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 def get_game_roster_positions_by_game_id ( self , game_id : int ) -> List [ RosterPosition ]: \"\"\"Retrieve all valid roster positions for specific game by ID sorted alphabetically by position. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_roster_positions_by_game_id(331) [ {RosterPosition({ \"position\": \"BN\" }), ..., RosterPosition({ \"position\": \"WR\", \"position_type\": \"O\" }) ] Returns: list[RosterPosition]: List of YFPY RosterPosition instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } /roster_positions\" , [ \"game\" , \"roster_positions\" ], sort_function = lambda x : x . get ( \"roster_position\" ) . position ) get_league_key \u00b6 get_league_key ( season = None ) Retrieve league key for selected league. Parameters: season ( int , default: None ) \u2013 User defined season/year for which to retrieve the Yahoo Fantasy Sports league key. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_league_key ( 2021 ) 331.l.729259 Returns: str ( str ) \u2013 League key string for selected league. Source code in yfpy/query.py 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 def get_league_key ( self , season : int = None ) -> str : \"\"\"Retrieve league key for selected league. Args: season (int): User defined season/year for which to retrieve the Yahoo Fantasy Sports league key. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_key(2021) 331.l.729259 Returns: str: League key string for selected league. \"\"\" if not self . league_key : if season : return f \" { self . get_game_key_by_season ( season ) } .l. { self . league_id } \" elif self . game_id : return f \" { self . get_game_metadata_by_game_id ( self . game_id ) . game_key } .l. { self . league_id } \" else : logger . warning ( \"No game id or season/year provided, defaulting to current fantasy season.\" ) return f \" { self . get_current_game_metadata () . game_key } .l. { self . league_id } \" else : return self . league_key get_current_user \u00b6 get_current_user () Retrieve metadata for current logged-in user. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_current_user () User({ \"guid\": \"USER_GUID_STRING\" }) Returns: User ( User ) \u2013 YFPY User instance. Source code in yfpy/query.py 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 def get_current_user ( self ) -> User : \"\"\"Retrieve metadata for current logged-in user. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_current_user() User({ \"guid\": \"USER_GUID_STRING\" }) Returns: User: YFPY User instance. \"\"\" return self . query ( \"https://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/\" , [ \"users\" , \"0\" , \"user\" ], User ) get_user_games \u00b6 get_user_games () Retrieve game history for current logged-in user sorted by season/year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_user_games () [ Game({ \"code\": \"nfl\", \"game_id\": \"359\", \"game_key\": \"359\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"2016\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2016\" }) ..., Game({...}) ] Returns: List [ Game ] \u2013 list[Game]: List of YFPY Game instances. Source code in yfpy/query.py 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 def get_user_games ( self ) -> List [ Game ]: \"\"\"Retrieve game history for current logged-in user sorted by season/year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_user_games() [ Game({ \"code\": \"nfl\", \"game_id\": \"359\", \"game_key\": \"359\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"2016\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2016\" }) ..., Game({...}) ] Returns: list[Game]: List of YFPY Game instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/games;codes= { self . game_code } /\" , [ \"users\" , \"0\" , \"user\" , \"games\" ], sort_function = lambda x : x . get ( \"game\" ) . season ) get_user_leagues_by_game_key \u00b6 get_user_leagues_by_game_key ( game_key ) Retrieve league history for current logged-in user for specific game by game IDs/keys sorted by season/year. Parameters: game_key ( int | str ) \u2013 The game_id (int) or game_key (str) for a specific Yahoo Fantasy game. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_user_leagues_by_game_key ( 331 ) [ League({ \"allow_add_to_dl_extra_pos\": 0, \"current_week\": \"16\", \"draft_status\": \"postdraft\", \"edit_key\": \"16\", \"end_date\": \"2018-12-24\", \"end_week\": \"16\", \"game_code\": \"nfl\", \"iris_group_chat_id\": \"\", \"is_cash_league\": \"0\", \"is_finished\": 1, \"is_pro_league\": \"0\", \"league_id\": \"169896\", \"league_key\": \"380.l.169896\", \"league_type\": \"private\", \"league_update_timestamp\": \"1546498723\", \"logo_url\": \"\", \"name\": \"League Name\", \"num_teams\": 12, \"password\": null, \"renew\": \"371_52364\", \"renewed\": \"390_78725\", \"scoring_type\": \"head\", \"season\": \"2018\", \"short_invitation_url\": \"\", \"start_date\": \"2018-09-06\", \"start_week\": \"1\", \"url\": \"\", \"weekly_deadline\": null }), ..., League({...}) ] Returns: List [ League ] \u2013 list[League]: List of YFPY League instances. Source code in yfpy/query.py 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 def get_user_leagues_by_game_key ( self , game_key : Union [ int , str ]) -> List [ League ]: \"\"\"Retrieve league history for current logged-in user for specific game by game IDs/keys sorted by season/year. Args: game_key (int | str): The game_id (int) or game_key (str) for a specific Yahoo Fantasy game. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_user_leagues_by_game_key(331) [ League({ \"allow_add_to_dl_extra_pos\": 0, \"current_week\": \"16\", \"draft_status\": \"postdraft\", \"edit_key\": \"16\", \"end_date\": \"2018-12-24\", \"end_week\": \"16\", \"game_code\": \"nfl\", \"iris_group_chat_id\": \"\", \"is_cash_league\": \"0\", \"is_finished\": 1, \"is_pro_league\": \"0\", \"league_id\": \"169896\", \"league_key\": \"380.l.169896\", \"league_type\": \"private\", \"league_update_timestamp\": \"1546498723\", \"logo_url\": \"\", \"name\": \"League Name\", \"num_teams\": 12, \"password\": null, \"renew\": \"371_52364\", \"renewed\": \"390_78725\", \"scoring_type\": \"head\", \"season\": \"2018\", \"short_invitation_url\": \"\", \"start_date\": \"2018-09-06\", \"start_week\": \"1\", \"url\": \"\", \"weekly_deadline\": null }), ..., League({...}) ] Returns: list[League]: List of YFPY League instances. \"\"\" leagues = self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/games;game_keys= { game_key } /leagues/\" , [ \"users\" , \"0\" , \"user\" , \"games\" , \"0\" , \"game\" , \"leagues\" ], sort_function = lambda x : x . get ( \"league\" ) . season ) return leagues if isinstance ( leagues , list ) else [ leagues . get ( \"league\" )] get_user_teams \u00b6 get_user_teams () Retrieve teams for all leagues for current logged-in user for current game sorted by season/year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_user_teams () [ Game({ \"code\": \"nfl\", \"game_id\": \"359\", \"game_key\": \"359\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"2016\", \"teams\": [ { \"team\": { \"draft_grade\": \"A\", \"draft_position\": 9, \"draft_recap_url\": \"\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": [ { \"manager\": { \"email\": \"\", \"guid\": \"\", \"image_url\": \"\", \"is_comanager\": \"1\", \"manager_id\": \"14\", \"nickname\": \"\" } } ], \"name\": \"Legion\", \"number_of_moves\": \"48\", \"number_of_trades\": \"2\", \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"1\", \"team_key\": \"359.l.5521.t.1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"\" } }, \"url\": \"\", \"waiver_priority\": 11 } } ], \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2016\" }) ..., Game({...}) ] Returns: List [ Game ] \u2013 list[Game]: List of YFPY Game instances with \"teams\" attribute containing list of YFPY Team instances. Source code in yfpy/query.py 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 def get_user_teams ( self ) -> List [ Game ]: \"\"\"Retrieve teams for all leagues for current logged-in user for current game sorted by season/year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_user_teams() [ Game({ \"code\": \"nfl\", \"game_id\": \"359\", \"game_key\": \"359\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"2016\", \"teams\": [ { \"team\": { \"draft_grade\": \"A\", \"draft_position\": 9, \"draft_recap_url\": \"\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": [ { \"manager\": { \"email\": \"\", \"guid\": \"\", \"image_url\": \"\", \"is_comanager\": \"1\", \"manager_id\": \"14\", \"nickname\": \"\" } } ], \"name\": \"Legion\", \"number_of_moves\": \"48\", \"number_of_trades\": \"2\", \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"1\", \"team_key\": \"359.l.5521.t.1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"\" } }, \"url\": \"\", \"waiver_priority\": 11 } } ], \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2016\" }) ..., Game({...}) ] Returns: list[Game]: List of YFPY Game instances with \"teams\" attribute containing list of YFPY Team instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/games;codes= { self . game_code } /teams/\" , [ \"users\" , \"0\" , \"user\" , \"games\" ], sort_function = lambda x : x . get ( \"game\" ) . season ) get_league_info \u00b6 get_league_info () Retrieve info for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_league_info () League({ \"allow_add_to_dl_extra_pos\": 0, \"current_week\": \"16\", \"draft_status\": \"postdraft\", \"edit_key\": \"16\", \"end_date\": \"2014-12-22\", \"end_week\": \"16\", \"game_code\": \"nfl\", \"iris_group_chat_id\": null, \"is_cash_league\": \"0\", \"is_finished\": 1, \"is_pro_league\": \"1\", \"league_id\": \"729259\", \"league_key\": \"331.l.729259\", \"league_type\": \"public\", \"league_update_timestamp\": \"1420099793\", \"logo_url\": \"https://s.yimg.com/cv/api/default/20180206/default-league-logo@2x.png\", \"name\": \"Yahoo Public 729259\", \"num_teams\": 10, \"renew\": null, \"renewed\": null, \"scoreboard\": { \"week\": \"16\", \"matchups\": [ ... ] }, \"scoring_type\": \"head\", \"season\": \"2014\", \"settings\": { ... }, \"standings\": { \"teams\": [ ..., ... ], ... }, \"start_date\": \"2014-09-04\", \"start_week\": \"1\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259\", \"weekly_deadline\": null }) Returns: League ( League ) \u2013 YFPY League instance. Source code in yfpy/query.py 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 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 def get_league_info ( self ) -> League : \"\"\"Retrieve info for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_info() League({ \"allow_add_to_dl_extra_pos\": 0, \"current_week\": \"16\", \"draft_status\": \"postdraft\", \"edit_key\": \"16\", \"end_date\": \"2014-12-22\", \"end_week\": \"16\", \"game_code\": \"nfl\", \"iris_group_chat_id\": null, \"is_cash_league\": \"0\", \"is_finished\": 1, \"is_pro_league\": \"1\", \"league_id\": \"729259\", \"league_key\": \"331.l.729259\", \"league_type\": \"public\", \"league_update_timestamp\": \"1420099793\", \"logo_url\": \"https://s.yimg.com/cv/api/default/20180206/default-league-logo@2x.png\", \"name\": \"Yahoo Public 729259\", \"num_teams\": 10, \"renew\": null, \"renewed\": null, \"scoreboard\": { \"week\": \"16\", \"matchups\": [ ... ] }, \"scoring_type\": \"head\", \"season\": \"2014\", \"settings\": { ... }, \"standings\": { \"teams\": [ ..., ... ], ... }, \"start_date\": \"2014-09-04\", \"start_week\": \"1\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259\", \"weekly_deadline\": null }) Returns: League: YFPY League instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } ;\" f \"out=metadata,settings,standings,scoreboard,teams,players,draftresults,transactions\" , [ \"league\" ], League ) get_league_metadata \u00b6 get_league_metadata () Retrieve metadata for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_league_metadata () League({ \"allow_add_to_dl_extra_pos\": 0, \"current_week\": \"16\", \"draft_status\": \"postdraft\", \"edit_key\": \"16\", \"end_date\": \"2014-12-22\", \"end_week\": \"16\", \"game_code\": \"nfl\", \"iris_group_chat_id\": null, \"is_cash_league\": \"0\", \"is_finished\": 1, \"is_pro_league\": \"1\", \"league_id\": \"729259\", \"league_key\": \"331.l.729259\", \"league_type\": \"public\", \"league_update_timestamp\": \"1420099793\", \"logo_url\": \"https://s.yimg.com/cv/api/default/20180206/default-league-logo@2x.png\", \"name\": \"Yahoo Public 729259\", \"num_teams\": 10, \"renew\": null, \"renewed\": null, \"scoring_type\": \"head\", \"season\": \"2014\", \"start_date\": \"2014-09-04\", \"start_week\": \"1\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259\", \"weekly_deadline\": null }) Returns: League ( League ) \u2013 YFPY League instance. Source code in yfpy/query.py 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 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 def get_league_metadata ( self ) -> League : \"\"\"Retrieve metadata for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_metadata() League({ \"allow_add_to_dl_extra_pos\": 0, \"current_week\": \"16\", \"draft_status\": \"postdraft\", \"edit_key\": \"16\", \"end_date\": \"2014-12-22\", \"end_week\": \"16\", \"game_code\": \"nfl\", \"iris_group_chat_id\": null, \"is_cash_league\": \"0\", \"is_finished\": 1, \"is_pro_league\": \"1\", \"league_id\": \"729259\", \"league_key\": \"331.l.729259\", \"league_type\": \"public\", \"league_update_timestamp\": \"1420099793\", \"logo_url\": \"https://s.yimg.com/cv/api/default/20180206/default-league-logo@2x.png\", \"name\": \"Yahoo Public 729259\", \"num_teams\": 10, \"renew\": null, \"renewed\": null, \"scoring_type\": \"head\", \"season\": \"2014\", \"start_date\": \"2014-09-04\", \"start_week\": \"1\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259\", \"weekly_deadline\": null }) Returns: League: YFPY League instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /metadata\" , [ \"league\" ], League ) get_league_settings \u00b6 get_league_settings () Retrieve settings (rules) for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_league_settings () Settings({ \"cant_cut_list\": \"yahoo\", \"draft_time\": \"1408410000\", \"draft_type\": \"live\", \"has_multiweek_championship\": 0, \"has_playoff_consolation_games\": true, \"is_auction_draft\": \"0\", \"max_teams\": \"10\", \"num_playoff_consolation_teams\": 4, \"num_playoff_teams\": \"4\", \"pickem_enabled\": \"1\", \"player_pool\": \"ALL\", \"playoff_start_week\": \"15\", \"post_draft_players\": \"W\", \"roster_positions\": [ { \"roster_position\": { \"count\": 1, \"position\": \"QB\", \"position_type\": \"O\" } }, ... ], \"scoring_type\": \"head\", \"stat_categories\": { \"stats\": [ { \"stat\": { \"display_name\": \"Pass Yds\", \"enabled\": \"1\", \"name\": \"Passing Yards\", \"position_type\": \"O\", \"sort_order\": \"1\", \"stat_id\": 4, \"stat_position_types\": { \"stat_position_type\": { \"position_type\": \"O\" } } } }, ... ] }, \"stat_modifiers\": { \"stats\": [ { \"stat\": { \"stat_id\": 4, \"value\": \"0.04\" } }, ... ] }, \"trade_end_date\": \"2014-11-14\", \"trade_ratify_type\": \"yahoo\", \"trade_reject_time\": \"2\", \"uses_faab\": \"0\", \"uses_fractional_points\": \"1\", \"uses_lock_eliminated_teams\": 1, \"uses_negative_points\": \"1\", \"uses_playoff\": \"1\", \"uses_playoff_reseeding\": 0, \"waiver_rule\": \"gametime\", \"waiver_time\": \"2\", \"waiver_type\": \"R\" }) Returns: Settings ( Settings ) \u2013 YFPY Settings instance. Source code in yfpy/query.py 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 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 def get_league_settings ( self ) -> Settings : \"\"\"Retrieve settings (rules) for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_settings() Settings({ \"cant_cut_list\": \"yahoo\", \"draft_time\": \"1408410000\", \"draft_type\": \"live\", \"has_multiweek_championship\": 0, \"has_playoff_consolation_games\": true, \"is_auction_draft\": \"0\", \"max_teams\": \"10\", \"num_playoff_consolation_teams\": 4, \"num_playoff_teams\": \"4\", \"pickem_enabled\": \"1\", \"player_pool\": \"ALL\", \"playoff_start_week\": \"15\", \"post_draft_players\": \"W\", \"roster_positions\": [ { \"roster_position\": { \"count\": 1, \"position\": \"QB\", \"position_type\": \"O\" } }, ... ], \"scoring_type\": \"head\", \"stat_categories\": { \"stats\": [ { \"stat\": { \"display_name\": \"Pass Yds\", \"enabled\": \"1\", \"name\": \"Passing Yards\", \"position_type\": \"O\", \"sort_order\": \"1\", \"stat_id\": 4, \"stat_position_types\": { \"stat_position_type\": { \"position_type\": \"O\" } } } }, ... ] }, \"stat_modifiers\": { \"stats\": [ { \"stat\": { \"stat_id\": 4, \"value\": \"0.04\" } }, ... ] }, \"trade_end_date\": \"2014-11-14\", \"trade_ratify_type\": \"yahoo\", \"trade_reject_time\": \"2\", \"uses_faab\": \"0\", \"uses_fractional_points\": \"1\", \"uses_lock_eliminated_teams\": 1, \"uses_negative_points\": \"1\", \"uses_playoff\": \"1\", \"uses_playoff_reseeding\": 0, \"waiver_rule\": \"gametime\", \"waiver_time\": \"2\", \"waiver_type\": \"R\" }) Returns: Settings: YFPY Settings instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /settings\" , [ \"league\" , \"settings\" ], Settings ) get_league_standings \u00b6 get_league_standings () Retrieve standings for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_league_standings () Standings({ \"teams\": [ { \"team\": { \"clinched_playoffs\": 1, \"draft_grade\": \"C+\", \"draft_position\": 7, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/8/draftrecap\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"PMTCFWSK5U5LI4SKWREUR56B5A\", \"manager_id\": \"8\", \"nickname\": \"--hidden--\" } }, \"name\": \"clam dam\", \"number_of_moves\": \"27\", \"number_of_trades\": 0, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"8\", \"team_key\": \"331.l.729259.t.8\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://s.yimg.com/cv/apiv2/default/nfl/nfl_1.png\" } }, \"team_points\": { \"coverage_type\": \"season\", \"season\": \"2014\", \"total\": \"1507.06\" }, \"team_standings\": { \"outcome_totals\": { \"losses\": 2, \"percentage\": 0.857, \"ties\": 0, \"wins\": 12 }, \"playoff_seed\": \"1\", \"points_against\": 1263.78, \"points_for\": 1507.06, \"rank\": 1, \"streak\": { \"type\": \"win\", \"value\": \"2\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/8\", \"waiver_priority\": 10 } }, ... ] }) Returns: Standings ( Standings ) \u2013 YFPY Standings instance. Source code in yfpy/query.py 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 1493 1494 1495 1496 1497 1498 1499 1500 def get_league_standings ( self ) -> Standings : \"\"\"Retrieve standings for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_standings() Standings({ \"teams\": [ { \"team\": { \"clinched_playoffs\": 1, \"draft_grade\": \"C+\", \"draft_position\": 7, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/8/draftrecap\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"PMTCFWSK5U5LI4SKWREUR56B5A\", \"manager_id\": \"8\", \"nickname\": \"--hidden--\" } }, \"name\": \"clam dam\", \"number_of_moves\": \"27\", \"number_of_trades\": 0, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"8\", \"team_key\": \"331.l.729259.t.8\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://s.yimg.com/cv/apiv2/default/nfl/nfl_1.png\" } }, \"team_points\": { \"coverage_type\": \"season\", \"season\": \"2014\", \"total\": \"1507.06\" }, \"team_standings\": { \"outcome_totals\": { \"losses\": 2, \"percentage\": 0.857, \"ties\": 0, \"wins\": 12 }, \"playoff_seed\": \"1\", \"points_against\": 1263.78, \"points_for\": 1507.06, \"rank\": 1, \"streak\": { \"type\": \"win\", \"value\": \"2\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/8\", \"waiver_priority\": 10 } }, ... ] }) Returns: Standings: YFPY Standings instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /standings\" , [ \"league\" , \"standings\" ], Standings ) get_league_teams \u00b6 get_league_teams () Retrieve teams for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_league_teams () [ Team({ \"clinched_playoffs\": 1, \"draft_grade\": \"B\", \"draft_position\": 4, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1/draftrecap\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"BMACD7S5UXV7JIQX4PGGUVQJAU\", \"manager_id\": \"1\", \"nickname\": \"--hidden--\" } }, \"name\": \"Hellacious Hill 12\", \"number_of_moves\": \"71\", \"number_of_trades\": 0, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"1\", \"team_key\": \"331.l.729259.t.1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1441/24935131299_a8242dab70_192sq.jpg?ct=fantasy\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1\", \"waiver_priority\": 9 }), ..., Team({...}) ] Returns: List [ Team ] \u2013 list[Team]: List of YFPY Team instances. Source code in yfpy/query.py 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 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 1551 1552 1553 1554 1555 1556 def get_league_teams ( self ) -> List [ Team ]: \"\"\"Retrieve teams for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_teams() [ Team({ \"clinched_playoffs\": 1, \"draft_grade\": \"B\", \"draft_position\": 4, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1/draftrecap\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"BMACD7S5UXV7JIQX4PGGUVQJAU\", \"manager_id\": \"1\", \"nickname\": \"--hidden--\" } }, \"name\": \"Hellacious Hill 12\", \"number_of_moves\": \"71\", \"number_of_trades\": 0, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"1\", \"team_key\": \"331.l.729259.t.1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1441/24935131299_a8242dab70_192sq.jpg?ct=fantasy\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1\", \"waiver_priority\": 9 }), ..., Team({...}) ] Returns: list[Team]: List of YFPY Team instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /teams\" , [ \"league\" , \"teams\" ] ) get_league_players \u00b6 get_league_players ( player_count_limit = None , player_count_start = 0 , is_retry = False , ) Retrieve valid players for chosen league. Parameters: player_count_limit ( int , default: None ) \u2013 Maximum number of players to retreive. player_count_start ( int , default: 0 ) \u2013 Index from which to retrieve all subsequent players. is_retry ( bool , default: False ) \u2013 Boolean to indicate whether the method is being retried during error handling. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_league_players ( 50 , 25 ) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"K\", \"editorial_player_key\": \"nfl.p.3727\", \"editorial_team_abbr\": \"Ind\", \"editorial_team_full_name\": \"Indianapolis Colts\", \"editorial_team_key\": \"nfl.t.11\", \"eligible_positions\": { \"position\": \"K\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/OpHvpCHjl_PQvkeQUgsjsA--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt 3PTQ2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08152019/3727.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Adam\", \"ascii_last\": \"Vinatieri\", \"first\": \"Adam\", \"full\": \"Adam Vinatieri\", \"last\": \"Vinatieri\" }, \"player_id\": \"3727\", \"player_key\": \"331.p.3727\", \"player_notes_last_timestamp\": 1568758320, \"position_type\": \"K\", \"primary_position\": \"K\", \"uniform_number\": \"4\" }), ..., Player({...}) ] Returns: List [ Player ] \u2013 list[Player]: List of YFPY Player instances. Source code in yfpy/query.py 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 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 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 def get_league_players ( self , player_count_limit : int = None , player_count_start : int = 0 , is_retry : bool = False ) -> List [ Player ]: \"\"\"Retrieve valid players for chosen league. Args: player_count_limit (int): Maximum number of players to retreive. player_count_start (int): Index from which to retrieve all subsequent players. is_retry (bool): Boolean to indicate whether the method is being retried during error handling. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_players(50, 25) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"K\", \"editorial_player_key\": \"nfl.p.3727\", \"editorial_team_abbr\": \"Ind\", \"editorial_team_full_name\": \"Indianapolis Colts\", \"editorial_team_key\": \"nfl.t.11\", \"eligible_positions\": { \"position\": \"K\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/OpHvpCHjl_PQvkeQUgsjsA--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt 3PTQ2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08152019/3727.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Adam\", \"ascii_last\": \"Vinatieri\", \"first\": \"Adam\", \"full\": \"Adam Vinatieri\", \"last\": \"Vinatieri\" }, \"player_id\": \"3727\", \"player_key\": \"331.p.3727\", \"player_notes_last_timestamp\": 1568758320, \"position_type\": \"K\", \"primary_position\": \"K\", \"uniform_number\": \"4\" }), ..., Player({...}) ] Returns: list[Player]: List of YFPY Player instances. \"\"\" league_player_count = player_count_start all_players_retrieved = False league_player_data = [] league_player_retrieval_limit = 25 while not all_players_retrieved : try : league_player_query_data = self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"start= { league_player_count } ;count= { league_player_retrieval_limit if not is_retry else 1 } \" , [ \"league\" , \"players\" ] ) league_players = ( league_player_query_data if isinstance ( league_player_query_data , list ) else [ league_player_query_data ]) league_player_count_from_query = len ( league_players ) if player_count_limit : if ( league_player_count + league_player_count_from_query ) < player_count_limit : league_player_count += league_player_count_from_query league_player_data . extend ( league_players ) else : for ndx in range ( player_count_limit - league_player_count ): league_player_data . append ( league_players [ ndx ]) league_player_count += ( player_count_limit - league_player_count ) all_players_retrieved = True else : league_player_count += league_player_count_from_query league_player_data . extend ( league_players ) except YahooFantasySportsDataNotFound as yfpy_err : if not is_retry : payload = yfpy_err . payload if payload : logger . debug ( \"No more league player data available.\" ) all_players_retrieved = True else : logger . warning ( f \"Error retrieving player batch: \" f \" { league_player_count } - { league_player_count + league_player_retrieval_limit - 1 } . \" f \"Attempting to retrieve individual players from batch.\" ) player_retrieval_successes = [] player_retrieval_failures = [] for i in range ( 25 ): try : player_data = self . get_league_players ( player_count_limit = league_player_count + 1 , player_count_start = league_player_count , is_retry = True ) player_retrieval_successes . extend ( player_data ) except YahooFantasySportsDataNotFound as nested_yfpy_err : player_retrieval_failures . append ( { \"failed_player_retrieval_index\" : league_player_count , \"failed_player_retrieval_url\" : nested_yfpy_err . url , \"failed_player_retrieval_message\" : nested_yfpy_err . message } ) league_player_count += 1 league_player_data . extend ( player_retrieval_successes ) logger . warning ( f \"Players retrieval failures: \\n { prettify_data ( player_retrieval_failures ) } \" ) else : raise yfpy_err logger . debug ( f \"League player count: { league_player_count } \" ) return league_player_data get_league_draft_results \u00b6 get_league_draft_results () Retrieve draft results for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_league_draft_results () [ DraftResult({ \"pick\": 1, \"round\": 1, \"team_key\": \"331.l.729259.t.4\", \"player_key\": \"331.p.9317\" }), ..., DraftResult({...}) ] Returns: List [ DraftResult ] \u2013 list[DraftResult]: List of YFPY DraftResult instances. Source code in yfpy/query.py 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 def get_league_draft_results ( self ) -> List [ DraftResult ]: \"\"\"Retrieve draft results for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_draft_results() [ DraftResult({ \"pick\": 1, \"round\": 1, \"team_key\": \"331.l.729259.t.4\", \"player_key\": \"331.p.9317\" }), ..., DraftResult({...}) ] Returns: list[DraftResult]: List of YFPY DraftResult instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /draftresults\" , [ \"league\" , \"draft_results\" ] ) get_league_transactions \u00b6 get_league_transactions () Retrieve transactions for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_league_transactions () [ Transaction({ \"players\": [ { \"player\": { \"display_position\": \"RB\", \"editorial_team_abbr\": \"NO\", \"name\": { \"ascii_first\": \"Kerwynn\", \"ascii_last\": \"Williams\", \"first\": \"Kerwynn\", \"full\": \"Kerwynn Williams\", \"last\": \"Williams\" }, \"player_id\": \"26853\", \"player_key\": \"331.p.26853\", \"position_type\": \"O\", \"transaction_data\": { \"destination_team_key\": \"331.l.729259.t.1\", \"destination_team_name\": \"Hellacious Hill 12\", \"destination_type\": \"team\", \"source_type\": \"freeagents\", \"type\": \"add\" } } } ], \"status\": \"successful\", \"timestamp\": \"1419188151\", \"transaction_id\": \"282\", \"transaction_key\": \"331.l.729259.tr.282\", \"type\": \"add/drop\" }), ..., Transaction({...}) ] Returns: List [ Transaction ] \u2013 list[Transaction]: List of YFPY Transaction instances. Source code in yfpy/query.py 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 def get_league_transactions ( self ) -> List [ Transaction ]: \"\"\"Retrieve transactions for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_transactions() [ Transaction({ \"players\": [ { \"player\": { \"display_position\": \"RB\", \"editorial_team_abbr\": \"NO\", \"name\": { \"ascii_first\": \"Kerwynn\", \"ascii_last\": \"Williams\", \"first\": \"Kerwynn\", \"full\": \"Kerwynn Williams\", \"last\": \"Williams\" }, \"player_id\": \"26853\", \"player_key\": \"331.p.26853\", \"position_type\": \"O\", \"transaction_data\": { \"destination_team_key\": \"331.l.729259.t.1\", \"destination_team_name\": \"Hellacious Hill 12\", \"destination_type\": \"team\", \"source_type\": \"freeagents\", \"type\": \"add\" } } } ], \"status\": \"successful\", \"timestamp\": \"1419188151\", \"transaction_id\": \"282\", \"transaction_key\": \"331.l.729259.tr.282\", \"type\": \"add/drop\" }), ..., Transaction({...}) ] Returns: list[Transaction]: List of YFPY Transaction instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /transactions\" , [ \"league\" , \"transactions\" ] ) get_league_scoreboard_by_week \u00b6 get_league_scoreboard_by_week ( chosen_week ) Retrieve scoreboard for chosen league by week. Parameters: chosen_week ( int ) \u2013 Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_league_scoreboard_by_week ( 1 ) Scoreboard({ \"week\": \"1\", \"matchups\": [ { \"matchup\": { \"is_consolation\": \"0\", \"is_matchup_recap_available\": 1, \"is_playoffs\": \"0\", \"is_tied\": 0, \"matchup_grades\": [ { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.1\" } }, { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.2\" } } ], \"matchup_recap_title\": \"Wax On Wax Off Gets Victory Against Hellacious Hill 12\", \"matchup_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/recap? week=1&mid1=1&mid2=2\", \"status\": \"postevent\", \"teams\": [ { \"team\": { } }, { \"team\": { } } ], \"week\": \"1\", \"week_end\": \"2014-09-08\", \"week_start\": \"2014-09-04\", \"winner_team_key\": \"331.l.729259.t.2\" } }, ... ] }) Returns: Scoreboard ( Scoreboard ) \u2013 YFPY Scoreboard instance. Source code in yfpy/query.py 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 def get_league_scoreboard_by_week ( self , chosen_week : int ) -> Scoreboard : \"\"\"Retrieve scoreboard for chosen league by week. Args: chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_scoreboard_by_week(1) Scoreboard({ \"week\": \"1\", \"matchups\": [ { \"matchup\": { \"is_consolation\": \"0\", \"is_matchup_recap_available\": 1, \"is_playoffs\": \"0\", \"is_tied\": 0, \"matchup_grades\": [ { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.1\" } }, { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.2\" } } ], \"matchup_recap_title\": \"Wax On Wax Off Gets Victory Against Hellacious Hill 12\", \"matchup_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/recap? week=1&mid1=1&mid2=2\", \"status\": \"postevent\", \"teams\": [ { \"team\": { } }, { \"team\": { } } ], \"week\": \"1\", \"week_end\": \"2014-09-08\", \"week_start\": \"2014-09-04\", \"winner_team_key\": \"331.l.729259.t.2\" } }, ... ] }) Returns: Scoreboard: YFPY Scoreboard instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /scoreboard;\" f \"week= { chosen_week } \" , [ \"league\" , \"scoreboard\" ], Scoreboard ) get_league_matchups_by_week \u00b6 get_league_matchups_by_week ( chosen_week ) Retrieve matchups for chosen league by week. Parameters: chosen_week ( int ) \u2013 Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_league_matchups_by_week ( 1 ) [ Matchup({ \"is_consolation\": \"0\", \"is_matchup_recap_available\": 1, \"is_playoffs\": \"0\", \"is_tied\": 0, \"matchup_grades\": [ { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.1\" } }, { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.2\" } } ], \"matchup_recap_title\": \"Wax On Wax Off Gets Victory Against Hellacious Hill 12\", \"matchup_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/recap? week=1&mid1=1&mid2=2\", \"status\": \"postevent\", \"teams\": [ { \"team\": { } }, { \"team\": { } } ], \"week\": \"1\", \"week_end\": \"2014-09-08\", \"week_start\": \"2014-09-04\", \"winner_team_key\": \"331.l.729259.t.2\" }), ..., Matchup({...}) ] Returns: List [ Matchup ] \u2013 list[Matchup]: List of YFPY Matchup instances. Source code in yfpy/query.py 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 def get_league_matchups_by_week ( self , chosen_week : int ) -> List [ Matchup ]: \"\"\"Retrieve matchups for chosen league by week. Args: chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_matchups_by_week(1) [ Matchup({ \"is_consolation\": \"0\", \"is_matchup_recap_available\": 1, \"is_playoffs\": \"0\", \"is_tied\": 0, \"matchup_grades\": [ { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.1\" } }, { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.2\" } } ], \"matchup_recap_title\": \"Wax On Wax Off Gets Victory Against Hellacious Hill 12\", \"matchup_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/recap? week=1&mid1=1&mid2=2\", \"status\": \"postevent\", \"teams\": [ { \"team\": { } }, { \"team\": { } } ], \"week\": \"1\", \"week_end\": \"2014-09-08\", \"week_start\": \"2014-09-04\", \"winner_team_key\": \"331.l.729259.t.2\" }), ..., Matchup({...}) ] Returns: list[Matchup]: List of YFPY Matchup instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /scoreboard;\" f \"week= { chosen_week } \" , [ \"league\" , \"scoreboard\" , \"0\" , \"matchups\" ] ) get_team_info \u00b6 get_team_info ( team_id ) Retrieve info of specific team by team_id for chosen league. Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_team_info ( 1 ) Team({ \"clinched_playoffs\": 1, \"draft_grade\": \"B\", \"draft_position\": 4, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1/draftrecap\", \"draft_results\": [ ... ], \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"BMACD7S5UXV7JIQX4PGGUVQJAU\", \"manager_id\": \"1\", \"nickname\": \"--hidden--\" } }, \"matchups\": [ ... ], \"name\": \"Hellacious Hill 12\", \"number_of_moves\": \"71\", \"number_of_trades\": 0, \"roster\": { ... }, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"1\", \"team_key\": \"331.l.729259.t.1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1441/24935131299_a8242dab70_192sq.jpg?ct=fantasy\" } }, \"team_points\": { \"coverage_type\": \"season\", \"season\": \"2014\", \"total\": \"1409.24\" }, \"team_standings\": { \"outcome_totals\": { \"losses\": 5, \"percentage\": 0.643, \"ties\": 0, \"wins\": 9 }, \"playoff_seed\": \"2\", \"points_against\": 1266.6599999999999, \"points_for\": 1409.24, \"rank\": 2, \"streak\": { \"type\": \"win\", \"value\": \"1\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1\", \"waiver_priority\": 9 }) Returns: Team ( Team ) \u2013 YFPY Team instance. Source code in yfpy/query.py 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 def get_team_info ( self , team_id : Union [ str , int ]) -> Team : \"\"\"Retrieve info of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_info(1) Team({ \"clinched_playoffs\": 1, \"draft_grade\": \"B\", \"draft_position\": 4, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1/draftrecap\", \"draft_results\": [ ... ], \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"BMACD7S5UXV7JIQX4PGGUVQJAU\", \"manager_id\": \"1\", \"nickname\": \"--hidden--\" } }, \"matchups\": [ ... ], \"name\": \"Hellacious Hill 12\", \"number_of_moves\": \"71\", \"number_of_trades\": 0, \"roster\": { ... }, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"1\", \"team_key\": \"331.l.729259.t.1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1441/24935131299_a8242dab70_192sq.jpg?ct=fantasy\" } }, \"team_points\": { \"coverage_type\": \"season\", \"season\": \"2014\", \"total\": \"1409.24\" }, \"team_standings\": { \"outcome_totals\": { \"losses\": 5, \"percentage\": 0.643, \"ties\": 0, \"wins\": 9 }, \"playoff_seed\": \"2\", \"points_against\": 1266.6599999999999, \"points_for\": 1409.24, \"rank\": 2, \"streak\": { \"type\": \"win\", \"value\": \"1\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1\", \"waiver_priority\": 9 }) Returns: Team: YFPY Team instance. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } ;\" f \"out=metadata,stats,standings,roster,draftresults,matchups\" , [ \"team\" ], Team ) get_team_metadata \u00b6 get_team_metadata ( team_id ) Retrieve metadata of specific team by team_id for chosen league. Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_team_metadata ( 1 ) Team({ \"team_key\": \"331.l.729259.t.1\", \"team_id\": \"1\", \"name\": \"Hellacious Hill 12\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1441/24935131299_a8242dab70_192sq.jpg?ct=fantasy\" } }, \"waiver_priority\": 9, \"number_of_moves\": \"71\", \"number_of_trades\": 0, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"clinched_playoffs\": 1, \"league_scoring_type\": \"head\", \"draft_position\": 4, \"has_draft_grade\": 1, \"draft_grade\": \"B\", \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1/draftrecap\", \"managers\": { \"manager\": { \"guid\": \"BMACD7S5UXV7JIQX4PGGUVQJAU\", \"manager_id\": \"1\", \"nickname\": \"--hidden--\" } } }) Returns: Team ( Team ) \u2013 YFPY Team instance. Source code in yfpy/query.py 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 def get_team_metadata ( self , team_id : Union [ str , int ]) -> Team : \"\"\"Retrieve metadata of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_metadata(1) Team({ \"team_key\": \"331.l.729259.t.1\", \"team_id\": \"1\", \"name\": \"Hellacious Hill 12\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1441/24935131299_a8242dab70_192sq.jpg?ct=fantasy\" } }, \"waiver_priority\": 9, \"number_of_moves\": \"71\", \"number_of_trades\": 0, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"clinched_playoffs\": 1, \"league_scoring_type\": \"head\", \"draft_position\": 4, \"has_draft_grade\": 1, \"draft_grade\": \"B\", \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1/draftrecap\", \"managers\": { \"manager\": { \"guid\": \"BMACD7S5UXV7JIQX4PGGUVQJAU\", \"manager_id\": \"1\", \"nickname\": \"--hidden--\" } } }) Returns: Team: YFPY Team instance. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /metadata\" , [ \"team\" ], Team ) get_team_stats \u00b6 get_team_stats ( team_id ) Retrieve stats of specific team by team_id for chosen league. Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_team_stats ( 1 ) TeamPoints({ \"coverage_type\": \"season\", \"season\": \"2014\", \"total\": \"1409.24\" }) Returns: TeamPoints ( TeamPoints ) \u2013 YFPY TeamPoints instance. Source code in yfpy/query.py 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 def get_team_stats ( self , team_id : Union [ str , int ]) -> TeamPoints : \"\"\"Retrieve stats of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_stats(1) TeamPoints({ \"coverage_type\": \"season\", \"season\": \"2014\", \"total\": \"1409.24\" }) Returns: TeamPoints: YFPY TeamPoints instance. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /stats\" , [ \"team\" , \"team_points\" ], TeamPoints ) get_team_stats_by_week \u00b6 get_team_stats_by_week ( team_id , chosen_week = 'current' ) Retrieve stats of specific team by team_id and by week for chosen league. Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week ( int , default: 'current' ) \u2013 Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_team_stats_by_week ( 1 , 1 ) { \"team_points\": TeamPoints({ \"coverage_type\": \"week\", \"total\": \"95.06\", \"week\": \"1\" }), \"team_projected_points\": TeamProjectedPoints({ \"coverage_type\": \"week\", \"total\": \"78.85\", \"week\": \"1\" }) } Returns: Dict [ str , Union [ TeamPoints , TeamProjectedPoints ]] \u2013 dict[str, TeamPoints | TeamProjectedPoints]: Dictionary containing keys \"team_points\" and \"team_projected_points\" with respective values YFPY TeamPoints and YFPY TeamProjectedPoints instances. Source code in yfpy/query.py 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 def get_team_stats_by_week ( self , team_id : Union [ str , int ], chosen_week : Union [ int , str ] = \"current\" ) -> Dict [ str , Union [ TeamPoints , TeamProjectedPoints ]]: \"\"\"Retrieve stats of specific team by team_id and by week for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_stats_by_week(1, 1) { \"team_points\": TeamPoints({ \"coverage_type\": \"week\", \"total\": \"95.06\", \"week\": \"1\" }), \"team_projected_points\": TeamProjectedPoints({ \"coverage_type\": \"week\", \"total\": \"78.85\", \"week\": \"1\" }) } Returns: dict[str, TeamPoints | TeamProjectedPoints]: Dictionary containing keys \"team_points\" and \"team_projected_points\" with respective values YFPY TeamPoints and YFPY TeamProjectedPoints instances. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /stats;type=week;week= { chosen_week } \" , [ \"team\" , [ \"team_points\" , \"team_projected_points\" ]] ) get_team_standings \u00b6 get_team_standings ( team_id ) Retrieve standings of specific team by team_id for chosen league. Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_team_standings ( 1 ) TeamStandings({ \"rank\": 2, \"playoff_seed\": \"2\", \"outcome_totals\": { \"losses\": 5, \"percentage\": 0.643, \"ties\": 0, \"wins\": 9 }, \"streak\": { \"type\": \"win\", \"value\": \"1\" }, \"points_for\": \"1409.24\", \"points_against\": 1266.6599999999999 }) Returns: TeamStandings ( TeamStandings ) \u2013 YFPY TeamStandings instance. Source code in yfpy/query.py 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 def get_team_standings ( self , team_id : Union [ str , int ]) -> TeamStandings : \"\"\"Retrieve standings of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_standings(1) TeamStandings({ \"rank\": 2, \"playoff_seed\": \"2\", \"outcome_totals\": { \"losses\": 5, \"percentage\": 0.643, \"ties\": 0, \"wins\": 9 }, \"streak\": { \"type\": \"win\", \"value\": \"1\" }, \"points_for\": \"1409.24\", \"points_against\": 1266.6599999999999 }) Returns: TeamStandings: YFPY TeamStandings instance. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /standings\" , [ \"team\" , \"team_standings\" ], TeamStandings ) get_team_roster_by_week \u00b6 get_team_roster_by_week ( team_id , chosen_week = 'current' ) Retrieve roster of specific team by team_id and by week for chosen league. Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week ( int , default: 'current' ) \u2013 Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_team_roster_by_week ( 1 , 1 ) Roster({ \"coverage_type\": \"week\", \"week\": \"1\", \"is_editable\": 0, \"players\": [ { \"player\": { \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt 3PTQ2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"1\" }, \"uniform_number\": \"12\" } }, ... ] }) Returns: Roster ( Roster ) \u2013 YFPY Roster instance. Source code in yfpy/query.py 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 def get_team_roster_by_week ( self , team_id : Union [ str , int ], chosen_week : Union [ int , str ] = \"current\" ) -> Roster : \"\"\"Retrieve roster of specific team by team_id and by week for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_roster_by_week(1, 1) Roster({ \"coverage_type\": \"week\", \"week\": \"1\", \"is_editable\": 0, \"players\": [ { \"player\": { \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt 3PTQ2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"1\" }, \"uniform_number\": \"12\" } }, ... ] }) Returns: Roster: YFPY Roster instance. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /roster;week= { chosen_week } \" , [ \"team\" , \"roster\" ], Roster ) get_team_roster_player_info_by_week \u00b6 get_team_roster_player_info_by_week ( team_id , chosen_week = \"current\" ) Retrieve roster with ALL player info of specific team by team_id and by week for chosen league. Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week ( int , default: 'current' ) \u2013 Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_team_roster_player_info_by_week ( 1 , 1 ) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"draft_analysis\": { \"average_pick\": \"65.9\", \"average_round\": \"7.6\", \"average_cost\": \"5.0\", \"percent_drafted\": \"1.00\" }, \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/ https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"ownership\": { \"ownership_type\": \"team\", \"owner_team_key\": \"331.l.729259.t.1\", \"owner_team_name\": \"Hellacious Hill 12\" }, \"percent_owned\": { \"coverage_type\": \"week\", \"week\": \"17\", \"value\": 99, \"delta\": \"0\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"player_points\": { \"coverage_type\": \"week\", \"week\": \"1\", \"total\": 10.26 }, \"player_stats\": { \"coverage_type\": \"week\", \"week\": \"1\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"249\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"1\" }, \"uniform_number\": \"12\" }), ..., Player({...}) ] Returns: List [ Player ] \u2013 list[Player]: List of YFPY Player instances containing attributes \"draft_analysis\", \"ownership\", \"percent_owned\", and \"player_stats\". Source code in yfpy/query.py 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 def get_team_roster_player_info_by_week ( self , team_id : Union [ str , int ], chosen_week : Union [ int , str ] = \"current\" ) -> List [ Player ]: \"\"\"Retrieve roster with ALL player info of specific team by team_id and by week for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_roster_player_info_by_week(1, 1) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"draft_analysis\": { \"average_pick\": \"65.9\", \"average_round\": \"7.6\", \"average_cost\": \"5.0\", \"percent_drafted\": \"1.00\" }, \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/ https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"ownership\": { \"ownership_type\": \"team\", \"owner_team_key\": \"331.l.729259.t.1\", \"owner_team_name\": \"Hellacious Hill 12\" }, \"percent_owned\": { \"coverage_type\": \"week\", \"week\": \"17\", \"value\": 99, \"delta\": \"0\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"player_points\": { \"coverage_type\": \"week\", \"week\": \"1\", \"total\": 10.26 }, \"player_stats\": { \"coverage_type\": \"week\", \"week\": \"1\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"249\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"1\" }, \"uniform_number\": \"12\" }), ..., Player({...}) ] Returns: list[Player]: List of YFPY Player instances containing attributes \"draft_analysis\", \"ownership\", \"percent_owned\", and \"player_stats\". \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /roster;week= { chosen_week } /players;\" f \"out=metadata,stats,ownership,percent_owned,draft_analysis\" , [ \"team\" , \"roster\" , \"0\" , \"players\" ] ) get_team_roster_player_info_by_date \u00b6 get_team_roster_player_info_by_date ( team_id , chosen_date = None ) Retrieve roster with ALL player info of specific team by team_id and by date for chosen league. Note This applies to MLB, NBA, and NHL leagues, but does NOT apply to NFL leagues. This query will FAIL if you pass it an INVALID date string! Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_date ( str , default: None ) \u2013 Selected date for which to retrieve data. REQUIRED FORMAT: YYYY-MM-DD (Ex. 2011-05-01) Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nhl\" ) >>> query . get_team_roster_player_info_by_date ( 1 , \"2011-05-01\" ) [ Player({ \"display_position\": \"C\", \"draft_analysis\": { \"average_pick\": 33.2, \"average_round\": 3.5, \"average_cost\": 39.2, \"percent_drafted\": 1.0 }, \"editorial_player_key\": \"nhl.p.3981\", \"editorial_team_abbr\": \"Chi\", \"editorial_team_full_name\": \"Chicago Blackhawks\", \"editorial_team_key\": \"nhl.t.4\", \"eligible_positions\": [ \"C\", \"F\" ], \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/tz.KOMoEiBDch6AJAGaUtg--~C/ YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/ https://s.yimg.com/xe/i/us/sp/v/nhl_cutout/players_l/11032021/3981.png\" }, \"is_editable\": 0, \"is_undroppable\": 0, \"name\": { \"ascii_first\": \"Jonathan\", \"ascii_last\": \"Toews\", \"first\": \"Jonathan\", \"full\": \"Jonathan Toews\", \"last\": \"Toews\" }, \"ownership\": { \"ownership_type\": \"team\", \"owner_team_key\": \"303.l.69624.t.2\", \"owner_team_name\": \"The Bateleurs\" }, \"percent_owned\": { \"coverage_type\": \"week\", \"week\": 25, \"value\": 98, \"delta\": -1.0 }, \"player_id\": 3981, \"player_key\": \"303.p.3981\", \"player_notes_last_timestamp\": 1651606838, \"player_stats\": { \"coverage_type\": \"date\", \"stats\": [ { \"stat\": { \"stat_id\": 1, \"value\": 1.0 } }, ... ] }, \"position_type\": \"P\", \"primary_position\": \"C\", \"selected_position\": { \"coverage_type\": \"date\", \"is_flex\": 0, \"position\": \"C\" }, \"uniform_number\": 19 }), ..., Player({...}) ] Returns: List [ Player ] \u2013 list[Player]: List of YFPY Player instances containing attributes \"draft_analysis\", \"ownership\", \"percent_owned\", and \"player_stats\". Source code in yfpy/query.py 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 def get_team_roster_player_info_by_date ( self , team_id : Union [ str , int ], chosen_date : str = None ) -> List [ Player ]: \"\"\"Retrieve roster with ALL player info of specific team by team_id and by date for chosen league. Note: This applies to MLB, NBA, and NHL leagues, but does NOT apply to NFL leagues. This query will FAIL if you pass it an INVALID date string! Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_date (str): Selected date for which to retrieve data. REQUIRED FORMAT: YYYY-MM-DD (Ex. 2011-05-01) Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nhl\") >>> query.get_team_roster_player_info_by_date(1, \"2011-05-01\") [ Player({ \"display_position\": \"C\", \"draft_analysis\": { \"average_pick\": 33.2, \"average_round\": 3.5, \"average_cost\": 39.2, \"percent_drafted\": 1.0 }, \"editorial_player_key\": \"nhl.p.3981\", \"editorial_team_abbr\": \"Chi\", \"editorial_team_full_name\": \"Chicago Blackhawks\", \"editorial_team_key\": \"nhl.t.4\", \"eligible_positions\": [ \"C\", \"F\" ], \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/tz.KOMoEiBDch6AJAGaUtg--~C/ YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/ https://s.yimg.com/xe/i/us/sp/v/nhl_cutout/players_l/11032021/3981.png\" }, \"is_editable\": 0, \"is_undroppable\": 0, \"name\": { \"ascii_first\": \"Jonathan\", \"ascii_last\": \"Toews\", \"first\": \"Jonathan\", \"full\": \"Jonathan Toews\", \"last\": \"Toews\" }, \"ownership\": { \"ownership_type\": \"team\", \"owner_team_key\": \"303.l.69624.t.2\", \"owner_team_name\": \"The Bateleurs\" }, \"percent_owned\": { \"coverage_type\": \"week\", \"week\": 25, \"value\": 98, \"delta\": -1.0 }, \"player_id\": 3981, \"player_key\": \"303.p.3981\", \"player_notes_last_timestamp\": 1651606838, \"player_stats\": { \"coverage_type\": \"date\", \"stats\": [ { \"stat\": { \"stat_id\": 1, \"value\": 1.0 } }, ... ] }, \"position_type\": \"P\", \"primary_position\": \"C\", \"selected_position\": { \"coverage_type\": \"date\", \"is_flex\": 0, \"position\": \"C\" }, \"uniform_number\": 19 }), ..., Player({...}) ] Returns: list[Player]: List of YFPY Player instances containing attributes \"draft_analysis\", \"ownership\", \"percent_owned\", and \"player_stats\". \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /\" f \"roster { ';date=' + str ( chosen_date ) if chosen_date else '' } /players;\" f \"out=metadata,stats,ownership,percent_owned,draft_analysis\" , [ \"team\" , \"roster\" , \"0\" , \"players\" ] ) get_team_roster_player_stats \u00b6 get_team_roster_player_stats ( team_id ) Retrieve roster with ALL player info for the season of specific team by team_id and for chosen league. Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_team_roster_player_stats ( 1 ) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"draft_analysis\": { \"average_pick\": \"65.9\", \"average_round\": \"7.6\", \"average_cost\": \"5.0\", \"percent_drafted\": \"1.00\" }, \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"player_points\": { \"coverage_type\": \"season\", \"total\": 287.06 }, \"player_stats\": { \"coverage_type\": \"season\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"4109\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"16\" }, \"uniform_number\": \"12\" }), ..., Player({...}) ] Returns: List [ Player ] \u2013 list[Player]: List of YFPY Player instances containing attributes \"draft_analysis\", \"ownership\", \"percent_owned\", and \"player_stats\". Source code in yfpy/query.py 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 def get_team_roster_player_stats ( self , team_id : Union [ str , int ]) -> List [ Player ]: \"\"\"Retrieve roster with ALL player info for the season of specific team by team_id and for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_roster_player_stats(1) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"draft_analysis\": { \"average_pick\": \"65.9\", \"average_round\": \"7.6\", \"average_cost\": \"5.0\", \"percent_drafted\": \"1.00\" }, \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"player_points\": { \"coverage_type\": \"season\", \"total\": 287.06 }, \"player_stats\": { \"coverage_type\": \"season\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"4109\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"16\" }, \"uniform_number\": \"12\" }), ..., Player({...}) ] Returns: list[Player]: List of YFPY Player instances containing attributes \"draft_analysis\", \"ownership\", \"percent_owned\", and \"player_stats\". \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /roster/players/stats;type=season\" , [ \"team\" , \"roster\" , \"0\" , \"players\" ] ) get_team_roster_player_stats_by_week \u00b6 get_team_roster_player_stats_by_week ( team_id , chosen_week = \"current\" ) Retrieve roster with player stats of specific team by team_id and by week for chosen league. Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week ( int , default: 'current' ) \u2013 Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_team_roster_player_stats_by_week ( 1 , 1 ) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt 3PTQ2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"player_points\": { \"coverage_type\": \"week\", \"week\": \"1\", \"total\": 10.26 }, \"player_stats\": { \"coverage_type\": \"week\", \"week\": \"1\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"249\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"1\" }, \"uniform_number\": \"12\" }), ..., Player({...}) ] Returns: List [ Player ] \u2013 list[Player]: List of YFPY Player instances containing attribute \"player_stats\". Source code in yfpy/query.py 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 def get_team_roster_player_stats_by_week ( self , team_id : Union [ str , int ], chosen_week : Union [ int , str ] = \"current\" ) -> List [ Player ]: \"\"\"Retrieve roster with player stats of specific team by team_id and by week for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_roster_player_stats_by_week(1, 1) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt 3PTQ2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"player_points\": { \"coverage_type\": \"week\", \"week\": \"1\", \"total\": 10.26 }, \"player_stats\": { \"coverage_type\": \"week\", \"week\": \"1\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"249\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"1\" }, \"uniform_number\": \"12\" }), ..., Player({...}) ] Returns: list[Player]: List of YFPY Player instances containing attribute \"player_stats\". \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /roster;week= { chosen_week } /players/stats\" , [ \"team\" , \"roster\" , \"0\" , \"players\" ] ) get_team_draft_results \u00b6 get_team_draft_results ( team_id ) Retrieve draft results of specific team by team_id for chosen league. Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_team_draft_results ( 1 ) [ DraftResult({ \"pick\": 4, \"round\": 1, \"team_key\": \"331.l.729259.t.1\", \"player_key\": \"331.p.8256\" }), ..., DraftResults({...}) ] Returns: List [ DraftResult ] \u2013 list[DraftResult]: List of YFPY DraftResult instances. Source code in yfpy/query.py 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 def get_team_draft_results ( self , team_id : Union [ str , int ]) -> List [ DraftResult ]: \"\"\"Retrieve draft results of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_draft_results(1) [ DraftResult({ \"pick\": 4, \"round\": 1, \"team_key\": \"331.l.729259.t.1\", \"player_key\": \"331.p.8256\" }), ..., DraftResults({...}) ] Returns: list[DraftResult]: List of YFPY DraftResult instances. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /draftresults\" , [ \"team\" , \"draft_results\" ] ) get_team_matchups \u00b6 get_team_matchups ( team_id ) Retrieve matchups of specific team by team_id for chosen league. Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_team_matchups ( 1 ) [ Matchup({ (see get_league_matchups_by_week docstring for matchup data example) }) ] Returns: List [ Matchup ] \u2013 list[Matchup]: List of YFPY Matchup instances. Source code in yfpy/query.py 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 def get_team_matchups ( self , team_id : Union [ str , int ]) -> List [ Matchup ]: \"\"\"Retrieve matchups of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_matchups(1) [ Matchup({ (see get_league_matchups_by_week docstring for matchup data example) }) ] Returns: list[Matchup]: List of YFPY Matchup instances. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /matchups\" , [ \"team\" , \"matchups\" ] ) get_player_stats_for_season \u00b6 get_player_stats_for_season ( player_key , limit_to_league_stats = True ) Retrieve stats of specific player by player_key for the entire season for chosen league. Parameters: player_key ( str ) \u2013 The player key of chosen player (example: 331.p.7200 - .p. ). limit_to_league_stats ( bool , default: True ) \u2013 Boolean (default: True) to limit the retrieved player stats to those for the selected league. When set to False, query retrieves all player stats for the game (NFL, NHL, NBA, MLB). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_player_stats_for_season ( \"331.p.7200\" ) Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"player_points\": { \"coverage_type\": \"season\", \"total\": 359.14 }, \"player_stats\": { \"coverage_type\": \"season\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"4381\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player ( Player ) \u2013 YFPY Player instance. Source code in yfpy/query.py 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 def get_player_stats_for_season ( self , player_key : str , limit_to_league_stats : bool = True ) -> Player : \"\"\"Retrieve stats of specific player by player_key for the entire season for chosen league. Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). limit_to_league_stats (bool): Boolean (default: True) to limit the retrieved player stats to those for the selected league. When set to False, query retrieves all player stats for the game (NFL, NHL, NBA, MLB). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_player_stats_for_season(\"331.p.7200\") Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"player_points\": { \"coverage_type\": \"season\", \"total\": 359.14 }, \"player_stats\": { \"coverage_type\": \"season\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"4381\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player: YFPY Player instance. \"\"\" if limit_to_league_stats : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /stats\" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player ) else : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/players;\" f \"player_keys= { player_key } /stats\" , [ \"players\" , \"0\" , \"player\" ], Player ) get_player_stats_by_week \u00b6 get_player_stats_by_week ( player_key , chosen_week = \"current\" , limit_to_league_stats = True , ) Retrieve stats of specific player by player_key and by week for chosen league. Parameters: player_key ( str ) \u2013 The player key of chosen player (example: 331.p.7200 - .p. ). chosen_week ( int , default: 'current' ) \u2013 Selected week for which to retrieve data. limit_to_league_stats ( bool , default: True ) \u2013 Boolean (default: True) to limit the retrieved player stats to those for the selected league. When set to False, query retrieves all player stats for the game (NFL, NHL, NBA, MLB). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_player_stats_by_week ( \"331.p.7200\" , 1 ) Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"player_points\": { \"coverage_type\": \"week\", \"week\": \"1\", \"total\": 10.56 }, \"player_stats\": { \"coverage_type\": \"week\", \"week\": \"1\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"189\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player ( Player ) \u2013 YFPY Player instance containing attribute \"player_stats\". Source code in yfpy/query.py 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 def get_player_stats_by_week ( self , player_key : str , chosen_week : Union [ int , str ] = \"current\" , limit_to_league_stats : bool = True ) -> Player : \"\"\"Retrieve stats of specific player by player_key and by week for chosen league. Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). chosen_week (int): Selected week for which to retrieve data. limit_to_league_stats (bool): Boolean (default: True) to limit the retrieved player stats to those for the selected league. When set to False, query retrieves all player stats for the game (NFL, NHL, NBA, MLB). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_player_stats_by_week(\"331.p.7200\", 1) Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"player_points\": { \"coverage_type\": \"week\", \"week\": \"1\", \"total\": 10.56 }, \"player_stats\": { \"coverage_type\": \"week\", \"week\": \"1\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"189\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player: YFPY Player instance containing attribute \"player_stats\". \"\"\" if limit_to_league_stats : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /stats;type=week;week= { chosen_week } \" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player ) else : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/players;\" f \"player_keys= { player_key } /stats;type=week;week= { chosen_week } \" , [ \"players\" , \"0\" , \"player\" ], Player ) get_player_stats_by_date \u00b6 get_player_stats_by_date ( player_key , chosen_date = None , limit_to_league_stats = True ) Retrieve player stats by player_key and by date for chosen league. Note This applies to MLB, NBA, and NHL leagues, but does NOT apply to NFL leagues. This query will FAIL if you pass it an INVALID date string! Parameters: player_key ( str ) \u2013 The player key of chosen player (example: 331.p.7200 - .p. ). chosen_date ( str , default: None ) \u2013 Selected date for which to retrieve data. REQUIRED FORMAT: YYYY-MM-DD (Ex. 2011-05-01) limit_to_league_stats ( bool , default: True ) \u2013 Boolean (default: True) to limit the retrieved player stats to those for the selected league. When set to False, query retrieves all player stats for the game (NFL, NHL, NBA, MLB). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nhl\" ) >>> query . get_player_stats_by_date ( \"nhl.p.4588\" , \"2011-05-01\" ) Player({ \"display_position\": \"G\", \"editorial_player_key\": \"nhl.p.4588\", \"editorial_team_abbr\": \"Was\", \"editorial_team_full_name\": \"Washington Capitals\", \"editorial_team_key\": \"nhl.t.23\", \"eligible_positions\": { \"position\": \"G\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/CzntDh_d59voTqU6fhQy3g--~C/YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2 NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/https://s.yimg.com/ xe/i/us/sp/v/nhl_cutout/players_l/10182019/4588.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Braden\", \"ascii_last\": \"Holtby\", \"first\": \"Braden\", \"full\": \"Braden Holtby\", \"last\": \"Holtby\" }, \"player_id\": \"4588\", \"player_key\": \"303.p.4588\", \"player_notes_last_timestamp\": 1574133600, \"player_stats\": { \"coverage_type\": \"date\", \"stats\": [ { \"stat\": { \"stat_id\": \"19\", \"value\": \"1\" } }, { \"stat\": { \"stat_id\": \"22\", \"value\": \"1\" } }, { \"stat\": { \"stat_id\": \"23\", \"value\": \"1.00\" } }, { \"stat\": { \"stat_id\": \"25\", \"value\": \"29\" } }, { \"stat\": { \"stat_id\": \"24\", \"value\": \"30\" } }, { \"stat\": { \"stat_id\": \"26\", \"value\": \".967\" } }, { \"stat\": { \"stat_id\": \"27\", \"value\": \"0\" } } ] }, \"position_type\": \"G\", \"primary_position\": \"G\", \"uniform_number\": \"70\" }) Returns: Player ( Player ) \u2013 YFPY Player instnace containing attribute \"player_stats\". Source code in yfpy/query.py 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 def get_player_stats_by_date ( self , player_key : str , chosen_date : str = None , limit_to_league_stats : bool = True ) -> Player : \"\"\"Retrieve player stats by player_key and by date for chosen league. Note: This applies to MLB, NBA, and NHL leagues, but does NOT apply to NFL leagues. This query will FAIL if you pass it an INVALID date string! Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). chosen_date (str): Selected date for which to retrieve data. REQUIRED FORMAT: YYYY-MM-DD (Ex. 2011-05-01) limit_to_league_stats (bool): Boolean (default: True) to limit the retrieved player stats to those for the selected league. When set to False, query retrieves all player stats for the game (NFL, NHL, NBA, MLB). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nhl\") >>> query.get_player_stats_by_date(\"nhl.p.4588\", \"2011-05-01\") Player({ \"display_position\": \"G\", \"editorial_player_key\": \"nhl.p.4588\", \"editorial_team_abbr\": \"Was\", \"editorial_team_full_name\": \"Washington Capitals\", \"editorial_team_key\": \"nhl.t.23\", \"eligible_positions\": { \"position\": \"G\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/CzntDh_d59voTqU6fhQy3g--~C/YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2 NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/https://s.yimg.com/ xe/i/us/sp/v/nhl_cutout/players_l/10182019/4588.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Braden\", \"ascii_last\": \"Holtby\", \"first\": \"Braden\", \"full\": \"Braden Holtby\", \"last\": \"Holtby\" }, \"player_id\": \"4588\", \"player_key\": \"303.p.4588\", \"player_notes_last_timestamp\": 1574133600, \"player_stats\": { \"coverage_type\": \"date\", \"stats\": [ { \"stat\": { \"stat_id\": \"19\", \"value\": \"1\" } }, { \"stat\": { \"stat_id\": \"22\", \"value\": \"1\" } }, { \"stat\": { \"stat_id\": \"23\", \"value\": \"1.00\" } }, { \"stat\": { \"stat_id\": \"25\", \"value\": \"29\" } }, { \"stat\": { \"stat_id\": \"24\", \"value\": \"30\" } }, { \"stat\": { \"stat_id\": \"26\", \"value\": \".967\" } }, { \"stat\": { \"stat_id\": \"27\", \"value\": \"0\" } } ] }, \"position_type\": \"G\", \"primary_position\": \"G\", \"uniform_number\": \"70\" }) Returns: Player: YFPY Player instnace containing attribute \"player_stats\". \"\"\" if limit_to_league_stats : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /stats;type=date;date= { chosen_date } \" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player ) else : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/players;\" f \"player_keys= { player_key } /stats;type=date;date= { chosen_date } \" , [ \"players\" , \"0\" , \"player\" ], Player ) get_player_ownership \u00b6 get_player_ownership ( player_key ) Retrieve ownership of specific player by player_key for chosen league. Parameters: player_key ( str ) \u2013 The player key of chosen player (example: 331.p.7200 - .p. ). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_player_ownership ( \"331.p.7200\" ) Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"ownership\": { \"ownership_type\": \"team\", \"owner_team_key\": \"331.l.729259.t.4\", \"owner_team_name\": \"hold my D\", \"teams\": { \"team\": { \"clinched_playoffs\": 1, \"draft_grade\": \"B-\", \"draft_position\": 1, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/4/draftrecap\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"5KLNXUYW5RP22UMRKUXHBCIITI\", \"manager_id\": \"4\", \"nickname\": \"--hidden--\" } }, \"name\": \"hold my D\", \"number_of_moves\": \"27\", \"number_of_trades\": \"1\", \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"4\", \"team_key\": \"331.l.729259.t.4\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1589/24677593583_68859308dd_192sq.jpg?ct=fantasy\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/4\", \"waiver_priority\": 7 } } }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player ( Player ) \u2013 YFPY Player instance containing attribute \"ownership\". Source code in yfpy/query.py 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 def get_player_ownership ( self , player_key : str ) -> Player : \"\"\"Retrieve ownership of specific player by player_key for chosen league. Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_player_ownership(\"331.p.7200\") Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"ownership\": { \"ownership_type\": \"team\", \"owner_team_key\": \"331.l.729259.t.4\", \"owner_team_name\": \"hold my D\", \"teams\": { \"team\": { \"clinched_playoffs\": 1, \"draft_grade\": \"B-\", \"draft_position\": 1, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/4/draftrecap\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"5KLNXUYW5RP22UMRKUXHBCIITI\", \"manager_id\": \"4\", \"nickname\": \"--hidden--\" } }, \"name\": \"hold my D\", \"number_of_moves\": \"27\", \"number_of_trades\": \"1\", \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"4\", \"team_key\": \"331.l.729259.t.4\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1589/24677593583_68859308dd_192sq.jpg?ct=fantasy\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/4\", \"waiver_priority\": 7 } } }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player: YFPY Player instance containing attribute \"ownership\". \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /ownership\" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player ) get_player_percent_owned_by_week \u00b6 get_player_percent_owned_by_week ( player_key , chosen_week = \"current\" ) Retrieve percent-owned of specific player by player_key and by week for chosen league. Parameters: player_key ( str ) \u2013 The player key of chosen player (example: 331.p.7200 - .p. ). chosen_week ( int , default: 'current' ) \u2013 Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_player_percent_owned_by_week ( \"331.p.7200\" , 1 ) Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/ https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"percent_owned\": { \"coverage_type\": \"week\", \"week\": \"1\", \"value\": 100, \"delta\": \"0\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player ( Player ) \u2013 YFPY Player instance containing attribute \"percent_owned\". Source code in yfpy/query.py 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 def get_player_percent_owned_by_week ( self , player_key : str , chosen_week : Union [ int , str ] = \"current\" ) -> Player : \"\"\"Retrieve percent-owned of specific player by player_key and by week for chosen league. Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_player_percent_owned_by_week(\"331.p.7200\", 1) Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/ https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"percent_owned\": { \"coverage_type\": \"week\", \"week\": \"1\", \"value\": 100, \"delta\": \"0\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player: YFPY Player instance containing attribute \"percent_owned\". \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /percent_owned;type=week;week= { chosen_week } \" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player ) get_player_draft_analysis \u00b6 get_player_draft_analysis ( player_key ) Retrieve draft analysis of specific player by player_key for chosen league. Parameters: player_key ( str ) \u2013 The player key of chosen player (example: 331.p.7200 - .p. ). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_player_draft_analysis ( \"331.p.7200\" ) Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"draft_analysis\": { \"average_pick\": \"19.9\", \"average_round\": \"2.8\", \"average_cost\": \"38.5\", \"percent_drafted\": \"1.00\" }, \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player ( Player ) \u2013 YFPY Player instance containing attribute \"draft_analysis\". Source code in yfpy/query.py 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 def get_player_draft_analysis ( self , player_key : str ) -> Player : \"\"\"Retrieve draft analysis of specific player by player_key for chosen league. Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_player_draft_analysis(\"331.p.7200\") Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"draft_analysis\": { \"average_pick\": \"19.9\", \"average_round\": \"2.8\", \"average_cost\": \"38.5\", \"percent_drafted\": \"1.00\" }, \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player: YFPY Player instance containing attribute \"draft_analysis\". \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /draft_analysis\" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player )","title":"Query"},{"location":"query/#query","text":"YFPY module for making Yahoo Fantasy Sports REST API queries. This module provides all available Yahoo Fantasy Sports API queries as callable methods on the YahooFantasySportsQuery class. Attributes: logger ( Logger ) \u2013 Module level logger for usage and debugging.","title":"Query"},{"location":"query/#yfpy.query.YahooFantasySportsQuery","text":"Bases: object Yahoo Fantasy Sports REST API query CLASS to retrieve all types of fantasy sports data. Source code in yfpy/query.py 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 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 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 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 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 470 471 472 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 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 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 695 696 697 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 728 729 730 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 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 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 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 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 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 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 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 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 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 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 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 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 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 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 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 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 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 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 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 class YahooFantasySportsQuery ( object ): \"\"\"Yahoo Fantasy Sports REST API query CLASS to retrieve all types of fantasy sports data. \"\"\" YFO = TypeVar ( \"YFO\" , bound = YahooFantasyObject ) runtime_environment_is_docker = os . environ . get ( \"RUNTIME_ENVIRONMENT\" , None ) == \"docker\" def __init__ ( self , league_id : str , game_code : str , game_id : Optional [ int ] = None , yahoo_consumer_key : Optional [ str ] = None , yahoo_consumer_secret : Optional [ str ] = None , yahoo_access_token_json : Optional [ Union [ str , Dict ]] = None , env_var_fallback : bool = True , env_file_location : Optional [ Path ] = None , save_token_data_to_env_file : Optional [ bool ] = False , all_output_as_json_str : bool = False , browser_callback : bool = not runtime_environment_is_docker , retries : int = 3 , backoff : int = 0 , offline : bool = False ): \"\"\"Instantiate a YahooQueryObject for running queries against the Yahoo fantasy REST API. Args: league_id (str): League ID of selected Yahoo Fantasy league. game_code (str): Game code of selected Yahoo Fantasy game corresponding to a specific sport (refers to the current season if used as the value for game_key), where \"nfl\" is for fantasy football, \"nhl\" is for fantasy hockey, \"mlb\" is for fantasy baseball, and \"nba\" is for fantasy basketball. game_id (:obj:`int`, optional): Game ID of selected Yahoo fantasy game corresponding to a specific year, and defaulting to the game ID for the current year. yahoo_consumer_key (:obj:`str`, optional): User defined Yahoo developer app consumer key (must be provided in conjunction with yahoo_consumer_secret). yahoo_consumer_secret (:obj:`str`, optional): User defined Yahoo developer app consumer secret (must be provided in conjunction with yahoo_consumer_key). yahoo_access_token_json (str | dict, optional): User defined JSON (string or dict) containing refreshable access token generated by the yahoo-oauth library to avoid having to reauthenticate on every access to the Yahoo Fantasy Sports API (overrides yahoo_consumer_key/yahoo_consumer_secret and all Yahoo access token environment variables). env_var_fallback (:obj:`bool`, optional): Fall back to values retrieved from environment variables for any missing arguments or access token fields (defaults to True). env_file_location (:obj:`Path`, optional): Path to directory where existing .env file is located or new .env file should be generated when provided in conjunction with save_access_token_data_to_env_file=True (defaults to None). save_token_data_to_env_file (:obj:`bool`, optional): Boolean to save Yahoo access token data to local .env file (must be provided in conjunction with env_file_location) (defaults to False) all_output_as_json_str (:obj:`bool`, optional): Option to automatically convert all query output to JSON strings. browser_callback (:obj:`bool`, optional): Enable or disable (enabled by default) whether the yahoo-oauth library automatically opens a browser window to authenticate (if disabled, it will output the callback URL). retries (:obj:`int`, optional): Number of times to retry a query if it fails (defaults to 3). backoff (:obj:`int`, optional): Multiplier that incrementally increases the wait time before retrying a failed query request. offline (:obj:`bool`, optional): Boolean to run in offline mode (Only works if all needed Yahoo Fantasy data has been previously saved locally using the Data module in data.py). Attributes: _env_var_fallback (bool): Fall back to values retrieved from environment variables for any missing arguments or access token fields. _yahoo_access_token_dict (dict[str, Any]): Dictionary containing refreshable access token data generated by the yahoo-oauth library to avoid having to reauthenticate on every access to the Yahoo Fantasy Sports API. _yahoo_consumer_key (str): User defined Yahoo developer app consumer key. _yahoo_consumer_secret (str): User defined Yahoo developer app consumer secret. _browser_callback (bool): Enable or disable (enabled by default) whether the yahoo-oauth library automatically opens a browser window to authenticate (if disabled, it will output the callback URL). _retries (int): Number of times to retry a query if it fails (defaults to 3). _backoff (int): Multiplier that incrementally increases the wait time before retrying a failed query request. _fantasy_content_data_field (str): The initial JSON field in which all Yahoo Fantasy Sports API responses store the data output of the submitted query. league_id (str): League ID of selected Yahoo Fantasy league. game_code (str): Game code of selected Yahoo Fantasy game corresponding to a specific sport (refers to the current season if used as the value for game_key), where \"nfl\" is for fantasy football, \"nhl\" is for fantasy hockey, \"mlb\" is for fantasy baseball, and \"nba\" is for fantasy basketball. game_id (int): Game ID of selected Yahoo fantasy game corresponding to a specific year, and defaulting to the game ID for the current year. league_key (str): The Yahoo Fantasy Sports league key formatted as .l.. executed_queries (list[dict[str, Any]]): List of completed queries and their responses. all_output_as_json_str (bool): Option to automatically convert all query output to JSON strings. offline (bool): Boolean to run in offline mode (Only works if all needed Yahoo Fantasy data has been previously saved locally using the Data module in data.py). \"\"\" self . _env_var_fallback = env_var_fallback # load provided .env file if it exists to read any additional environment variables stored there if self . _env_var_fallback and env_file_location : env_file_path = env_file_location / \".env\" if env_file_path . is_file (): load_dotenv ( env_file_path ) self . _yahoo_access_token_dict : Dict [ str , Any ] = self . _get_dict_from_access_token_json ( yahoo_access_token_json ) # warn user that providing Yahoo access token JSON or populating a YAHOO_ACCESS_TOKEN_JSON environment variable # will override any values provided in the yahoo_consumer_key and yahoo_consumer_secret parameters if self . _yahoo_access_token_dict and ( yahoo_consumer_key or yahoo_consumer_secret ): logger . warning ( \"Providing a yahoo_access_token_json argument or setting env_var_fallback to True and having a \" \"YAHOO_ACCESS_TOKEN_JSON will override any values provided for yahoo_consumer_key or \" \"yahoo_consumer_secret.\" ) # retrieve the Yahoo consumer key and Yahoo consumer secret from the access token dict and fall back to the # provided parameters if no dict exists self . _yahoo_consumer_key = self . _yahoo_access_token_dict . get ( \"consumer_key\" , yahoo_consumer_key ) self . _yahoo_consumer_secret = self . _yahoo_access_token_dict . get ( \"consumer_secret\" , yahoo_consumer_secret ) # catch when a Yahoo consumer key was not provided if not self . _yahoo_consumer_key : # check for YAHOO_CONSUMER_KEY environment variable value if env_var_fallback is True if self . _env_var_fallback : if yahoo_consumer_key_env_var := os . environ . get ( \"YAHOO_CONSUMER_KEY\" ): self . _yahoo_consumer_key = yahoo_consumer_key_env_var if not self . _yahoo_consumer_key : logger . error ( \"Missing required Yahoo consumer key (no yahoo_consumer_key argument provided to \" \"YahooFantasySportsQuery, no consumer_key value provided in yahoo_access_token_json, or no \" \"YAHOO_CONSUMER_KEY environment variable value found).\" ) sys . exit ( 1 ) # catch when a Yahoo consumer secret was not provided if not self . _yahoo_consumer_secret : # check for YAHOO_CONSUMER_SECRET environment variable value if env_var_fallback is True if self . _env_var_fallback : if yahoo_consumer_secret_env_var := os . environ . get ( \"YAHOO_CONSUMER_SECRET\" ): self . _yahoo_consumer_secret = yahoo_consumer_secret_env_var if not self . _yahoo_consumer_secret : logger . error ( \"Missing required Yahoo consumer secret (no yahoo_consumer_secret argument provided to \" \"YahooFantasySportsQuery, no consumer_secret value provided in yahoo_access_token_json, or no \" \"YAHOO_CONSUMER_SECRET environment variable value found).\" ) sys . exit ( 1 ) # explicitly check for truthy/falsy value self . _browser_callback : bool = True if browser_callback is True else False self . _retries : int = retries self . _backoff : int = backoff self . _fantasy_content_data_field : str = \"fantasy_content\" self . league_id : str = league_id self . game_code : str = ( game_code if game_code in yahoo_fantasy_sports_game_codes else retrieve_game_code_from_user () ) self . game_id : int = game_id self . league_key : str = None self . executed_queries : List [ Dict [ str , Any ]] = [] # explicitly check for truthy/falsy value self . all_output_as_json_str : bool = True if all_output_as_json_str is True else False # explicitly check for truthy/falsy value self . offline : bool = True if offline is True else False if not self . offline : self . _authenticate () if save_token_data_to_env_file : self . save_access_token_data_to_env_file ( env_file_location ) def _get_dict_from_access_token_json ( self , yahoo_access_token_json : Union [ str , Dict ]) -> Dict [ str , Any ]: \"\"\"Creates a dictionary of Yahoo access token fields extracted from provided JSON (or a provided dictionary). Args: yahoo_access_token_json (str | dict): A valid JSON string or Python dictionary containing Yahoo access token fields and values. Returns: dict[str, Any]: A dictionary of key/value pairs containing the required values to authenticate using a Yahoo access token. \"\"\" yahoo_access_token_dict : Dict [ str , Any ] = {} # check if there is no provided token JSON and attempt to retrieve them from the YAHOO_ACCESS_TOKEN_JSON # environment variable if fallback to environment variables is True if not yahoo_access_token_json and self . _env_var_fallback : yahoo_access_token_json = os . environ . get ( \"YAHOO_ACCESS_TOKEN_JSON\" ) if yahoo_access_token_json : # parse Yahoo access token JSON as needed if isinstance ( yahoo_access_token_json , str ): try : yahoo_access_token_dict = json . loads ( yahoo_access_token_json ) except JSONDecodeError as e : logger . error ( f \"Invalid JSON provided in yahoo_access_token_json: \\n { e } \" ) sys . exit ( 1 ) elif isinstance ( yahoo_access_token_json , dict ): yahoo_access_token_dict = yahoo_access_token_json else : logger . error ( f \"Invalid object type provided in yahoo_access_token_json or YAHOO_ACCESS_TOKEN_JSON environment \" f \"variable: { type ( yahoo_access_token_json ) } \" ) sys . exit ( 1 ) # check if any fields required by a Yahoo access token are missing yahoo_access_token_required_fields = { \"access_token\" , \"consumer_key\" , \"consumer_secret\" , \"guid\" , \"refresh_token\" , \"token_time\" , \"token_type\" } if not set ( yahoo_access_token_dict . keys ()) . issuperset ( yahoo_access_token_required_fields ): logger . error ( f \"Missing required fields in yahoo_access_token_json: \" f \" { yahoo_access_token_required_fields . difference ( yahoo_access_token_dict . keys ()) } \" ) sys . exit ( 1 ) return yahoo_access_token_dict def _authenticate ( self ) -> None : \"\"\"Authenticate with the Yahoo Fantasy Sports REST API using OAuth2. Returns: None \"\"\" logger . debug ( \"Authenticating with Yahoo.\" ) # provide Yahoo access token fields if available or search for them in environment variables if env_var_fallback # is True, and then complete OAuth2 3-legged handshake by either refreshing existing OAuth2 refresh token or # requesting account access and returning a verification code to input to the command line prompt self . oauth = OAuth2 ( self . _yahoo_consumer_key , self . _yahoo_consumer_secret , access_token = self . _yahoo_access_token_dict . get ( \"access_token\" , os . environ . get ( \"YAHOO_ACCESS_TOKEN\" , None ) if self . _env_var_fallback else None ), guid = self . _yahoo_access_token_dict . get ( \"guid\" , os . environ . get ( \"YAHOO_GUID\" , None ) if self . _env_var_fallback else None ), refresh_token = self . _yahoo_access_token_dict . get ( \"refresh_token\" , os . environ . get ( \"YAHOO_REFRESH_TOKEN\" , None ) if self . _env_var_fallback else None ), token_time = self . _yahoo_access_token_dict . get ( \"token_time\" , float ( os . environ . get ( \"YAHOO_TOKEN_TIME\" , 0.0 )) if self . _env_var_fallback else 0.0 ), token_type = self . _yahoo_access_token_dict . get ( \"token_type\" , os . environ . get ( \"YAHOO_TOKEN_TYPE\" , None ) if self . _env_var_fallback else None ), browser_callback = self . _browser_callback , store_file = False ) if not self . oauth . token_is_valid (): self . oauth . refresh_access_token () self . _yahoo_access_token_dict . update ( { \"access_token\" : self . oauth . access_token , \"consumer_key\" : self . oauth . consumer_key , \"consumer_secret\" : self . oauth . consumer_secret , \"guid\" : self . oauth . guid , \"refresh_token\" : self . oauth . refresh_token , \"token_time\" : self . oauth . token_time , \"token_type\" : self . oauth . token_type , } ) @staticmethod def _retrieve_env_file_contents ( env_file_path : Path ) -> Dict [ str , str ]: \"\"\"Creates a dictionary of key/value pairs representing each line of a .env file (stores environment variables). Args: env_file_path (Path): The path to the directory where the target .env file is located. Returns: dict[str, str]: A dictionary of key/value pairs representing each line of a .env file. \"\"\" env_file_content = OrderedDict () if env_file_path . is_file (): with open ( env_file_path , \"r\" ) as env_file : for line_num , env_file_line in enumerate ( env_file , start = 1 ): if env_file_line . startswith ( \" \\n \" ): # track blank lines in .env file using their line number env_file_content [ f \"blank_ { line_num } \" ] = \" \\n \" elif env_file_line . startswith ( \"#\" ): # track comments in .env file using their line number env_file_content [ f \"comment_ { line_num } \" ] = env_file_line . strip () else : # extract and normalize environment variables from .env file env_var_name , env_var_value = env_file_line . split ( \"=\" , 1 ) env_file_content [ env_var_name . lower ()] = env_var_value . strip () return env_file_content def save_access_token_data_to_env_file ( self , env_file_directory : Path , env_file_name : str = \".env\" , save_json_to_var : bool = False ) -> None : \"\"\"Saves the fields and values of a Yahoo access token into a .env file. Args: env_file_directory (Path): The path to the directory where the target .env file is/will be located. env_file_name (:obj:`str`, optional): The name of the target .env file (defaults to \".env\"). save_json_to_var (:obj:`bool`, optional): Boolean to determine whether or not to write a JSON string of Yahoo access token fields to a YAHOO_ACCESS_TOKEN_JSON environment variable in the target .env file (defaults to False). Returns: None \"\"\" if env_file_directory : env_file_path = env_file_directory / env_file_name else : logger . warning ( \"Missing argument env_file_location. Yahoo access token will NOT be saved to .env file.\" ) # exit method without saving Yahoo access token data when no env_file_location argument is provided return env_file_content = self . _retrieve_env_file_contents ( env_file_path ) # replace values of any matching environment variables in .env file with values from Yahoo access token fields for k , v in self . _yahoo_access_token_dict . items (): env_file_content [ f \"yahoo_ { k } \" ] = v # generate a JSON string with escaped double quotes using nested json.dumps() and write it to a # YAHOO_ACCESS_TOKEN_JSON environment variable if save_json_to_var is set to True if save_json_to_var : env_file_content [ \"yahoo_access_token_json\" ] = json . dumps ( json . dumps ( self . _yahoo_access_token_dict )) # write contents to .env file (overwrites contents if file exists or creates a new file if not) with open ( env_file_path , \"w\" ) as env_file : for k , v in env_file_content . items (): if k . startswith ( \"blank\" ): env_file . write ( v ) elif k . startswith ( \"comment\" ): env_file . write ( f \" { v } \\n \" ) else : env_file . write ( f \" { k . upper () } = { v } \\n \" ) def get_response ( self , url : str ) -> Response : \"\"\"Retrieve Yahoo Fantasy Sports data from the REST API. Args: url (str): REST API request URL string. Returns: Response: API response from Yahoo Fantasy Sports API request. \"\"\" logger . debug ( f \"Making request to URL: { url } \" ) response : Response = self . oauth . session . get ( url , params = { \"format\" : \"json\" }) status_code = response . status_code # when you exceed Yahoo's allowed data request limits, they throw a request status code of 999 if status_code == 999 : raise HTTPError ( \"Yahoo data unavailable due to rate limiting. Please try again later.\" ) if status_code == 401 : self . _authenticate () response_json = {} try : response_json = response . json () logger . debug ( f \"Response (JSON): { response_json } \" ) except JSONDecodeError : response . raise_for_status () try : if ( status_code // 100 ) != 2 : # handle if the yahoo query returns an error if response_json . get ( \"error\" ): response_error_msg = response_json . get ( \"error\" ) . get ( \"description\" ) error_msg = f \"Attempt to retrieve data at URL { response . url } failed with error: \" \\ f \" \\\" { response_error_msg } \\\" \" logger . error ( error_msg ) raise YahooFantasySportsDataNotFound ( error_msg , url = response . url ) response . raise_for_status () except HTTPError as e : # retry with incremental back-off if self . _retries > 0 : self . _retries -= 1 self . _backoff += 1 logger . warning ( f \"Request for URL { url } failed with status code { response . status_code } . \" f \"Retrying { self . _retries } more time { 's' if self . _retries > 1 else '' } ...\" ) time . sleep ( 0.3 * self . _backoff ) response = self . get_response ( url ) else : # log error and terminate query if status code is not 200 after 3 retries logger . error ( f \"Request failed with status code: { response . status_code } - { e } \" ) response . raise_for_status () raw_response_data = response_json . get ( self . _fantasy_content_data_field ) # extract data from \"fantasy_content\" field if it exists if raw_response_data : logger . debug ( f \"Data fetched with query URL: { response . url } \" ) logger . debug ( f \"Response (Yahoo fantasy data extracted from: \" f \" \\\" { self . _fantasy_content_data_field } \\\" ): { raw_response_data } \" ) else : error_msg = f \"No data found at URL { response . url } when attempting extraction from field: \" \\ f \" \\\" { self . _fantasy_content_data_field } \\\" \" logger . error ( error_msg ) raise YahooFantasySportsDataNotFound ( error_msg , url = response . url ) return response # noinspection GrazieInspection def query ( self , url : str , data_key_list : Union [ List [ str ], List [ List [ str ]]], data_type_class : Type = None , sort_function : Callable = None ) -> ( Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]]): \"\"\"Base query class to retrieve requested data from the Yahoo fantasy sports REST API. Args: url (str): REST API request URL string. data_key_list (list[str] | list[list[str]]): List of keys used to extract the specific data desired by the given query (supports strings and lists of strings). Supports lists containing only key strings such as [\"game\", \"stat_categories\"], and also supports lists containing key strings followed by lists of key strings such as [\"team\", [\"team_points\", \"team_projected_points\"]]. data_type_class (:obj:`Type`, optional): Highest level data model type (if one exists for the retrieved data). sort_function (Callable of sort function, optional)): Optional lambda function to return sorted query results. Returns: object: Model class instance from yfpy/models.py, dictionary, or list (depending on query), with unpacked and parsed response data. \"\"\" if not self . offline : response = self . get_response ( url ) raw_response_data = response . json () . get ( self . _fantasy_content_data_field ) # print(json.dumps(raw_response_data, indent=2)) # iterate through list of data keys and drill down to final desired data field for i in range ( len ( data_key_list )): if isinstance ( raw_response_data , list ): if isinstance ( data_key_list [ i ], list ): reformatted = reformat_json_list ( raw_response_data ) raw_response_data = [ { data_key_list [ i ][ 0 ]: reformatted [ data_key_list [ i ][ 0 ]]}, { data_key_list [ i ][ 1 ]: reformatted [ data_key_list [ i ][ 1 ]]} ] else : raw_response_data = reformat_json_list ( raw_response_data )[ data_key_list [ i ]] else : if isinstance ( data_key_list [ i ], list ): raw_response_data = [ { data_key_list [ i ][ 0 ]: raw_response_data [ data_key_list [ i ][ 0 ]]}, { data_key_list [ i ][ 1 ]: raw_response_data [ data_key_list [ i ][ 1 ]]} ] else : raw_response_data = raw_response_data . get ( data_key_list [ i ]) if raw_response_data : logger . debug ( f \"Response (Yahoo fantasy data extracted from: { data_key_list } ): { raw_response_data } \" ) else : error_msg = f \"No data found when attempting extraction from fields: { data_key_list } \" logger . error ( error_msg ) raise YahooFantasySportsDataNotFound ( error_msg , payload = data_key_list , url = response . url ) # unpack, parse, and assign data types to all retrieved data content unpacked = unpack_data ( raw_response_data , YahooFantasyObject ) logger . debug ( f \"Unpacked and parsed JSON (Yahoo fantasy data wth parent type: { data_type_class } ): \\n { unpacked } \" ) self . executed_queries . append ({ \"url\" : response . url , \"response_status_code\" : response . status_code , \"response\" : response }) # cast the highest level of data to type corresponding to query (if type exists) query_data = data_type_class ( unpacked ) if data_type_class else unpacked # sort data when applicable if sort_function and not isinstance ( query_data , dict ): query_data = sorted ( query_data , key = sort_function ) # flatten lists of single-key dicts of objects into lists of those objects if isinstance ( query_data , list ): last_data_key = data_key_list [ - 1 ] if last_data_key . endswith ( \"s\" ): query_data = [ el [ last_data_key [: - 1 ]] for el in query_data ] if self . all_output_as_json_str : return jsonify_data ( query_data ) else : return query_data else : logger . error ( \"Cannot run Yahoo query while using offline mode! Please try again with offline=False.\" ) def get_all_yahoo_fantasy_game_keys ( self ) -> List [ Game ]: \"\"\"Retrieve all Yahoo Fantasy Sports game keys by ID (from year of inception to present), sorted by season/year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_all_yahoo_fantasy_game_keys() [ Game({ \"code\": \"nfl\", \"game_id\": \"50\", \"game_key\": \"50\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"1999\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/1999\" }), ..., Game({...}) ] Returns: list[Game]: List of YFPY Game instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/games;game_codes= { self . game_code } \" , [ \"games\" ], sort_function = lambda x : x . get ( \"game\" ) . season ) # noinspection PyUnresolvedReferences def get_game_key_by_season ( self , season : int ) -> str : \"\"\"Retrieve specific game key by season. Args: season (int): User defined season/year for which to retrieve the Yahoo Fantasy Sports game. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_key_by_season(2021) 338 Returns: str: The game key for a Yahoo Fantasy Sports game specified by season. \"\"\" all_output_as_json = False if self . all_output_as_json_str : self . all_output_as_json_str = False all_output_as_json = True game_key = self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/games;game_codes= { self . game_code } ;seasons= { season } \" , [ \"games\" ] ) . get ( \"game\" ) . game_key if all_output_as_json : self . all_output_as_json_str = True return game_key def get_current_game_info ( self ) -> Game : \"\"\"Retrieve game info for current fantasy season. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_current_game_info() Game({ \"code\": \"nfl\", \"game_id\": \"390\", \"game_key\": \"390\", \"game_weeks\": [ { \"game_week\": { \"display_name\": \"1\", \"end\": \"2019-09-09\", \"start\": \"2019-09-05\", \"week\": \"1\" } }, ... ], \"is_game_over\": 0, \"is_live_draft_lobby_active\": 1, \"is_offseason\": 0, \"is_registration_over\": 0, \"name\": \"Football\", \"position_types\": [ { \"position_type\": { \"type\": \"O\", \"display_name\": \"Offense\" } }, ... ], \"roster_positions\": [ { \"roster_position\": { \"position\": \"QB\", \"position_type\": \"O\" } }, ... ], \"season\": \"2019\", \"stat_categories\": { \"stats\": [ { \"stat\": { \"display_name\": \"GP\", \"name\": \"Games Played\", \"sort_order\": \"1\", \"stat_id\": 0 } }, ... }, \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/f1\" }) Returns: Game: YFPY Game instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { self . game_code } ;\" f \"out=metadata,players,game_weeks,stat_categories,position_types,roster_positions\" , [ \"game\" ], Game ) def get_current_game_metadata ( self ) -> Game : \"\"\"Retrieve game metadata for current fantasy season. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_current_game_metadata() Game({ \"code\": \"nfl\", \"game_id\": \"390\", \"game_key\": \"390\", \"is_game_over\": 0, \"is_live_draft_lobby_active\": 1, \"is_offseason\": 0, \"is_registration_over\": 0, \"name\": \"Football\", \"season\": \"2019\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/f1\" }) Returns: Game: YFPY Game instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { self . game_code } /metadata\" , [ \"game\" ], Game ) def get_game_info_by_game_id ( self , game_id : int ) -> Game : \"\"\"Retrieve game info for specific game by ID. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_info_by_game_id(390) Game({ \"code\": \"nfl\", \"game_id\": \"390\", \"game_key\": \"390\", \"game_weeks\": [ { \"game_week\": { \"display_name\": \"1\", \"end\": \"2019-09-09\", \"start\": \"2019-09-05\", \"week\": \"1\" } }, ... ], \"is_game_over\": 0, \"is_live_draft_lobby_active\": 1, \"is_offseason\": 0, \"is_registration_over\": 0, \"name\": \"Football\", \"position_types\": [ { \"position_type\": { \"type\": \"O\", \"display_name\": \"Offense\" } }, ... ], \"roster_positions\": [ { \"roster_position\": { \"position\": \"QB\", \"position_type\": \"O\" } }, ... ], \"season\": \"2019\", \"stat_categories\": { \"stats\": [ { \"stat\": { \"display_name\": \"GP\", \"name\": \"Games Played\", \"sort_order\": \"1\", \"stat_id\": 0 } }, ... }, \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/f1\" }) Returns: Game: YFPY Game instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } ;\" f \"out=metadata,players,game_weeks,stat_categories,position_types,roster_positions\" , [ \"game\" ], Game ) def get_game_metadata_by_game_id ( self , game_id : int ) -> Game : \"\"\"Retrieve game metadata for specific game by ID. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_metadata_by_game_id(331) Game({ \"code\": \"nfl\", \"game_id\": \"331\", \"game_key\": \"331\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"2014\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014\" }) Returns: Game: YFPY Game instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } /metadata\" , [ \"game\" ], Game ) def get_game_weeks_by_game_id ( self , game_id : int ) -> List [ GameWeek ]: \"\"\"Retrieve all valid weeks of a specific game by ID. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_weeks_by_game_id(331) [ GameWeek({ \"display_name\": \"1\", \"end\": \"2014-09-08\", \"start\": \"2014-09-04\", \"week\": \"1\" }), ..., GameWeek({ \"display_name\": \"17\", \"end\": \"2014-12-28\", \"start\": \"2014-12-23\", \"week\": \"17\" }) ] Returns: list[GameWeek]: List of YFPY GameWeek instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } /game_weeks\" , [ \"game\" , \"game_weeks\" ] ) def get_game_stat_categories_by_game_id ( self , game_id : int ) -> StatCategories : \"\"\"Retrieve all valid stat categories of a specific game by ID. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_stat_categories_by_game_id(331) StatCategories({ \"stats\": [ { \"stat\": { \"display_name\": \"GP\", \"name\": \"Games Played\", \"sort_order\": \"1\", \"stat_id\": 0 } }, ..., { \"stat\": { \"display_name\": \"Rush 1st Downs\", \"name\": \"Rushing 1st Downs\", \"sort_order\": \"1\", \"stat_id\": 81 } } ] }) Returns: StatCategories: YFPY StatCategories instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } /stat_categories\" , [ \"game\" , \"stat_categories\" ], StatCategories ) def get_game_position_types_by_game_id ( self , game_id : int ) -> List [ PositionType ]: \"\"\"Retrieve all valid position types for specific game by ID sorted alphabetically by type. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_position_types_by_game_id(331) [ PositionType({ \"type\": \"O\", \"display_name\": \"Offense\" }), ..., PositionType({ \"type\": \"K\", \"display_name\": \"Kickers\" }) ] Returns: list[PositionType]: List of YFPY PositionType instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } /position_types\" , [ \"game\" , \"position_types\" ], sort_function = lambda x : x . get ( \"position_type\" ) . type ) def get_game_roster_positions_by_game_id ( self , game_id : int ) -> List [ RosterPosition ]: \"\"\"Retrieve all valid roster positions for specific game by ID sorted alphabetically by position. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_roster_positions_by_game_id(331) [ {RosterPosition({ \"position\": \"BN\" }), ..., RosterPosition({ \"position\": \"WR\", \"position_type\": \"O\" }) ] Returns: list[RosterPosition]: List of YFPY RosterPosition instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } /roster_positions\" , [ \"game\" , \"roster_positions\" ], sort_function = lambda x : x . get ( \"roster_position\" ) . position ) def get_league_key ( self , season : int = None ) -> str : \"\"\"Retrieve league key for selected league. Args: season (int): User defined season/year for which to retrieve the Yahoo Fantasy Sports league key. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_key(2021) 331.l.729259 Returns: str: League key string for selected league. \"\"\" if not self . league_key : if season : return f \" { self . get_game_key_by_season ( season ) } .l. { self . league_id } \" elif self . game_id : return f \" { self . get_game_metadata_by_game_id ( self . game_id ) . game_key } .l. { self . league_id } \" else : logger . warning ( \"No game id or season/year provided, defaulting to current fantasy season.\" ) return f \" { self . get_current_game_metadata () . game_key } .l. { self . league_id } \" else : return self . league_key def get_current_user ( self ) -> User : \"\"\"Retrieve metadata for current logged-in user. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_current_user() User({ \"guid\": \"USER_GUID_STRING\" }) Returns: User: YFPY User instance. \"\"\" return self . query ( \"https://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/\" , [ \"users\" , \"0\" , \"user\" ], User ) def get_user_games ( self ) -> List [ Game ]: \"\"\"Retrieve game history for current logged-in user sorted by season/year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_user_games() [ Game({ \"code\": \"nfl\", \"game_id\": \"359\", \"game_key\": \"359\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"2016\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2016\" }) ..., Game({...}) ] Returns: list[Game]: List of YFPY Game instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/games;codes= { self . game_code } /\" , [ \"users\" , \"0\" , \"user\" , \"games\" ], sort_function = lambda x : x . get ( \"game\" ) . season ) def get_user_leagues_by_game_key ( self , game_key : Union [ int , str ]) -> List [ League ]: \"\"\"Retrieve league history for current logged-in user for specific game by game IDs/keys sorted by season/year. Args: game_key (int | str): The game_id (int) or game_key (str) for a specific Yahoo Fantasy game. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_user_leagues_by_game_key(331) [ League({ \"allow_add_to_dl_extra_pos\": 0, \"current_week\": \"16\", \"draft_status\": \"postdraft\", \"edit_key\": \"16\", \"end_date\": \"2018-12-24\", \"end_week\": \"16\", \"game_code\": \"nfl\", \"iris_group_chat_id\": \"\", \"is_cash_league\": \"0\", \"is_finished\": 1, \"is_pro_league\": \"0\", \"league_id\": \"169896\", \"league_key\": \"380.l.169896\", \"league_type\": \"private\", \"league_update_timestamp\": \"1546498723\", \"logo_url\": \"\", \"name\": \"League Name\", \"num_teams\": 12, \"password\": null, \"renew\": \"371_52364\", \"renewed\": \"390_78725\", \"scoring_type\": \"head\", \"season\": \"2018\", \"short_invitation_url\": \"\", \"start_date\": \"2018-09-06\", \"start_week\": \"1\", \"url\": \"\", \"weekly_deadline\": null }), ..., League({...}) ] Returns: list[League]: List of YFPY League instances. \"\"\" leagues = self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/games;game_keys= { game_key } /leagues/\" , [ \"users\" , \"0\" , \"user\" , \"games\" , \"0\" , \"game\" , \"leagues\" ], sort_function = lambda x : x . get ( \"league\" ) . season ) return leagues if isinstance ( leagues , list ) else [ leagues . get ( \"league\" )] def get_user_teams ( self ) -> List [ Game ]: \"\"\"Retrieve teams for all leagues for current logged-in user for current game sorted by season/year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_user_teams() [ Game({ \"code\": \"nfl\", \"game_id\": \"359\", \"game_key\": \"359\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"2016\", \"teams\": [ { \"team\": { \"draft_grade\": \"A\", \"draft_position\": 9, \"draft_recap_url\": \"\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": [ { \"manager\": { \"email\": \"\", \"guid\": \"\", \"image_url\": \"\", \"is_comanager\": \"1\", \"manager_id\": \"14\", \"nickname\": \"\" } } ], \"name\": \"Legion\", \"number_of_moves\": \"48\", \"number_of_trades\": \"2\", \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"1\", \"team_key\": \"359.l.5521.t.1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"\" } }, \"url\": \"\", \"waiver_priority\": 11 } } ], \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2016\" }) ..., Game({...}) ] Returns: list[Game]: List of YFPY Game instances with \"teams\" attribute containing list of YFPY Team instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/games;codes= { self . game_code } /teams/\" , [ \"users\" , \"0\" , \"user\" , \"games\" ], sort_function = lambda x : x . get ( \"game\" ) . season ) def get_league_info ( self ) -> League : \"\"\"Retrieve info for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_info() League({ \"allow_add_to_dl_extra_pos\": 0, \"current_week\": \"16\", \"draft_status\": \"postdraft\", \"edit_key\": \"16\", \"end_date\": \"2014-12-22\", \"end_week\": \"16\", \"game_code\": \"nfl\", \"iris_group_chat_id\": null, \"is_cash_league\": \"0\", \"is_finished\": 1, \"is_pro_league\": \"1\", \"league_id\": \"729259\", \"league_key\": \"331.l.729259\", \"league_type\": \"public\", \"league_update_timestamp\": \"1420099793\", \"logo_url\": \"https://s.yimg.com/cv/api/default/20180206/default-league-logo@2x.png\", \"name\": \"Yahoo Public 729259\", \"num_teams\": 10, \"renew\": null, \"renewed\": null, \"scoreboard\": { \"week\": \"16\", \"matchups\": [ ... ] }, \"scoring_type\": \"head\", \"season\": \"2014\", \"settings\": { ... }, \"standings\": { \"teams\": [ ..., ... ], ... }, \"start_date\": \"2014-09-04\", \"start_week\": \"1\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259\", \"weekly_deadline\": null }) Returns: League: YFPY League instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } ;\" f \"out=metadata,settings,standings,scoreboard,teams,players,draftresults,transactions\" , [ \"league\" ], League ) def get_league_metadata ( self ) -> League : \"\"\"Retrieve metadata for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_metadata() League({ \"allow_add_to_dl_extra_pos\": 0, \"current_week\": \"16\", \"draft_status\": \"postdraft\", \"edit_key\": \"16\", \"end_date\": \"2014-12-22\", \"end_week\": \"16\", \"game_code\": \"nfl\", \"iris_group_chat_id\": null, \"is_cash_league\": \"0\", \"is_finished\": 1, \"is_pro_league\": \"1\", \"league_id\": \"729259\", \"league_key\": \"331.l.729259\", \"league_type\": \"public\", \"league_update_timestamp\": \"1420099793\", \"logo_url\": \"https://s.yimg.com/cv/api/default/20180206/default-league-logo@2x.png\", \"name\": \"Yahoo Public 729259\", \"num_teams\": 10, \"renew\": null, \"renewed\": null, \"scoring_type\": \"head\", \"season\": \"2014\", \"start_date\": \"2014-09-04\", \"start_week\": \"1\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259\", \"weekly_deadline\": null }) Returns: League: YFPY League instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /metadata\" , [ \"league\" ], League ) def get_league_settings ( self ) -> Settings : \"\"\"Retrieve settings (rules) for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_settings() Settings({ \"cant_cut_list\": \"yahoo\", \"draft_time\": \"1408410000\", \"draft_type\": \"live\", \"has_multiweek_championship\": 0, \"has_playoff_consolation_games\": true, \"is_auction_draft\": \"0\", \"max_teams\": \"10\", \"num_playoff_consolation_teams\": 4, \"num_playoff_teams\": \"4\", \"pickem_enabled\": \"1\", \"player_pool\": \"ALL\", \"playoff_start_week\": \"15\", \"post_draft_players\": \"W\", \"roster_positions\": [ { \"roster_position\": { \"count\": 1, \"position\": \"QB\", \"position_type\": \"O\" } }, ... ], \"scoring_type\": \"head\", \"stat_categories\": { \"stats\": [ { \"stat\": { \"display_name\": \"Pass Yds\", \"enabled\": \"1\", \"name\": \"Passing Yards\", \"position_type\": \"O\", \"sort_order\": \"1\", \"stat_id\": 4, \"stat_position_types\": { \"stat_position_type\": { \"position_type\": \"O\" } } } }, ... ] }, \"stat_modifiers\": { \"stats\": [ { \"stat\": { \"stat_id\": 4, \"value\": \"0.04\" } }, ... ] }, \"trade_end_date\": \"2014-11-14\", \"trade_ratify_type\": \"yahoo\", \"trade_reject_time\": \"2\", \"uses_faab\": \"0\", \"uses_fractional_points\": \"1\", \"uses_lock_eliminated_teams\": 1, \"uses_negative_points\": \"1\", \"uses_playoff\": \"1\", \"uses_playoff_reseeding\": 0, \"waiver_rule\": \"gametime\", \"waiver_time\": \"2\", \"waiver_type\": \"R\" }) Returns: Settings: YFPY Settings instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /settings\" , [ \"league\" , \"settings\" ], Settings ) def get_league_standings ( self ) -> Standings : \"\"\"Retrieve standings for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_standings() Standings({ \"teams\": [ { \"team\": { \"clinched_playoffs\": 1, \"draft_grade\": \"C+\", \"draft_position\": 7, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/8/draftrecap\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"PMTCFWSK5U5LI4SKWREUR56B5A\", \"manager_id\": \"8\", \"nickname\": \"--hidden--\" } }, \"name\": \"clam dam\", \"number_of_moves\": \"27\", \"number_of_trades\": 0, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"8\", \"team_key\": \"331.l.729259.t.8\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://s.yimg.com/cv/apiv2/default/nfl/nfl_1.png\" } }, \"team_points\": { \"coverage_type\": \"season\", \"season\": \"2014\", \"total\": \"1507.06\" }, \"team_standings\": { \"outcome_totals\": { \"losses\": 2, \"percentage\": 0.857, \"ties\": 0, \"wins\": 12 }, \"playoff_seed\": \"1\", \"points_against\": 1263.78, \"points_for\": 1507.06, \"rank\": 1, \"streak\": { \"type\": \"win\", \"value\": \"2\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/8\", \"waiver_priority\": 10 } }, ... ] }) Returns: Standings: YFPY Standings instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /standings\" , [ \"league\" , \"standings\" ], Standings ) def get_league_teams ( self ) -> List [ Team ]: \"\"\"Retrieve teams for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_teams() [ Team({ \"clinched_playoffs\": 1, \"draft_grade\": \"B\", \"draft_position\": 4, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1/draftrecap\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"BMACD7S5UXV7JIQX4PGGUVQJAU\", \"manager_id\": \"1\", \"nickname\": \"--hidden--\" } }, \"name\": \"Hellacious Hill 12\", \"number_of_moves\": \"71\", \"number_of_trades\": 0, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"1\", \"team_key\": \"331.l.729259.t.1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1441/24935131299_a8242dab70_192sq.jpg?ct=fantasy\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1\", \"waiver_priority\": 9 }), ..., Team({...}) ] Returns: list[Team]: List of YFPY Team instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /teams\" , [ \"league\" , \"teams\" ] ) def get_league_players ( self , player_count_limit : int = None , player_count_start : int = 0 , is_retry : bool = False ) -> List [ Player ]: \"\"\"Retrieve valid players for chosen league. Args: player_count_limit (int): Maximum number of players to retreive. player_count_start (int): Index from which to retrieve all subsequent players. is_retry (bool): Boolean to indicate whether the method is being retried during error handling. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_players(50, 25) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"K\", \"editorial_player_key\": \"nfl.p.3727\", \"editorial_team_abbr\": \"Ind\", \"editorial_team_full_name\": \"Indianapolis Colts\", \"editorial_team_key\": \"nfl.t.11\", \"eligible_positions\": { \"position\": \"K\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/OpHvpCHjl_PQvkeQUgsjsA--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt 3PTQ2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08152019/3727.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Adam\", \"ascii_last\": \"Vinatieri\", \"first\": \"Adam\", \"full\": \"Adam Vinatieri\", \"last\": \"Vinatieri\" }, \"player_id\": \"3727\", \"player_key\": \"331.p.3727\", \"player_notes_last_timestamp\": 1568758320, \"position_type\": \"K\", \"primary_position\": \"K\", \"uniform_number\": \"4\" }), ..., Player({...}) ] Returns: list[Player]: List of YFPY Player instances. \"\"\" league_player_count = player_count_start all_players_retrieved = False league_player_data = [] league_player_retrieval_limit = 25 while not all_players_retrieved : try : league_player_query_data = self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"start= { league_player_count } ;count= { league_player_retrieval_limit if not is_retry else 1 } \" , [ \"league\" , \"players\" ] ) league_players = ( league_player_query_data if isinstance ( league_player_query_data , list ) else [ league_player_query_data ]) league_player_count_from_query = len ( league_players ) if player_count_limit : if ( league_player_count + league_player_count_from_query ) < player_count_limit : league_player_count += league_player_count_from_query league_player_data . extend ( league_players ) else : for ndx in range ( player_count_limit - league_player_count ): league_player_data . append ( league_players [ ndx ]) league_player_count += ( player_count_limit - league_player_count ) all_players_retrieved = True else : league_player_count += league_player_count_from_query league_player_data . extend ( league_players ) except YahooFantasySportsDataNotFound as yfpy_err : if not is_retry : payload = yfpy_err . payload if payload : logger . debug ( \"No more league player data available.\" ) all_players_retrieved = True else : logger . warning ( f \"Error retrieving player batch: \" f \" { league_player_count } - { league_player_count + league_player_retrieval_limit - 1 } . \" f \"Attempting to retrieve individual players from batch.\" ) player_retrieval_successes = [] player_retrieval_failures = [] for i in range ( 25 ): try : player_data = self . get_league_players ( player_count_limit = league_player_count + 1 , player_count_start = league_player_count , is_retry = True ) player_retrieval_successes . extend ( player_data ) except YahooFantasySportsDataNotFound as nested_yfpy_err : player_retrieval_failures . append ( { \"failed_player_retrieval_index\" : league_player_count , \"failed_player_retrieval_url\" : nested_yfpy_err . url , \"failed_player_retrieval_message\" : nested_yfpy_err . message } ) league_player_count += 1 league_player_data . extend ( player_retrieval_successes ) logger . warning ( f \"Players retrieval failures: \\n { prettify_data ( player_retrieval_failures ) } \" ) else : raise yfpy_err logger . debug ( f \"League player count: { league_player_count } \" ) return league_player_data def get_league_draft_results ( self ) -> List [ DraftResult ]: \"\"\"Retrieve draft results for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_draft_results() [ DraftResult({ \"pick\": 1, \"round\": 1, \"team_key\": \"331.l.729259.t.4\", \"player_key\": \"331.p.9317\" }), ..., DraftResult({...}) ] Returns: list[DraftResult]: List of YFPY DraftResult instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /draftresults\" , [ \"league\" , \"draft_results\" ] ) def get_league_transactions ( self ) -> List [ Transaction ]: \"\"\"Retrieve transactions for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_transactions() [ Transaction({ \"players\": [ { \"player\": { \"display_position\": \"RB\", \"editorial_team_abbr\": \"NO\", \"name\": { \"ascii_first\": \"Kerwynn\", \"ascii_last\": \"Williams\", \"first\": \"Kerwynn\", \"full\": \"Kerwynn Williams\", \"last\": \"Williams\" }, \"player_id\": \"26853\", \"player_key\": \"331.p.26853\", \"position_type\": \"O\", \"transaction_data\": { \"destination_team_key\": \"331.l.729259.t.1\", \"destination_team_name\": \"Hellacious Hill 12\", \"destination_type\": \"team\", \"source_type\": \"freeagents\", \"type\": \"add\" } } } ], \"status\": \"successful\", \"timestamp\": \"1419188151\", \"transaction_id\": \"282\", \"transaction_key\": \"331.l.729259.tr.282\", \"type\": \"add/drop\" }), ..., Transaction({...}) ] Returns: list[Transaction]: List of YFPY Transaction instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /transactions\" , [ \"league\" , \"transactions\" ] ) def get_league_scoreboard_by_week ( self , chosen_week : int ) -> Scoreboard : \"\"\"Retrieve scoreboard for chosen league by week. Args: chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_scoreboard_by_week(1) Scoreboard({ \"week\": \"1\", \"matchups\": [ { \"matchup\": { \"is_consolation\": \"0\", \"is_matchup_recap_available\": 1, \"is_playoffs\": \"0\", \"is_tied\": 0, \"matchup_grades\": [ { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.1\" } }, { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.2\" } } ], \"matchup_recap_title\": \"Wax On Wax Off Gets Victory Against Hellacious Hill 12\", \"matchup_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/recap? week=1&mid1=1&mid2=2\", \"status\": \"postevent\", \"teams\": [ { \"team\": { } }, { \"team\": { } } ], \"week\": \"1\", \"week_end\": \"2014-09-08\", \"week_start\": \"2014-09-04\", \"winner_team_key\": \"331.l.729259.t.2\" } }, ... ] }) Returns: Scoreboard: YFPY Scoreboard instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /scoreboard;\" f \"week= { chosen_week } \" , [ \"league\" , \"scoreboard\" ], Scoreboard ) def get_league_matchups_by_week ( self , chosen_week : int ) -> List [ Matchup ]: \"\"\"Retrieve matchups for chosen league by week. Args: chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_matchups_by_week(1) [ Matchup({ \"is_consolation\": \"0\", \"is_matchup_recap_available\": 1, \"is_playoffs\": \"0\", \"is_tied\": 0, \"matchup_grades\": [ { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.1\" } }, { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.2\" } } ], \"matchup_recap_title\": \"Wax On Wax Off Gets Victory Against Hellacious Hill 12\", \"matchup_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/recap? week=1&mid1=1&mid2=2\", \"status\": \"postevent\", \"teams\": [ { \"team\": { } }, { \"team\": { } } ], \"week\": \"1\", \"week_end\": \"2014-09-08\", \"week_start\": \"2014-09-04\", \"winner_team_key\": \"331.l.729259.t.2\" }), ..., Matchup({...}) ] Returns: list[Matchup]: List of YFPY Matchup instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /scoreboard;\" f \"week= { chosen_week } \" , [ \"league\" , \"scoreboard\" , \"0\" , \"matchups\" ] ) def get_team_info ( self , team_id : Union [ str , int ]) -> Team : \"\"\"Retrieve info of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_info(1) Team({ \"clinched_playoffs\": 1, \"draft_grade\": \"B\", \"draft_position\": 4, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1/draftrecap\", \"draft_results\": [ ... ], \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"BMACD7S5UXV7JIQX4PGGUVQJAU\", \"manager_id\": \"1\", \"nickname\": \"--hidden--\" } }, \"matchups\": [ ... ], \"name\": \"Hellacious Hill 12\", \"number_of_moves\": \"71\", \"number_of_trades\": 0, \"roster\": { ... }, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"1\", \"team_key\": \"331.l.729259.t.1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1441/24935131299_a8242dab70_192sq.jpg?ct=fantasy\" } }, \"team_points\": { \"coverage_type\": \"season\", \"season\": \"2014\", \"total\": \"1409.24\" }, \"team_standings\": { \"outcome_totals\": { \"losses\": 5, \"percentage\": 0.643, \"ties\": 0, \"wins\": 9 }, \"playoff_seed\": \"2\", \"points_against\": 1266.6599999999999, \"points_for\": 1409.24, \"rank\": 2, \"streak\": { \"type\": \"win\", \"value\": \"1\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1\", \"waiver_priority\": 9 }) Returns: Team: YFPY Team instance. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } ;\" f \"out=metadata,stats,standings,roster,draftresults,matchups\" , [ \"team\" ], Team ) def get_team_metadata ( self , team_id : Union [ str , int ]) -> Team : \"\"\"Retrieve metadata of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_metadata(1) Team({ \"team_key\": \"331.l.729259.t.1\", \"team_id\": \"1\", \"name\": \"Hellacious Hill 12\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1441/24935131299_a8242dab70_192sq.jpg?ct=fantasy\" } }, \"waiver_priority\": 9, \"number_of_moves\": \"71\", \"number_of_trades\": 0, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"clinched_playoffs\": 1, \"league_scoring_type\": \"head\", \"draft_position\": 4, \"has_draft_grade\": 1, \"draft_grade\": \"B\", \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1/draftrecap\", \"managers\": { \"manager\": { \"guid\": \"BMACD7S5UXV7JIQX4PGGUVQJAU\", \"manager_id\": \"1\", \"nickname\": \"--hidden--\" } } }) Returns: Team: YFPY Team instance. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /metadata\" , [ \"team\" ], Team ) def get_team_stats ( self , team_id : Union [ str , int ]) -> TeamPoints : \"\"\"Retrieve stats of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_stats(1) TeamPoints({ \"coverage_type\": \"season\", \"season\": \"2014\", \"total\": \"1409.24\" }) Returns: TeamPoints: YFPY TeamPoints instance. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /stats\" , [ \"team\" , \"team_points\" ], TeamPoints ) def get_team_stats_by_week ( self , team_id : Union [ str , int ], chosen_week : Union [ int , str ] = \"current\" ) -> Dict [ str , Union [ TeamPoints , TeamProjectedPoints ]]: \"\"\"Retrieve stats of specific team by team_id and by week for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_stats_by_week(1, 1) { \"team_points\": TeamPoints({ \"coverage_type\": \"week\", \"total\": \"95.06\", \"week\": \"1\" }), \"team_projected_points\": TeamProjectedPoints({ \"coverage_type\": \"week\", \"total\": \"78.85\", \"week\": \"1\" }) } Returns: dict[str, TeamPoints | TeamProjectedPoints]: Dictionary containing keys \"team_points\" and \"team_projected_points\" with respective values YFPY TeamPoints and YFPY TeamProjectedPoints instances. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /stats;type=week;week= { chosen_week } \" , [ \"team\" , [ \"team_points\" , \"team_projected_points\" ]] ) def get_team_standings ( self , team_id : Union [ str , int ]) -> TeamStandings : \"\"\"Retrieve standings of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_standings(1) TeamStandings({ \"rank\": 2, \"playoff_seed\": \"2\", \"outcome_totals\": { \"losses\": 5, \"percentage\": 0.643, \"ties\": 0, \"wins\": 9 }, \"streak\": { \"type\": \"win\", \"value\": \"1\" }, \"points_for\": \"1409.24\", \"points_against\": 1266.6599999999999 }) Returns: TeamStandings: YFPY TeamStandings instance. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /standings\" , [ \"team\" , \"team_standings\" ], TeamStandings ) def get_team_roster_by_week ( self , team_id : Union [ str , int ], chosen_week : Union [ int , str ] = \"current\" ) -> Roster : \"\"\"Retrieve roster of specific team by team_id and by week for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_roster_by_week(1, 1) Roster({ \"coverage_type\": \"week\", \"week\": \"1\", \"is_editable\": 0, \"players\": [ { \"player\": { \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt 3PTQ2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"1\" }, \"uniform_number\": \"12\" } }, ... ] }) Returns: Roster: YFPY Roster instance. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /roster;week= { chosen_week } \" , [ \"team\" , \"roster\" ], Roster ) def get_team_roster_player_info_by_week ( self , team_id : Union [ str , int ], chosen_week : Union [ int , str ] = \"current\" ) -> List [ Player ]: \"\"\"Retrieve roster with ALL player info of specific team by team_id and by week for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_roster_player_info_by_week(1, 1) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"draft_analysis\": { \"average_pick\": \"65.9\", \"average_round\": \"7.6\", \"average_cost\": \"5.0\", \"percent_drafted\": \"1.00\" }, \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/ https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"ownership\": { \"ownership_type\": \"team\", \"owner_team_key\": \"331.l.729259.t.1\", \"owner_team_name\": \"Hellacious Hill 12\" }, \"percent_owned\": { \"coverage_type\": \"week\", \"week\": \"17\", \"value\": 99, \"delta\": \"0\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"player_points\": { \"coverage_type\": \"week\", \"week\": \"1\", \"total\": 10.26 }, \"player_stats\": { \"coverage_type\": \"week\", \"week\": \"1\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"249\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"1\" }, \"uniform_number\": \"12\" }), ..., Player({...}) ] Returns: list[Player]: List of YFPY Player instances containing attributes \"draft_analysis\", \"ownership\", \"percent_owned\", and \"player_stats\". \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /roster;week= { chosen_week } /players;\" f \"out=metadata,stats,ownership,percent_owned,draft_analysis\" , [ \"team\" , \"roster\" , \"0\" , \"players\" ] ) def get_team_roster_player_info_by_date ( self , team_id : Union [ str , int ], chosen_date : str = None ) -> List [ Player ]: \"\"\"Retrieve roster with ALL player info of specific team by team_id and by date for chosen league. Note: This applies to MLB, NBA, and NHL leagues, but does NOT apply to NFL leagues. This query will FAIL if you pass it an INVALID date string! Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_date (str): Selected date for which to retrieve data. REQUIRED FORMAT: YYYY-MM-DD (Ex. 2011-05-01) Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nhl\") >>> query.get_team_roster_player_info_by_date(1, \"2011-05-01\") [ Player({ \"display_position\": \"C\", \"draft_analysis\": { \"average_pick\": 33.2, \"average_round\": 3.5, \"average_cost\": 39.2, \"percent_drafted\": 1.0 }, \"editorial_player_key\": \"nhl.p.3981\", \"editorial_team_abbr\": \"Chi\", \"editorial_team_full_name\": \"Chicago Blackhawks\", \"editorial_team_key\": \"nhl.t.4\", \"eligible_positions\": [ \"C\", \"F\" ], \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/tz.KOMoEiBDch6AJAGaUtg--~C/ YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/ https://s.yimg.com/xe/i/us/sp/v/nhl_cutout/players_l/11032021/3981.png\" }, \"is_editable\": 0, \"is_undroppable\": 0, \"name\": { \"ascii_first\": \"Jonathan\", \"ascii_last\": \"Toews\", \"first\": \"Jonathan\", \"full\": \"Jonathan Toews\", \"last\": \"Toews\" }, \"ownership\": { \"ownership_type\": \"team\", \"owner_team_key\": \"303.l.69624.t.2\", \"owner_team_name\": \"The Bateleurs\" }, \"percent_owned\": { \"coverage_type\": \"week\", \"week\": 25, \"value\": 98, \"delta\": -1.0 }, \"player_id\": 3981, \"player_key\": \"303.p.3981\", \"player_notes_last_timestamp\": 1651606838, \"player_stats\": { \"coverage_type\": \"date\", \"stats\": [ { \"stat\": { \"stat_id\": 1, \"value\": 1.0 } }, ... ] }, \"position_type\": \"P\", \"primary_position\": \"C\", \"selected_position\": { \"coverage_type\": \"date\", \"is_flex\": 0, \"position\": \"C\" }, \"uniform_number\": 19 }), ..., Player({...}) ] Returns: list[Player]: List of YFPY Player instances containing attributes \"draft_analysis\", \"ownership\", \"percent_owned\", and \"player_stats\". \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /\" f \"roster { ';date=' + str ( chosen_date ) if chosen_date else '' } /players;\" f \"out=metadata,stats,ownership,percent_owned,draft_analysis\" , [ \"team\" , \"roster\" , \"0\" , \"players\" ] ) def get_team_roster_player_stats ( self , team_id : Union [ str , int ]) -> List [ Player ]: \"\"\"Retrieve roster with ALL player info for the season of specific team by team_id and for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_roster_player_stats(1) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"draft_analysis\": { \"average_pick\": \"65.9\", \"average_round\": \"7.6\", \"average_cost\": \"5.0\", \"percent_drafted\": \"1.00\" }, \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"player_points\": { \"coverage_type\": \"season\", \"total\": 287.06 }, \"player_stats\": { \"coverage_type\": \"season\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"4109\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"16\" }, \"uniform_number\": \"12\" }), ..., Player({...}) ] Returns: list[Player]: List of YFPY Player instances containing attributes \"draft_analysis\", \"ownership\", \"percent_owned\", and \"player_stats\". \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /roster/players/stats;type=season\" , [ \"team\" , \"roster\" , \"0\" , \"players\" ] ) def get_team_roster_player_stats_by_week ( self , team_id : Union [ str , int ], chosen_week : Union [ int , str ] = \"current\" ) -> List [ Player ]: \"\"\"Retrieve roster with player stats of specific team by team_id and by week for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_roster_player_stats_by_week(1, 1) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt 3PTQ2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"player_points\": { \"coverage_type\": \"week\", \"week\": \"1\", \"total\": 10.26 }, \"player_stats\": { \"coverage_type\": \"week\", \"week\": \"1\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"249\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"1\" }, \"uniform_number\": \"12\" }), ..., Player({...}) ] Returns: list[Player]: List of YFPY Player instances containing attribute \"player_stats\". \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /roster;week= { chosen_week } /players/stats\" , [ \"team\" , \"roster\" , \"0\" , \"players\" ] ) def get_team_draft_results ( self , team_id : Union [ str , int ]) -> List [ DraftResult ]: \"\"\"Retrieve draft results of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_draft_results(1) [ DraftResult({ \"pick\": 4, \"round\": 1, \"team_key\": \"331.l.729259.t.1\", \"player_key\": \"331.p.8256\" }), ..., DraftResults({...}) ] Returns: list[DraftResult]: List of YFPY DraftResult instances. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /draftresults\" , [ \"team\" , \"draft_results\" ] ) def get_team_matchups ( self , team_id : Union [ str , int ]) -> List [ Matchup ]: \"\"\"Retrieve matchups of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_matchups(1) [ Matchup({ (see get_league_matchups_by_week docstring for matchup data example) }) ] Returns: list[Matchup]: List of YFPY Matchup instances. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /matchups\" , [ \"team\" , \"matchups\" ] ) def get_player_stats_for_season ( self , player_key : str , limit_to_league_stats : bool = True ) -> Player : \"\"\"Retrieve stats of specific player by player_key for the entire season for chosen league. Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). limit_to_league_stats (bool): Boolean (default: True) to limit the retrieved player stats to those for the selected league. When set to False, query retrieves all player stats for the game (NFL, NHL, NBA, MLB). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_player_stats_for_season(\"331.p.7200\") Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"player_points\": { \"coverage_type\": \"season\", \"total\": 359.14 }, \"player_stats\": { \"coverage_type\": \"season\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"4381\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player: YFPY Player instance. \"\"\" if limit_to_league_stats : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /stats\" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player ) else : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/players;\" f \"player_keys= { player_key } /stats\" , [ \"players\" , \"0\" , \"player\" ], Player ) def get_player_stats_by_week ( self , player_key : str , chosen_week : Union [ int , str ] = \"current\" , limit_to_league_stats : bool = True ) -> Player : \"\"\"Retrieve stats of specific player by player_key and by week for chosen league. Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). chosen_week (int): Selected week for which to retrieve data. limit_to_league_stats (bool): Boolean (default: True) to limit the retrieved player stats to those for the selected league. When set to False, query retrieves all player stats for the game (NFL, NHL, NBA, MLB). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_player_stats_by_week(\"331.p.7200\", 1) Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"player_points\": { \"coverage_type\": \"week\", \"week\": \"1\", \"total\": 10.56 }, \"player_stats\": { \"coverage_type\": \"week\", \"week\": \"1\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"189\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player: YFPY Player instance containing attribute \"player_stats\". \"\"\" if limit_to_league_stats : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /stats;type=week;week= { chosen_week } \" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player ) else : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/players;\" f \"player_keys= { player_key } /stats;type=week;week= { chosen_week } \" , [ \"players\" , \"0\" , \"player\" ], Player ) def get_player_stats_by_date ( self , player_key : str , chosen_date : str = None , limit_to_league_stats : bool = True ) -> Player : \"\"\"Retrieve player stats by player_key and by date for chosen league. Note: This applies to MLB, NBA, and NHL leagues, but does NOT apply to NFL leagues. This query will FAIL if you pass it an INVALID date string! Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). chosen_date (str): Selected date for which to retrieve data. REQUIRED FORMAT: YYYY-MM-DD (Ex. 2011-05-01) limit_to_league_stats (bool): Boolean (default: True) to limit the retrieved player stats to those for the selected league. When set to False, query retrieves all player stats for the game (NFL, NHL, NBA, MLB). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nhl\") >>> query.get_player_stats_by_date(\"nhl.p.4588\", \"2011-05-01\") Player({ \"display_position\": \"G\", \"editorial_player_key\": \"nhl.p.4588\", \"editorial_team_abbr\": \"Was\", \"editorial_team_full_name\": \"Washington Capitals\", \"editorial_team_key\": \"nhl.t.23\", \"eligible_positions\": { \"position\": \"G\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/CzntDh_d59voTqU6fhQy3g--~C/YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2 NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/https://s.yimg.com/ xe/i/us/sp/v/nhl_cutout/players_l/10182019/4588.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Braden\", \"ascii_last\": \"Holtby\", \"first\": \"Braden\", \"full\": \"Braden Holtby\", \"last\": \"Holtby\" }, \"player_id\": \"4588\", \"player_key\": \"303.p.4588\", \"player_notes_last_timestamp\": 1574133600, \"player_stats\": { \"coverage_type\": \"date\", \"stats\": [ { \"stat\": { \"stat_id\": \"19\", \"value\": \"1\" } }, { \"stat\": { \"stat_id\": \"22\", \"value\": \"1\" } }, { \"stat\": { \"stat_id\": \"23\", \"value\": \"1.00\" } }, { \"stat\": { \"stat_id\": \"25\", \"value\": \"29\" } }, { \"stat\": { \"stat_id\": \"24\", \"value\": \"30\" } }, { \"stat\": { \"stat_id\": \"26\", \"value\": \".967\" } }, { \"stat\": { \"stat_id\": \"27\", \"value\": \"0\" } } ] }, \"position_type\": \"G\", \"primary_position\": \"G\", \"uniform_number\": \"70\" }) Returns: Player: YFPY Player instnace containing attribute \"player_stats\". \"\"\" if limit_to_league_stats : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /stats;type=date;date= { chosen_date } \" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player ) else : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/players;\" f \"player_keys= { player_key } /stats;type=date;date= { chosen_date } \" , [ \"players\" , \"0\" , \"player\" ], Player ) def get_player_ownership ( self , player_key : str ) -> Player : \"\"\"Retrieve ownership of specific player by player_key for chosen league. Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_player_ownership(\"331.p.7200\") Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"ownership\": { \"ownership_type\": \"team\", \"owner_team_key\": \"331.l.729259.t.4\", \"owner_team_name\": \"hold my D\", \"teams\": { \"team\": { \"clinched_playoffs\": 1, \"draft_grade\": \"B-\", \"draft_position\": 1, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/4/draftrecap\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"5KLNXUYW5RP22UMRKUXHBCIITI\", \"manager_id\": \"4\", \"nickname\": \"--hidden--\" } }, \"name\": \"hold my D\", \"number_of_moves\": \"27\", \"number_of_trades\": \"1\", \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"4\", \"team_key\": \"331.l.729259.t.4\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1589/24677593583_68859308dd_192sq.jpg?ct=fantasy\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/4\", \"waiver_priority\": 7 } } }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player: YFPY Player instance containing attribute \"ownership\". \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /ownership\" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player ) def get_player_percent_owned_by_week ( self , player_key : str , chosen_week : Union [ int , str ] = \"current\" ) -> Player : \"\"\"Retrieve percent-owned of specific player by player_key and by week for chosen league. Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_player_percent_owned_by_week(\"331.p.7200\", 1) Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/ https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"percent_owned\": { \"coverage_type\": \"week\", \"week\": \"1\", \"value\": 100, \"delta\": \"0\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player: YFPY Player instance containing attribute \"percent_owned\". \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /percent_owned;type=week;week= { chosen_week } \" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player ) def get_player_draft_analysis ( self , player_key : str ) -> Player : \"\"\"Retrieve draft analysis of specific player by player_key for chosen league. Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_player_draft_analysis(\"331.p.7200\") Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"draft_analysis\": { \"average_pick\": \"19.9\", \"average_round\": \"2.8\", \"average_cost\": \"38.5\", \"percent_drafted\": \"1.00\" }, \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player: YFPY Player instance containing attribute \"draft_analysis\". \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /draft_analysis\" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player )","title":"YahooFantasySportsQuery"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.__init__","text":"__init__ ( league_id , game_code , game_id = None , yahoo_consumer_key = None , yahoo_consumer_secret = None , yahoo_access_token_json = None , env_var_fallback = True , env_file_location = None , save_token_data_to_env_file = False , all_output_as_json_str = False , browser_callback = not runtime_environment_is_docker , retries = 3 , backoff = 0 , offline = False , ) Instantiate a YahooQueryObject for running queries against the Yahoo fantasy REST API. Parameters: league_id ( str ) \u2013 League ID of selected Yahoo Fantasy league. game_code ( str ) \u2013 Game code of selected Yahoo Fantasy game corresponding to a specific sport (refers to the current season if used as the value for game_key), where \"nfl\" is for fantasy football, \"nhl\" is for fantasy hockey, \"mlb\" is for fantasy baseball, and \"nba\" is for fantasy basketball. game_id \u2013 obj: int , optional): Game ID of selected Yahoo fantasy game corresponding to a specific year, and defaulting to the game ID for the current year. yahoo_consumer_key \u2013 obj: str , optional): User defined Yahoo developer app consumer key (must be provided in conjunction with yahoo_consumer_secret). yahoo_consumer_secret \u2013 obj: str , optional): User defined Yahoo developer app consumer secret (must be provided in conjunction with yahoo_consumer_key). yahoo_access_token_json ( str | dict , default: None ) \u2013 User defined JSON (string or dict) containing refreshable access token generated by the yahoo-oauth library to avoid having to reauthenticate on every access to the Yahoo Fantasy Sports API (overrides yahoo_consumer_key/yahoo_consumer_secret and all Yahoo access token environment variables). env_var_fallback \u2013 obj: bool , optional): Fall back to values retrieved from environment variables for any missing arguments or access token fields (defaults to True). env_file_location \u2013 obj: Path , optional): Path to directory where existing .env file is located or new .env file should be generated when provided in conjunction with save_access_token_data_to_env_file=True (defaults to None). save_token_data_to_env_file \u2013 obj: bool , optional): Boolean to save Yahoo access token data to local .env file (must be provided in conjunction with env_file_location) (defaults to False) all_output_as_json_str \u2013 obj: bool , optional): Option to automatically convert all query output to JSON strings. browser_callback \u2013 obj: bool , optional): Enable or disable (enabled by default) whether the yahoo-oauth library automatically opens a browser window to authenticate (if disabled, it will output the callback URL). retries \u2013 obj: int , optional): Number of times to retry a query if it fails (defaults to 3). backoff \u2013 obj: int , optional): Multiplier that incrementally increases the wait time before retrying a failed query request. offline \u2013 obj: bool , optional): Boolean to run in offline mode (Only works if all needed Yahoo Fantasy data has been previously saved locally using the Data module in data.py). Attributes: _env_var_fallback ( bool ) \u2013 Fall back to values retrieved from environment variables for any missing arguments or access token fields. _yahoo_access_token_dict ( dict [ str , Any ] ) \u2013 Dictionary containing refreshable access token data generated by the yahoo-oauth library to avoid having to reauthenticate on every access to the Yahoo Fantasy Sports API. _yahoo_consumer_key ( str ) \u2013 User defined Yahoo developer app consumer key. _yahoo_consumer_secret ( str ) \u2013 User defined Yahoo developer app consumer secret. _browser_callback ( bool ) \u2013 Enable or disable (enabled by default) whether the yahoo-oauth library automatically opens a browser window to authenticate (if disabled, it will output the callback URL). _retries ( int ) \u2013 Number of times to retry a query if it fails (defaults to 3). _backoff ( int ) \u2013 Multiplier that incrementally increases the wait time before retrying a failed query request. _fantasy_content_data_field ( str ) \u2013 The initial JSON field in which all Yahoo Fantasy Sports API responses store the data output of the submitted query. league_id ( str ) \u2013 League ID of selected Yahoo Fantasy league. game_code ( str ) \u2013 Game code of selected Yahoo Fantasy game corresponding to a specific sport (refers to the current season if used as the value for game_key), where \"nfl\" is for fantasy football, \"nhl\" is for fantasy hockey, \"mlb\" is for fantasy baseball, and \"nba\" is for fantasy basketball. game_id ( int ) \u2013 Game ID of selected Yahoo fantasy game corresponding to a specific year, and defaulting to the game ID for the current year. league_key ( str ) \u2013 The Yahoo Fantasy Sports league key formatted as .l. . executed_queries ( list [ dict [ str , Any ]] ) \u2013 List of completed queries and their responses. all_output_as_json_str ( bool ) \u2013 Option to automatically convert all query output to JSON strings. offline ( bool ) \u2013 Boolean to run in offline mode (Only works if all needed Yahoo Fantasy data has been previously saved locally using the Data module in data.py). Source code in yfpy/query.py 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 227 228 229 230 231 232 233 234 def __init__ ( self , league_id : str , game_code : str , game_id : Optional [ int ] = None , yahoo_consumer_key : Optional [ str ] = None , yahoo_consumer_secret : Optional [ str ] = None , yahoo_access_token_json : Optional [ Union [ str , Dict ]] = None , env_var_fallback : bool = True , env_file_location : Optional [ Path ] = None , save_token_data_to_env_file : Optional [ bool ] = False , all_output_as_json_str : bool = False , browser_callback : bool = not runtime_environment_is_docker , retries : int = 3 , backoff : int = 0 , offline : bool = False ): \"\"\"Instantiate a YahooQueryObject for running queries against the Yahoo fantasy REST API. Args: league_id (str): League ID of selected Yahoo Fantasy league. game_code (str): Game code of selected Yahoo Fantasy game corresponding to a specific sport (refers to the current season if used as the value for game_key), where \"nfl\" is for fantasy football, \"nhl\" is for fantasy hockey, \"mlb\" is for fantasy baseball, and \"nba\" is for fantasy basketball. game_id (:obj:`int`, optional): Game ID of selected Yahoo fantasy game corresponding to a specific year, and defaulting to the game ID for the current year. yahoo_consumer_key (:obj:`str`, optional): User defined Yahoo developer app consumer key (must be provided in conjunction with yahoo_consumer_secret). yahoo_consumer_secret (:obj:`str`, optional): User defined Yahoo developer app consumer secret (must be provided in conjunction with yahoo_consumer_key). yahoo_access_token_json (str | dict, optional): User defined JSON (string or dict) containing refreshable access token generated by the yahoo-oauth library to avoid having to reauthenticate on every access to the Yahoo Fantasy Sports API (overrides yahoo_consumer_key/yahoo_consumer_secret and all Yahoo access token environment variables). env_var_fallback (:obj:`bool`, optional): Fall back to values retrieved from environment variables for any missing arguments or access token fields (defaults to True). env_file_location (:obj:`Path`, optional): Path to directory where existing .env file is located or new .env file should be generated when provided in conjunction with save_access_token_data_to_env_file=True (defaults to None). save_token_data_to_env_file (:obj:`bool`, optional): Boolean to save Yahoo access token data to local .env file (must be provided in conjunction with env_file_location) (defaults to False) all_output_as_json_str (:obj:`bool`, optional): Option to automatically convert all query output to JSON strings. browser_callback (:obj:`bool`, optional): Enable or disable (enabled by default) whether the yahoo-oauth library automatically opens a browser window to authenticate (if disabled, it will output the callback URL). retries (:obj:`int`, optional): Number of times to retry a query if it fails (defaults to 3). backoff (:obj:`int`, optional): Multiplier that incrementally increases the wait time before retrying a failed query request. offline (:obj:`bool`, optional): Boolean to run in offline mode (Only works if all needed Yahoo Fantasy data has been previously saved locally using the Data module in data.py). Attributes: _env_var_fallback (bool): Fall back to values retrieved from environment variables for any missing arguments or access token fields. _yahoo_access_token_dict (dict[str, Any]): Dictionary containing refreshable access token data generated by the yahoo-oauth library to avoid having to reauthenticate on every access to the Yahoo Fantasy Sports API. _yahoo_consumer_key (str): User defined Yahoo developer app consumer key. _yahoo_consumer_secret (str): User defined Yahoo developer app consumer secret. _browser_callback (bool): Enable or disable (enabled by default) whether the yahoo-oauth library automatically opens a browser window to authenticate (if disabled, it will output the callback URL). _retries (int): Number of times to retry a query if it fails (defaults to 3). _backoff (int): Multiplier that incrementally increases the wait time before retrying a failed query request. _fantasy_content_data_field (str): The initial JSON field in which all Yahoo Fantasy Sports API responses store the data output of the submitted query. league_id (str): League ID of selected Yahoo Fantasy league. game_code (str): Game code of selected Yahoo Fantasy game corresponding to a specific sport (refers to the current season if used as the value for game_key), where \"nfl\" is for fantasy football, \"nhl\" is for fantasy hockey, \"mlb\" is for fantasy baseball, and \"nba\" is for fantasy basketball. game_id (int): Game ID of selected Yahoo fantasy game corresponding to a specific year, and defaulting to the game ID for the current year. league_key (str): The Yahoo Fantasy Sports league key formatted as .l.. executed_queries (list[dict[str, Any]]): List of completed queries and their responses. all_output_as_json_str (bool): Option to automatically convert all query output to JSON strings. offline (bool): Boolean to run in offline mode (Only works if all needed Yahoo Fantasy data has been previously saved locally using the Data module in data.py). \"\"\" self . _env_var_fallback = env_var_fallback # load provided .env file if it exists to read any additional environment variables stored there if self . _env_var_fallback and env_file_location : env_file_path = env_file_location / \".env\" if env_file_path . is_file (): load_dotenv ( env_file_path ) self . _yahoo_access_token_dict : Dict [ str , Any ] = self . _get_dict_from_access_token_json ( yahoo_access_token_json ) # warn user that providing Yahoo access token JSON or populating a YAHOO_ACCESS_TOKEN_JSON environment variable # will override any values provided in the yahoo_consumer_key and yahoo_consumer_secret parameters if self . _yahoo_access_token_dict and ( yahoo_consumer_key or yahoo_consumer_secret ): logger . warning ( \"Providing a yahoo_access_token_json argument or setting env_var_fallback to True and having a \" \"YAHOO_ACCESS_TOKEN_JSON will override any values provided for yahoo_consumer_key or \" \"yahoo_consumer_secret.\" ) # retrieve the Yahoo consumer key and Yahoo consumer secret from the access token dict and fall back to the # provided parameters if no dict exists self . _yahoo_consumer_key = self . _yahoo_access_token_dict . get ( \"consumer_key\" , yahoo_consumer_key ) self . _yahoo_consumer_secret = self . _yahoo_access_token_dict . get ( \"consumer_secret\" , yahoo_consumer_secret ) # catch when a Yahoo consumer key was not provided if not self . _yahoo_consumer_key : # check for YAHOO_CONSUMER_KEY environment variable value if env_var_fallback is True if self . _env_var_fallback : if yahoo_consumer_key_env_var := os . environ . get ( \"YAHOO_CONSUMER_KEY\" ): self . _yahoo_consumer_key = yahoo_consumer_key_env_var if not self . _yahoo_consumer_key : logger . error ( \"Missing required Yahoo consumer key (no yahoo_consumer_key argument provided to \" \"YahooFantasySportsQuery, no consumer_key value provided in yahoo_access_token_json, or no \" \"YAHOO_CONSUMER_KEY environment variable value found).\" ) sys . exit ( 1 ) # catch when a Yahoo consumer secret was not provided if not self . _yahoo_consumer_secret : # check for YAHOO_CONSUMER_SECRET environment variable value if env_var_fallback is True if self . _env_var_fallback : if yahoo_consumer_secret_env_var := os . environ . get ( \"YAHOO_CONSUMER_SECRET\" ): self . _yahoo_consumer_secret = yahoo_consumer_secret_env_var if not self . _yahoo_consumer_secret : logger . error ( \"Missing required Yahoo consumer secret (no yahoo_consumer_secret argument provided to \" \"YahooFantasySportsQuery, no consumer_secret value provided in yahoo_access_token_json, or no \" \"YAHOO_CONSUMER_SECRET environment variable value found).\" ) sys . exit ( 1 ) # explicitly check for truthy/falsy value self . _browser_callback : bool = True if browser_callback is True else False self . _retries : int = retries self . _backoff : int = backoff self . _fantasy_content_data_field : str = \"fantasy_content\" self . league_id : str = league_id self . game_code : str = ( game_code if game_code in yahoo_fantasy_sports_game_codes else retrieve_game_code_from_user () ) self . game_id : int = game_id self . league_key : str = None self . executed_queries : List [ Dict [ str , Any ]] = [] # explicitly check for truthy/falsy value self . all_output_as_json_str : bool = True if all_output_as_json_str is True else False # explicitly check for truthy/falsy value self . offline : bool = True if offline is True else False if not self . offline : self . _authenticate () if save_token_data_to_env_file : self . save_access_token_data_to_env_file ( env_file_location )","title":"__init__"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.save_access_token_data_to_env_file","text":"save_access_token_data_to_env_file ( env_file_directory , env_file_name = \".env\" , save_json_to_var = False , ) Saves the fields and values of a Yahoo access token into a .env file. Parameters: env_file_directory ( Path ) \u2013 The path to the directory where the target .env file is/will be located. env_file_name \u2013 obj: str , optional): The name of the target .env file (defaults to \".env\"). save_json_to_var \u2013 obj: bool , optional): Boolean to determine whether or not to write a JSON string of Yahoo access token fields to a YAHOO_ACCESS_TOKEN_JSON environment variable in the target .env file (defaults to False). Returns: None \u2013 None Source code in yfpy/query.py 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 def save_access_token_data_to_env_file ( self , env_file_directory : Path , env_file_name : str = \".env\" , save_json_to_var : bool = False ) -> None : \"\"\"Saves the fields and values of a Yahoo access token into a .env file. Args: env_file_directory (Path): The path to the directory where the target .env file is/will be located. env_file_name (:obj:`str`, optional): The name of the target .env file (defaults to \".env\"). save_json_to_var (:obj:`bool`, optional): Boolean to determine whether or not to write a JSON string of Yahoo access token fields to a YAHOO_ACCESS_TOKEN_JSON environment variable in the target .env file (defaults to False). Returns: None \"\"\" if env_file_directory : env_file_path = env_file_directory / env_file_name else : logger . warning ( \"Missing argument env_file_location. Yahoo access token will NOT be saved to .env file.\" ) # exit method without saving Yahoo access token data when no env_file_location argument is provided return env_file_content = self . _retrieve_env_file_contents ( env_file_path ) # replace values of any matching environment variables in .env file with values from Yahoo access token fields for k , v in self . _yahoo_access_token_dict . items (): env_file_content [ f \"yahoo_ { k } \" ] = v # generate a JSON string with escaped double quotes using nested json.dumps() and write it to a # YAHOO_ACCESS_TOKEN_JSON environment variable if save_json_to_var is set to True if save_json_to_var : env_file_content [ \"yahoo_access_token_json\" ] = json . dumps ( json . dumps ( self . _yahoo_access_token_dict )) # write contents to .env file (overwrites contents if file exists or creates a new file if not) with open ( env_file_path , \"w\" ) as env_file : for k , v in env_file_content . items (): if k . startswith ( \"blank\" ): env_file . write ( v ) elif k . startswith ( \"comment\" ): env_file . write ( f \" { v } \\n \" ) else : env_file . write ( f \" { k . upper () } = { v } \\n \" )","title":"save_access_token_data_to_env_file"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_response","text":"get_response ( url ) Retrieve Yahoo Fantasy Sports data from the REST API. Parameters: url ( str ) \u2013 REST API request URL string. Returns: Response ( Response ) \u2013 API response from Yahoo Fantasy Sports API request. Source code in yfpy/query.py 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 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 def get_response ( self , url : str ) -> Response : \"\"\"Retrieve Yahoo Fantasy Sports data from the REST API. Args: url (str): REST API request URL string. Returns: Response: API response from Yahoo Fantasy Sports API request. \"\"\" logger . debug ( f \"Making request to URL: { url } \" ) response : Response = self . oauth . session . get ( url , params = { \"format\" : \"json\" }) status_code = response . status_code # when you exceed Yahoo's allowed data request limits, they throw a request status code of 999 if status_code == 999 : raise HTTPError ( \"Yahoo data unavailable due to rate limiting. Please try again later.\" ) if status_code == 401 : self . _authenticate () response_json = {} try : response_json = response . json () logger . debug ( f \"Response (JSON): { response_json } \" ) except JSONDecodeError : response . raise_for_status () try : if ( status_code // 100 ) != 2 : # handle if the yahoo query returns an error if response_json . get ( \"error\" ): response_error_msg = response_json . get ( \"error\" ) . get ( \"description\" ) error_msg = f \"Attempt to retrieve data at URL { response . url } failed with error: \" \\ f \" \\\" { response_error_msg } \\\" \" logger . error ( error_msg ) raise YahooFantasySportsDataNotFound ( error_msg , url = response . url ) response . raise_for_status () except HTTPError as e : # retry with incremental back-off if self . _retries > 0 : self . _retries -= 1 self . _backoff += 1 logger . warning ( f \"Request for URL { url } failed with status code { response . status_code } . \" f \"Retrying { self . _retries } more time { 's' if self . _retries > 1 else '' } ...\" ) time . sleep ( 0.3 * self . _backoff ) response = self . get_response ( url ) else : # log error and terminate query if status code is not 200 after 3 retries logger . error ( f \"Request failed with status code: { response . status_code } - { e } \" ) response . raise_for_status () raw_response_data = response_json . get ( self . _fantasy_content_data_field ) # extract data from \"fantasy_content\" field if it exists if raw_response_data : logger . debug ( f \"Data fetched with query URL: { response . url } \" ) logger . debug ( f \"Response (Yahoo fantasy data extracted from: \" f \" \\\" { self . _fantasy_content_data_field } \\\" ): { raw_response_data } \" ) else : error_msg = f \"No data found at URL { response . url } when attempting extraction from field: \" \\ f \" \\\" { self . _fantasy_content_data_field } \\\" \" logger . error ( error_msg ) raise YahooFantasySportsDataNotFound ( error_msg , url = response . url ) return response","title":"get_response"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.query","text":"query ( url , data_key_list , data_type_class = None , sort_function = None , ) Base query class to retrieve requested data from the Yahoo fantasy sports REST API. Parameters: url ( str ) \u2013 REST API request URL string. data_key_list ( list [ str ] | list [ list [ str ]] ) \u2013 List of keys used to extract the specific data desired by the given query (supports strings and lists of strings). Supports lists containing only key strings such as [\"game\", \"stat_categories\"], and also supports lists containing key strings followed by lists of key strings such as [\"team\", [\"team_points\", \"team_projected_points\"]]. data_type_class \u2013 obj: Type , optional): Highest level data model type (if one exists for the retrieved data). sort_function ( Callable of sort function , default: None ) \u2013 Optional lambda function to return sorted query results. Returns: object ( Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]] ) \u2013 Model class instance from yfpy/models.py, dictionary, or list (depending on query), with unpacked Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]] \u2013 and parsed response data. Source code in yfpy/query.py 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 def query ( self , url : str , data_key_list : Union [ List [ str ], List [ List [ str ]]], data_type_class : Type = None , sort_function : Callable = None ) -> ( Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]]): \"\"\"Base query class to retrieve requested data from the Yahoo fantasy sports REST API. Args: url (str): REST API request URL string. data_key_list (list[str] | list[list[str]]): List of keys used to extract the specific data desired by the given query (supports strings and lists of strings). Supports lists containing only key strings such as [\"game\", \"stat_categories\"], and also supports lists containing key strings followed by lists of key strings such as [\"team\", [\"team_points\", \"team_projected_points\"]]. data_type_class (:obj:`Type`, optional): Highest level data model type (if one exists for the retrieved data). sort_function (Callable of sort function, optional)): Optional lambda function to return sorted query results. Returns: object: Model class instance from yfpy/models.py, dictionary, or list (depending on query), with unpacked and parsed response data. \"\"\" if not self . offline : response = self . get_response ( url ) raw_response_data = response . json () . get ( self . _fantasy_content_data_field ) # print(json.dumps(raw_response_data, indent=2)) # iterate through list of data keys and drill down to final desired data field for i in range ( len ( data_key_list )): if isinstance ( raw_response_data , list ): if isinstance ( data_key_list [ i ], list ): reformatted = reformat_json_list ( raw_response_data ) raw_response_data = [ { data_key_list [ i ][ 0 ]: reformatted [ data_key_list [ i ][ 0 ]]}, { data_key_list [ i ][ 1 ]: reformatted [ data_key_list [ i ][ 1 ]]} ] else : raw_response_data = reformat_json_list ( raw_response_data )[ data_key_list [ i ]] else : if isinstance ( data_key_list [ i ], list ): raw_response_data = [ { data_key_list [ i ][ 0 ]: raw_response_data [ data_key_list [ i ][ 0 ]]}, { data_key_list [ i ][ 1 ]: raw_response_data [ data_key_list [ i ][ 1 ]]} ] else : raw_response_data = raw_response_data . get ( data_key_list [ i ]) if raw_response_data : logger . debug ( f \"Response (Yahoo fantasy data extracted from: { data_key_list } ): { raw_response_data } \" ) else : error_msg = f \"No data found when attempting extraction from fields: { data_key_list } \" logger . error ( error_msg ) raise YahooFantasySportsDataNotFound ( error_msg , payload = data_key_list , url = response . url ) # unpack, parse, and assign data types to all retrieved data content unpacked = unpack_data ( raw_response_data , YahooFantasyObject ) logger . debug ( f \"Unpacked and parsed JSON (Yahoo fantasy data wth parent type: { data_type_class } ): \\n { unpacked } \" ) self . executed_queries . append ({ \"url\" : response . url , \"response_status_code\" : response . status_code , \"response\" : response }) # cast the highest level of data to type corresponding to query (if type exists) query_data = data_type_class ( unpacked ) if data_type_class else unpacked # sort data when applicable if sort_function and not isinstance ( query_data , dict ): query_data = sorted ( query_data , key = sort_function ) # flatten lists of single-key dicts of objects into lists of those objects if isinstance ( query_data , list ): last_data_key = data_key_list [ - 1 ] if last_data_key . endswith ( \"s\" ): query_data = [ el [ last_data_key [: - 1 ]] for el in query_data ] if self . all_output_as_json_str : return jsonify_data ( query_data ) else : return query_data else : logger . error ( \"Cannot run Yahoo query while using offline mode! Please try again with offline=False.\" )","title":"query"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_all_yahoo_fantasy_game_keys","text":"get_all_yahoo_fantasy_game_keys () Retrieve all Yahoo Fantasy Sports game keys by ID (from year of inception to present), sorted by season/year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_all_yahoo_fantasy_game_keys () [ Game({ \"code\": \"nfl\", \"game_id\": \"50\", \"game_key\": \"50\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"1999\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/1999\" }), ..., Game({...}) ] Returns: List [ Game ] \u2013 list[Game]: List of YFPY Game instances. Source code in yfpy/query.py 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 def get_all_yahoo_fantasy_game_keys ( self ) -> List [ Game ]: \"\"\"Retrieve all Yahoo Fantasy Sports game keys by ID (from year of inception to present), sorted by season/year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_all_yahoo_fantasy_game_keys() [ Game({ \"code\": \"nfl\", \"game_id\": \"50\", \"game_key\": \"50\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"1999\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/1999\" }), ..., Game({...}) ] Returns: list[Game]: List of YFPY Game instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/games;game_codes= { self . game_code } \" , [ \"games\" ], sort_function = lambda x : x . get ( \"game\" ) . season )","title":"get_all_yahoo_fantasy_game_keys"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_game_key_by_season","text":"get_game_key_by_season ( season ) Retrieve specific game key by season. Parameters: season ( int ) \u2013 User defined season/year for which to retrieve the Yahoo Fantasy Sports game. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_game_key_by_season ( 2021 ) 338 Returns: str ( str ) \u2013 The game key for a Yahoo Fantasy Sports game specified by season. Source code in yfpy/query.py 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 def get_game_key_by_season ( self , season : int ) -> str : \"\"\"Retrieve specific game key by season. Args: season (int): User defined season/year for which to retrieve the Yahoo Fantasy Sports game. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_key_by_season(2021) 338 Returns: str: The game key for a Yahoo Fantasy Sports game specified by season. \"\"\" all_output_as_json = False if self . all_output_as_json_str : self . all_output_as_json_str = False all_output_as_json = True game_key = self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/games;game_codes= { self . game_code } ;seasons= { season } \" , [ \"games\" ] ) . get ( \"game\" ) . game_key if all_output_as_json : self . all_output_as_json_str = True return game_key","title":"get_game_key_by_season"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_current_game_info","text":"get_current_game_info () Retrieve game info for current fantasy season. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_current_game_info () Game({ \"code\": \"nfl\", \"game_id\": \"390\", \"game_key\": \"390\", \"game_weeks\": [ { \"game_week\": { \"display_name\": \"1\", \"end\": \"2019-09-09\", \"start\": \"2019-09-05\", \"week\": \"1\" } }, ... ], \"is_game_over\": 0, \"is_live_draft_lobby_active\": 1, \"is_offseason\": 0, \"is_registration_over\": 0, \"name\": \"Football\", \"position_types\": [ { \"position_type\": { \"type\": \"O\", \"display_name\": \"Offense\" } }, ... ], \"roster_positions\": [ { \"roster_position\": { \"position\": \"QB\", \"position_type\": \"O\" } }, ... ], \"season\": \"2019\", \"stat_categories\": { \"stats\": [ { \"stat\": { \"display_name\": \"GP\", \"name\": \"Games Played\", \"sort_order\": \"1\", \"stat_id\": 0 } }, ... }, \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/f1\" }) Returns: Game ( Game ) \u2013 YFPY Game instance. Source code in yfpy/query.py 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 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 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 def get_current_game_info ( self ) -> Game : \"\"\"Retrieve game info for current fantasy season. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_current_game_info() Game({ \"code\": \"nfl\", \"game_id\": \"390\", \"game_key\": \"390\", \"game_weeks\": [ { \"game_week\": { \"display_name\": \"1\", \"end\": \"2019-09-09\", \"start\": \"2019-09-05\", \"week\": \"1\" } }, ... ], \"is_game_over\": 0, \"is_live_draft_lobby_active\": 1, \"is_offseason\": 0, \"is_registration_over\": 0, \"name\": \"Football\", \"position_types\": [ { \"position_type\": { \"type\": \"O\", \"display_name\": \"Offense\" } }, ... ], \"roster_positions\": [ { \"roster_position\": { \"position\": \"QB\", \"position_type\": \"O\" } }, ... ], \"season\": \"2019\", \"stat_categories\": { \"stats\": [ { \"stat\": { \"display_name\": \"GP\", \"name\": \"Games Played\", \"sort_order\": \"1\", \"stat_id\": 0 } }, ... }, \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/f1\" }) Returns: Game: YFPY Game instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { self . game_code } ;\" f \"out=metadata,players,game_weeks,stat_categories,position_types,roster_positions\" , [ \"game\" ], Game )","title":"get_current_game_info"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_current_game_metadata","text":"get_current_game_metadata () Retrieve game metadata for current fantasy season. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_current_game_metadata () Game({ \"code\": \"nfl\", \"game_id\": \"390\", \"game_key\": \"390\", \"is_game_over\": 0, \"is_live_draft_lobby_active\": 1, \"is_offseason\": 0, \"is_registration_over\": 0, \"name\": \"Football\", \"season\": \"2019\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/f1\" }) Returns: Game ( Game ) \u2013 YFPY Game instance. Source code in yfpy/query.py 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 def get_current_game_metadata ( self ) -> Game : \"\"\"Retrieve game metadata for current fantasy season. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_current_game_metadata() Game({ \"code\": \"nfl\", \"game_id\": \"390\", \"game_key\": \"390\", \"is_game_over\": 0, \"is_live_draft_lobby_active\": 1, \"is_offseason\": 0, \"is_registration_over\": 0, \"name\": \"Football\", \"season\": \"2019\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/f1\" }) Returns: Game: YFPY Game instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { self . game_code } /metadata\" , [ \"game\" ], Game )","title":"get_current_game_metadata"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_game_info_by_game_id","text":"get_game_info_by_game_id ( game_id ) Retrieve game info for specific game by ID. Parameters: game_id ( int ) \u2013 Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_game_info_by_game_id ( 390 ) Game({ \"code\": \"nfl\", \"game_id\": \"390\", \"game_key\": \"390\", \"game_weeks\": [ { \"game_week\": { \"display_name\": \"1\", \"end\": \"2019-09-09\", \"start\": \"2019-09-05\", \"week\": \"1\" } }, ... ], \"is_game_over\": 0, \"is_live_draft_lobby_active\": 1, \"is_offseason\": 0, \"is_registration_over\": 0, \"name\": \"Football\", \"position_types\": [ { \"position_type\": { \"type\": \"O\", \"display_name\": \"Offense\" } }, ... ], \"roster_positions\": [ { \"roster_position\": { \"position\": \"QB\", \"position_type\": \"O\" } }, ... ], \"season\": \"2019\", \"stat_categories\": { \"stats\": [ { \"stat\": { \"display_name\": \"GP\", \"name\": \"Games Played\", \"sort_order\": \"1\", \"stat_id\": 0 } }, ... }, \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/f1\" }) Returns: Game ( Game ) \u2013 YFPY Game instance. Source code in yfpy/query.py 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 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 def get_game_info_by_game_id ( self , game_id : int ) -> Game : \"\"\"Retrieve game info for specific game by ID. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_info_by_game_id(390) Game({ \"code\": \"nfl\", \"game_id\": \"390\", \"game_key\": \"390\", \"game_weeks\": [ { \"game_week\": { \"display_name\": \"1\", \"end\": \"2019-09-09\", \"start\": \"2019-09-05\", \"week\": \"1\" } }, ... ], \"is_game_over\": 0, \"is_live_draft_lobby_active\": 1, \"is_offseason\": 0, \"is_registration_over\": 0, \"name\": \"Football\", \"position_types\": [ { \"position_type\": { \"type\": \"O\", \"display_name\": \"Offense\" } }, ... ], \"roster_positions\": [ { \"roster_position\": { \"position\": \"QB\", \"position_type\": \"O\" } }, ... ], \"season\": \"2019\", \"stat_categories\": { \"stats\": [ { \"stat\": { \"display_name\": \"GP\", \"name\": \"Games Played\", \"sort_order\": \"1\", \"stat_id\": 0 } }, ... }, \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/f1\" }) Returns: Game: YFPY Game instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } ;\" f \"out=metadata,players,game_weeks,stat_categories,position_types,roster_positions\" , [ \"game\" ], Game )","title":"get_game_info_by_game_id"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_game_metadata_by_game_id","text":"get_game_metadata_by_game_id ( game_id ) Retrieve game metadata for specific game by ID. Parameters: game_id ( int ) \u2013 Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_game_metadata_by_game_id ( 331 ) Game({ \"code\": \"nfl\", \"game_id\": \"331\", \"game_key\": \"331\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"2014\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014\" }) Returns: Game ( Game ) \u2013 YFPY Game instance. Source code in yfpy/query.py 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 def get_game_metadata_by_game_id ( self , game_id : int ) -> Game : \"\"\"Retrieve game metadata for specific game by ID. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_metadata_by_game_id(331) Game({ \"code\": \"nfl\", \"game_id\": \"331\", \"game_key\": \"331\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"2014\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014\" }) Returns: Game: YFPY Game instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } /metadata\" , [ \"game\" ], Game )","title":"get_game_metadata_by_game_id"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_game_weeks_by_game_id","text":"get_game_weeks_by_game_id ( game_id ) Retrieve all valid weeks of a specific game by ID. Parameters: game_id ( int ) \u2013 Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_game_weeks_by_game_id ( 331 ) [ GameWeek({ \"display_name\": \"1\", \"end\": \"2014-09-08\", \"start\": \"2014-09-04\", \"week\": \"1\" }), ..., GameWeek({ \"display_name\": \"17\", \"end\": \"2014-12-28\", \"start\": \"2014-12-23\", \"week\": \"17\" }) ] Returns: List [ GameWeek ] \u2013 list[GameWeek]: List of YFPY GameWeek instances. Source code in yfpy/query.py 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 def get_game_weeks_by_game_id ( self , game_id : int ) -> List [ GameWeek ]: \"\"\"Retrieve all valid weeks of a specific game by ID. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_weeks_by_game_id(331) [ GameWeek({ \"display_name\": \"1\", \"end\": \"2014-09-08\", \"start\": \"2014-09-04\", \"week\": \"1\" }), ..., GameWeek({ \"display_name\": \"17\", \"end\": \"2014-12-28\", \"start\": \"2014-12-23\", \"week\": \"17\" }) ] Returns: list[GameWeek]: List of YFPY GameWeek instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } /game_weeks\" , [ \"game\" , \"game_weeks\" ] )","title":"get_game_weeks_by_game_id"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_game_stat_categories_by_game_id","text":"get_game_stat_categories_by_game_id ( game_id ) Retrieve all valid stat categories of a specific game by ID. Parameters: game_id ( int ) \u2013 Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_game_stat_categories_by_game_id ( 331 ) StatCategories({ \"stats\": [ { \"stat\": { \"display_name\": \"GP\", \"name\": \"Games Played\", \"sort_order\": \"1\", \"stat_id\": 0 } }, ..., { \"stat\": { \"display_name\": \"Rush 1st Downs\", \"name\": \"Rushing 1st Downs\", \"sort_order\": \"1\", \"stat_id\": 81 } } ] }) Returns: StatCategories ( StatCategories ) \u2013 YFPY StatCategories instance. Source code in yfpy/query.py 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 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 def get_game_stat_categories_by_game_id ( self , game_id : int ) -> StatCategories : \"\"\"Retrieve all valid stat categories of a specific game by ID. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_stat_categories_by_game_id(331) StatCategories({ \"stats\": [ { \"stat\": { \"display_name\": \"GP\", \"name\": \"Games Played\", \"sort_order\": \"1\", \"stat_id\": 0 } }, ..., { \"stat\": { \"display_name\": \"Rush 1st Downs\", \"name\": \"Rushing 1st Downs\", \"sort_order\": \"1\", \"stat_id\": 81 } } ] }) Returns: StatCategories: YFPY StatCategories instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } /stat_categories\" , [ \"game\" , \"stat_categories\" ], StatCategories )","title":"get_game_stat_categories_by_game_id"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_game_position_types_by_game_id","text":"get_game_position_types_by_game_id ( game_id ) Retrieve all valid position types for specific game by ID sorted alphabetically by type. Parameters: game_id ( int ) \u2013 Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_game_position_types_by_game_id ( 331 ) [ PositionType({ \"type\": \"O\", \"display_name\": \"Offense\" }), ..., PositionType({ \"type\": \"K\", \"display_name\": \"Kickers\" }) ] Returns: List [ PositionType ] \u2013 list[PositionType]: List of YFPY PositionType instances. Source code in yfpy/query.py 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 def get_game_position_types_by_game_id ( self , game_id : int ) -> List [ PositionType ]: \"\"\"Retrieve all valid position types for specific game by ID sorted alphabetically by type. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_position_types_by_game_id(331) [ PositionType({ \"type\": \"O\", \"display_name\": \"Offense\" }), ..., PositionType({ \"type\": \"K\", \"display_name\": \"Kickers\" }) ] Returns: list[PositionType]: List of YFPY PositionType instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } /position_types\" , [ \"game\" , \"position_types\" ], sort_function = lambda x : x . get ( \"position_type\" ) . type )","title":"get_game_position_types_by_game_id"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_game_roster_positions_by_game_id","text":"get_game_roster_positions_by_game_id ( game_id ) Retrieve all valid roster positions for specific game by ID sorted alphabetically by position. Parameters: game_id ( int ) \u2013 Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_game_roster_positions_by_game_id ( 331 ) [ {RosterPosition({ \"position\": \"BN\" }), ..., RosterPosition({ \"position\": \"WR\", \"position_type\": \"O\" }) ] Returns: List [ RosterPosition ] \u2013 list[RosterPosition]: List of YFPY RosterPosition instances. Source code in yfpy/query.py 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 def get_game_roster_positions_by_game_id ( self , game_id : int ) -> List [ RosterPosition ]: \"\"\"Retrieve all valid roster positions for specific game by ID sorted alphabetically by position. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_roster_positions_by_game_id(331) [ {RosterPosition({ \"position\": \"BN\" }), ..., RosterPosition({ \"position\": \"WR\", \"position_type\": \"O\" }) ] Returns: list[RosterPosition]: List of YFPY RosterPosition instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } /roster_positions\" , [ \"game\" , \"roster_positions\" ], sort_function = lambda x : x . get ( \"roster_position\" ) . position )","title":"get_game_roster_positions_by_game_id"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_league_key","text":"get_league_key ( season = None ) Retrieve league key for selected league. Parameters: season ( int , default: None ) \u2013 User defined season/year for which to retrieve the Yahoo Fantasy Sports league key. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_league_key ( 2021 ) 331.l.729259 Returns: str ( str ) \u2013 League key string for selected league. Source code in yfpy/query.py 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 def get_league_key ( self , season : int = None ) -> str : \"\"\"Retrieve league key for selected league. Args: season (int): User defined season/year for which to retrieve the Yahoo Fantasy Sports league key. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_key(2021) 331.l.729259 Returns: str: League key string for selected league. \"\"\" if not self . league_key : if season : return f \" { self . get_game_key_by_season ( season ) } .l. { self . league_id } \" elif self . game_id : return f \" { self . get_game_metadata_by_game_id ( self . game_id ) . game_key } .l. { self . league_id } \" else : logger . warning ( \"No game id or season/year provided, defaulting to current fantasy season.\" ) return f \" { self . get_current_game_metadata () . game_key } .l. { self . league_id } \" else : return self . league_key","title":"get_league_key"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_current_user","text":"get_current_user () Retrieve metadata for current logged-in user. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_current_user () User({ \"guid\": \"USER_GUID_STRING\" }) Returns: User ( User ) \u2013 YFPY User instance. Source code in yfpy/query.py 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 def get_current_user ( self ) -> User : \"\"\"Retrieve metadata for current logged-in user. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_current_user() User({ \"guid\": \"USER_GUID_STRING\" }) Returns: User: YFPY User instance. \"\"\" return self . query ( \"https://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/\" , [ \"users\" , \"0\" , \"user\" ], User )","title":"get_current_user"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_user_games","text":"get_user_games () Retrieve game history for current logged-in user sorted by season/year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_user_games () [ Game({ \"code\": \"nfl\", \"game_id\": \"359\", \"game_key\": \"359\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"2016\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2016\" }) ..., Game({...}) ] Returns: List [ Game ] \u2013 list[Game]: List of YFPY Game instances. Source code in yfpy/query.py 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 def get_user_games ( self ) -> List [ Game ]: \"\"\"Retrieve game history for current logged-in user sorted by season/year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_user_games() [ Game({ \"code\": \"nfl\", \"game_id\": \"359\", \"game_key\": \"359\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"2016\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2016\" }) ..., Game({...}) ] Returns: list[Game]: List of YFPY Game instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/games;codes= { self . game_code } /\" , [ \"users\" , \"0\" , \"user\" , \"games\" ], sort_function = lambda x : x . get ( \"game\" ) . season )","title":"get_user_games"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_user_leagues_by_game_key","text":"get_user_leagues_by_game_key ( game_key ) Retrieve league history for current logged-in user for specific game by game IDs/keys sorted by season/year. Parameters: game_key ( int | str ) \u2013 The game_id (int) or game_key (str) for a specific Yahoo Fantasy game. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_user_leagues_by_game_key ( 331 ) [ League({ \"allow_add_to_dl_extra_pos\": 0, \"current_week\": \"16\", \"draft_status\": \"postdraft\", \"edit_key\": \"16\", \"end_date\": \"2018-12-24\", \"end_week\": \"16\", \"game_code\": \"nfl\", \"iris_group_chat_id\": \"\", \"is_cash_league\": \"0\", \"is_finished\": 1, \"is_pro_league\": \"0\", \"league_id\": \"169896\", \"league_key\": \"380.l.169896\", \"league_type\": \"private\", \"league_update_timestamp\": \"1546498723\", \"logo_url\": \"\", \"name\": \"League Name\", \"num_teams\": 12, \"password\": null, \"renew\": \"371_52364\", \"renewed\": \"390_78725\", \"scoring_type\": \"head\", \"season\": \"2018\", \"short_invitation_url\": \"\", \"start_date\": \"2018-09-06\", \"start_week\": \"1\", \"url\": \"\", \"weekly_deadline\": null }), ..., League({...}) ] Returns: List [ League ] \u2013 list[League]: List of YFPY League instances. Source code in yfpy/query.py 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 def get_user_leagues_by_game_key ( self , game_key : Union [ int , str ]) -> List [ League ]: \"\"\"Retrieve league history for current logged-in user for specific game by game IDs/keys sorted by season/year. Args: game_key (int | str): The game_id (int) or game_key (str) for a specific Yahoo Fantasy game. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_user_leagues_by_game_key(331) [ League({ \"allow_add_to_dl_extra_pos\": 0, \"current_week\": \"16\", \"draft_status\": \"postdraft\", \"edit_key\": \"16\", \"end_date\": \"2018-12-24\", \"end_week\": \"16\", \"game_code\": \"nfl\", \"iris_group_chat_id\": \"\", \"is_cash_league\": \"0\", \"is_finished\": 1, \"is_pro_league\": \"0\", \"league_id\": \"169896\", \"league_key\": \"380.l.169896\", \"league_type\": \"private\", \"league_update_timestamp\": \"1546498723\", \"logo_url\": \"\", \"name\": \"League Name\", \"num_teams\": 12, \"password\": null, \"renew\": \"371_52364\", \"renewed\": \"390_78725\", \"scoring_type\": \"head\", \"season\": \"2018\", \"short_invitation_url\": \"\", \"start_date\": \"2018-09-06\", \"start_week\": \"1\", \"url\": \"\", \"weekly_deadline\": null }), ..., League({...}) ] Returns: list[League]: List of YFPY League instances. \"\"\" leagues = self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/games;game_keys= { game_key } /leagues/\" , [ \"users\" , \"0\" , \"user\" , \"games\" , \"0\" , \"game\" , \"leagues\" ], sort_function = lambda x : x . get ( \"league\" ) . season ) return leagues if isinstance ( leagues , list ) else [ leagues . get ( \"league\" )]","title":"get_user_leagues_by_game_key"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_user_teams","text":"get_user_teams () Retrieve teams for all leagues for current logged-in user for current game sorted by season/year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_user_teams () [ Game({ \"code\": \"nfl\", \"game_id\": \"359\", \"game_key\": \"359\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"2016\", \"teams\": [ { \"team\": { \"draft_grade\": \"A\", \"draft_position\": 9, \"draft_recap_url\": \"\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": [ { \"manager\": { \"email\": \"\", \"guid\": \"\", \"image_url\": \"\", \"is_comanager\": \"1\", \"manager_id\": \"14\", \"nickname\": \"\" } } ], \"name\": \"Legion\", \"number_of_moves\": \"48\", \"number_of_trades\": \"2\", \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"1\", \"team_key\": \"359.l.5521.t.1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"\" } }, \"url\": \"\", \"waiver_priority\": 11 } } ], \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2016\" }) ..., Game({...}) ] Returns: List [ Game ] \u2013 list[Game]: List of YFPY Game instances with \"teams\" attribute containing list of YFPY Team instances. Source code in yfpy/query.py 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 def get_user_teams ( self ) -> List [ Game ]: \"\"\"Retrieve teams for all leagues for current logged-in user for current game sorted by season/year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_user_teams() [ Game({ \"code\": \"nfl\", \"game_id\": \"359\", \"game_key\": \"359\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"2016\", \"teams\": [ { \"team\": { \"draft_grade\": \"A\", \"draft_position\": 9, \"draft_recap_url\": \"\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": [ { \"manager\": { \"email\": \"\", \"guid\": \"\", \"image_url\": \"\", \"is_comanager\": \"1\", \"manager_id\": \"14\", \"nickname\": \"\" } } ], \"name\": \"Legion\", \"number_of_moves\": \"48\", \"number_of_trades\": \"2\", \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"1\", \"team_key\": \"359.l.5521.t.1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"\" } }, \"url\": \"\", \"waiver_priority\": 11 } } ], \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2016\" }) ..., Game({...}) ] Returns: list[Game]: List of YFPY Game instances with \"teams\" attribute containing list of YFPY Team instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/games;codes= { self . game_code } /teams/\" , [ \"users\" , \"0\" , \"user\" , \"games\" ], sort_function = lambda x : x . get ( \"game\" ) . season )","title":"get_user_teams"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_league_info","text":"get_league_info () Retrieve info for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_league_info () League({ \"allow_add_to_dl_extra_pos\": 0, \"current_week\": \"16\", \"draft_status\": \"postdraft\", \"edit_key\": \"16\", \"end_date\": \"2014-12-22\", \"end_week\": \"16\", \"game_code\": \"nfl\", \"iris_group_chat_id\": null, \"is_cash_league\": \"0\", \"is_finished\": 1, \"is_pro_league\": \"1\", \"league_id\": \"729259\", \"league_key\": \"331.l.729259\", \"league_type\": \"public\", \"league_update_timestamp\": \"1420099793\", \"logo_url\": \"https://s.yimg.com/cv/api/default/20180206/default-league-logo@2x.png\", \"name\": \"Yahoo Public 729259\", \"num_teams\": 10, \"renew\": null, \"renewed\": null, \"scoreboard\": { \"week\": \"16\", \"matchups\": [ ... ] }, \"scoring_type\": \"head\", \"season\": \"2014\", \"settings\": { ... }, \"standings\": { \"teams\": [ ..., ... ], ... }, \"start_date\": \"2014-09-04\", \"start_week\": \"1\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259\", \"weekly_deadline\": null }) Returns: League ( League ) \u2013 YFPY League instance. Source code in yfpy/query.py 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 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 def get_league_info ( self ) -> League : \"\"\"Retrieve info for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_info() League({ \"allow_add_to_dl_extra_pos\": 0, \"current_week\": \"16\", \"draft_status\": \"postdraft\", \"edit_key\": \"16\", \"end_date\": \"2014-12-22\", \"end_week\": \"16\", \"game_code\": \"nfl\", \"iris_group_chat_id\": null, \"is_cash_league\": \"0\", \"is_finished\": 1, \"is_pro_league\": \"1\", \"league_id\": \"729259\", \"league_key\": \"331.l.729259\", \"league_type\": \"public\", \"league_update_timestamp\": \"1420099793\", \"logo_url\": \"https://s.yimg.com/cv/api/default/20180206/default-league-logo@2x.png\", \"name\": \"Yahoo Public 729259\", \"num_teams\": 10, \"renew\": null, \"renewed\": null, \"scoreboard\": { \"week\": \"16\", \"matchups\": [ ... ] }, \"scoring_type\": \"head\", \"season\": \"2014\", \"settings\": { ... }, \"standings\": { \"teams\": [ ..., ... ], ... }, \"start_date\": \"2014-09-04\", \"start_week\": \"1\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259\", \"weekly_deadline\": null }) Returns: League: YFPY League instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } ;\" f \"out=metadata,settings,standings,scoreboard,teams,players,draftresults,transactions\" , [ \"league\" ], League )","title":"get_league_info"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_league_metadata","text":"get_league_metadata () Retrieve metadata for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_league_metadata () League({ \"allow_add_to_dl_extra_pos\": 0, \"current_week\": \"16\", \"draft_status\": \"postdraft\", \"edit_key\": \"16\", \"end_date\": \"2014-12-22\", \"end_week\": \"16\", \"game_code\": \"nfl\", \"iris_group_chat_id\": null, \"is_cash_league\": \"0\", \"is_finished\": 1, \"is_pro_league\": \"1\", \"league_id\": \"729259\", \"league_key\": \"331.l.729259\", \"league_type\": \"public\", \"league_update_timestamp\": \"1420099793\", \"logo_url\": \"https://s.yimg.com/cv/api/default/20180206/default-league-logo@2x.png\", \"name\": \"Yahoo Public 729259\", \"num_teams\": 10, \"renew\": null, \"renewed\": null, \"scoring_type\": \"head\", \"season\": \"2014\", \"start_date\": \"2014-09-04\", \"start_week\": \"1\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259\", \"weekly_deadline\": null }) Returns: League ( League ) \u2013 YFPY League instance. Source code in yfpy/query.py 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 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 def get_league_metadata ( self ) -> League : \"\"\"Retrieve metadata for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_metadata() League({ \"allow_add_to_dl_extra_pos\": 0, \"current_week\": \"16\", \"draft_status\": \"postdraft\", \"edit_key\": \"16\", \"end_date\": \"2014-12-22\", \"end_week\": \"16\", \"game_code\": \"nfl\", \"iris_group_chat_id\": null, \"is_cash_league\": \"0\", \"is_finished\": 1, \"is_pro_league\": \"1\", \"league_id\": \"729259\", \"league_key\": \"331.l.729259\", \"league_type\": \"public\", \"league_update_timestamp\": \"1420099793\", \"logo_url\": \"https://s.yimg.com/cv/api/default/20180206/default-league-logo@2x.png\", \"name\": \"Yahoo Public 729259\", \"num_teams\": 10, \"renew\": null, \"renewed\": null, \"scoring_type\": \"head\", \"season\": \"2014\", \"start_date\": \"2014-09-04\", \"start_week\": \"1\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259\", \"weekly_deadline\": null }) Returns: League: YFPY League instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /metadata\" , [ \"league\" ], League )","title":"get_league_metadata"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_league_settings","text":"get_league_settings () Retrieve settings (rules) for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_league_settings () Settings({ \"cant_cut_list\": \"yahoo\", \"draft_time\": \"1408410000\", \"draft_type\": \"live\", \"has_multiweek_championship\": 0, \"has_playoff_consolation_games\": true, \"is_auction_draft\": \"0\", \"max_teams\": \"10\", \"num_playoff_consolation_teams\": 4, \"num_playoff_teams\": \"4\", \"pickem_enabled\": \"1\", \"player_pool\": \"ALL\", \"playoff_start_week\": \"15\", \"post_draft_players\": \"W\", \"roster_positions\": [ { \"roster_position\": { \"count\": 1, \"position\": \"QB\", \"position_type\": \"O\" } }, ... ], \"scoring_type\": \"head\", \"stat_categories\": { \"stats\": [ { \"stat\": { \"display_name\": \"Pass Yds\", \"enabled\": \"1\", \"name\": \"Passing Yards\", \"position_type\": \"O\", \"sort_order\": \"1\", \"stat_id\": 4, \"stat_position_types\": { \"stat_position_type\": { \"position_type\": \"O\" } } } }, ... ] }, \"stat_modifiers\": { \"stats\": [ { \"stat\": { \"stat_id\": 4, \"value\": \"0.04\" } }, ... ] }, \"trade_end_date\": \"2014-11-14\", \"trade_ratify_type\": \"yahoo\", \"trade_reject_time\": \"2\", \"uses_faab\": \"0\", \"uses_fractional_points\": \"1\", \"uses_lock_eliminated_teams\": 1, \"uses_negative_points\": \"1\", \"uses_playoff\": \"1\", \"uses_playoff_reseeding\": 0, \"waiver_rule\": \"gametime\", \"waiver_time\": \"2\", \"waiver_type\": \"R\" }) Returns: Settings ( Settings ) \u2013 YFPY Settings instance. Source code in yfpy/query.py 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 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 def get_league_settings ( self ) -> Settings : \"\"\"Retrieve settings (rules) for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_settings() Settings({ \"cant_cut_list\": \"yahoo\", \"draft_time\": \"1408410000\", \"draft_type\": \"live\", \"has_multiweek_championship\": 0, \"has_playoff_consolation_games\": true, \"is_auction_draft\": \"0\", \"max_teams\": \"10\", \"num_playoff_consolation_teams\": 4, \"num_playoff_teams\": \"4\", \"pickem_enabled\": \"1\", \"player_pool\": \"ALL\", \"playoff_start_week\": \"15\", \"post_draft_players\": \"W\", \"roster_positions\": [ { \"roster_position\": { \"count\": 1, \"position\": \"QB\", \"position_type\": \"O\" } }, ... ], \"scoring_type\": \"head\", \"stat_categories\": { \"stats\": [ { \"stat\": { \"display_name\": \"Pass Yds\", \"enabled\": \"1\", \"name\": \"Passing Yards\", \"position_type\": \"O\", \"sort_order\": \"1\", \"stat_id\": 4, \"stat_position_types\": { \"stat_position_type\": { \"position_type\": \"O\" } } } }, ... ] }, \"stat_modifiers\": { \"stats\": [ { \"stat\": { \"stat_id\": 4, \"value\": \"0.04\" } }, ... ] }, \"trade_end_date\": \"2014-11-14\", \"trade_ratify_type\": \"yahoo\", \"trade_reject_time\": \"2\", \"uses_faab\": \"0\", \"uses_fractional_points\": \"1\", \"uses_lock_eliminated_teams\": 1, \"uses_negative_points\": \"1\", \"uses_playoff\": \"1\", \"uses_playoff_reseeding\": 0, \"waiver_rule\": \"gametime\", \"waiver_time\": \"2\", \"waiver_type\": \"R\" }) Returns: Settings: YFPY Settings instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /settings\" , [ \"league\" , \"settings\" ], Settings )","title":"get_league_settings"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_league_standings","text":"get_league_standings () Retrieve standings for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_league_standings () Standings({ \"teams\": [ { \"team\": { \"clinched_playoffs\": 1, \"draft_grade\": \"C+\", \"draft_position\": 7, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/8/draftrecap\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"PMTCFWSK5U5LI4SKWREUR56B5A\", \"manager_id\": \"8\", \"nickname\": \"--hidden--\" } }, \"name\": \"clam dam\", \"number_of_moves\": \"27\", \"number_of_trades\": 0, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"8\", \"team_key\": \"331.l.729259.t.8\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://s.yimg.com/cv/apiv2/default/nfl/nfl_1.png\" } }, \"team_points\": { \"coverage_type\": \"season\", \"season\": \"2014\", \"total\": \"1507.06\" }, \"team_standings\": { \"outcome_totals\": { \"losses\": 2, \"percentage\": 0.857, \"ties\": 0, \"wins\": 12 }, \"playoff_seed\": \"1\", \"points_against\": 1263.78, \"points_for\": 1507.06, \"rank\": 1, \"streak\": { \"type\": \"win\", \"value\": \"2\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/8\", \"waiver_priority\": 10 } }, ... ] }) Returns: Standings ( Standings ) \u2013 YFPY Standings instance. Source code in yfpy/query.py 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 1493 1494 1495 1496 1497 1498 1499 1500 def get_league_standings ( self ) -> Standings : \"\"\"Retrieve standings for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_standings() Standings({ \"teams\": [ { \"team\": { \"clinched_playoffs\": 1, \"draft_grade\": \"C+\", \"draft_position\": 7, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/8/draftrecap\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"PMTCFWSK5U5LI4SKWREUR56B5A\", \"manager_id\": \"8\", \"nickname\": \"--hidden--\" } }, \"name\": \"clam dam\", \"number_of_moves\": \"27\", \"number_of_trades\": 0, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"8\", \"team_key\": \"331.l.729259.t.8\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://s.yimg.com/cv/apiv2/default/nfl/nfl_1.png\" } }, \"team_points\": { \"coverage_type\": \"season\", \"season\": \"2014\", \"total\": \"1507.06\" }, \"team_standings\": { \"outcome_totals\": { \"losses\": 2, \"percentage\": 0.857, \"ties\": 0, \"wins\": 12 }, \"playoff_seed\": \"1\", \"points_against\": 1263.78, \"points_for\": 1507.06, \"rank\": 1, \"streak\": { \"type\": \"win\", \"value\": \"2\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/8\", \"waiver_priority\": 10 } }, ... ] }) Returns: Standings: YFPY Standings instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /standings\" , [ \"league\" , \"standings\" ], Standings )","title":"get_league_standings"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_league_teams","text":"get_league_teams () Retrieve teams for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_league_teams () [ Team({ \"clinched_playoffs\": 1, \"draft_grade\": \"B\", \"draft_position\": 4, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1/draftrecap\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"BMACD7S5UXV7JIQX4PGGUVQJAU\", \"manager_id\": \"1\", \"nickname\": \"--hidden--\" } }, \"name\": \"Hellacious Hill 12\", \"number_of_moves\": \"71\", \"number_of_trades\": 0, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"1\", \"team_key\": \"331.l.729259.t.1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1441/24935131299_a8242dab70_192sq.jpg?ct=fantasy\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1\", \"waiver_priority\": 9 }), ..., Team({...}) ] Returns: List [ Team ] \u2013 list[Team]: List of YFPY Team instances. Source code in yfpy/query.py 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 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 1551 1552 1553 1554 1555 1556 def get_league_teams ( self ) -> List [ Team ]: \"\"\"Retrieve teams for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_teams() [ Team({ \"clinched_playoffs\": 1, \"draft_grade\": \"B\", \"draft_position\": 4, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1/draftrecap\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"BMACD7S5UXV7JIQX4PGGUVQJAU\", \"manager_id\": \"1\", \"nickname\": \"--hidden--\" } }, \"name\": \"Hellacious Hill 12\", \"number_of_moves\": \"71\", \"number_of_trades\": 0, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"1\", \"team_key\": \"331.l.729259.t.1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1441/24935131299_a8242dab70_192sq.jpg?ct=fantasy\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1\", \"waiver_priority\": 9 }), ..., Team({...}) ] Returns: list[Team]: List of YFPY Team instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /teams\" , [ \"league\" , \"teams\" ] )","title":"get_league_teams"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_league_players","text":"get_league_players ( player_count_limit = None , player_count_start = 0 , is_retry = False , ) Retrieve valid players for chosen league. Parameters: player_count_limit ( int , default: None ) \u2013 Maximum number of players to retreive. player_count_start ( int , default: 0 ) \u2013 Index from which to retrieve all subsequent players. is_retry ( bool , default: False ) \u2013 Boolean to indicate whether the method is being retried during error handling. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_league_players ( 50 , 25 ) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"K\", \"editorial_player_key\": \"nfl.p.3727\", \"editorial_team_abbr\": \"Ind\", \"editorial_team_full_name\": \"Indianapolis Colts\", \"editorial_team_key\": \"nfl.t.11\", \"eligible_positions\": { \"position\": \"K\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/OpHvpCHjl_PQvkeQUgsjsA--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt 3PTQ2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08152019/3727.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Adam\", \"ascii_last\": \"Vinatieri\", \"first\": \"Adam\", \"full\": \"Adam Vinatieri\", \"last\": \"Vinatieri\" }, \"player_id\": \"3727\", \"player_key\": \"331.p.3727\", \"player_notes_last_timestamp\": 1568758320, \"position_type\": \"K\", \"primary_position\": \"K\", \"uniform_number\": \"4\" }), ..., Player({...}) ] Returns: List [ Player ] \u2013 list[Player]: List of YFPY Player instances. Source code in yfpy/query.py 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 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 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 def get_league_players ( self , player_count_limit : int = None , player_count_start : int = 0 , is_retry : bool = False ) -> List [ Player ]: \"\"\"Retrieve valid players for chosen league. Args: player_count_limit (int): Maximum number of players to retreive. player_count_start (int): Index from which to retrieve all subsequent players. is_retry (bool): Boolean to indicate whether the method is being retried during error handling. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_players(50, 25) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"K\", \"editorial_player_key\": \"nfl.p.3727\", \"editorial_team_abbr\": \"Ind\", \"editorial_team_full_name\": \"Indianapolis Colts\", \"editorial_team_key\": \"nfl.t.11\", \"eligible_positions\": { \"position\": \"K\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/OpHvpCHjl_PQvkeQUgsjsA--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt 3PTQ2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08152019/3727.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Adam\", \"ascii_last\": \"Vinatieri\", \"first\": \"Adam\", \"full\": \"Adam Vinatieri\", \"last\": \"Vinatieri\" }, \"player_id\": \"3727\", \"player_key\": \"331.p.3727\", \"player_notes_last_timestamp\": 1568758320, \"position_type\": \"K\", \"primary_position\": \"K\", \"uniform_number\": \"4\" }), ..., Player({...}) ] Returns: list[Player]: List of YFPY Player instances. \"\"\" league_player_count = player_count_start all_players_retrieved = False league_player_data = [] league_player_retrieval_limit = 25 while not all_players_retrieved : try : league_player_query_data = self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"start= { league_player_count } ;count= { league_player_retrieval_limit if not is_retry else 1 } \" , [ \"league\" , \"players\" ] ) league_players = ( league_player_query_data if isinstance ( league_player_query_data , list ) else [ league_player_query_data ]) league_player_count_from_query = len ( league_players ) if player_count_limit : if ( league_player_count + league_player_count_from_query ) < player_count_limit : league_player_count += league_player_count_from_query league_player_data . extend ( league_players ) else : for ndx in range ( player_count_limit - league_player_count ): league_player_data . append ( league_players [ ndx ]) league_player_count += ( player_count_limit - league_player_count ) all_players_retrieved = True else : league_player_count += league_player_count_from_query league_player_data . extend ( league_players ) except YahooFantasySportsDataNotFound as yfpy_err : if not is_retry : payload = yfpy_err . payload if payload : logger . debug ( \"No more league player data available.\" ) all_players_retrieved = True else : logger . warning ( f \"Error retrieving player batch: \" f \" { league_player_count } - { league_player_count + league_player_retrieval_limit - 1 } . \" f \"Attempting to retrieve individual players from batch.\" ) player_retrieval_successes = [] player_retrieval_failures = [] for i in range ( 25 ): try : player_data = self . get_league_players ( player_count_limit = league_player_count + 1 , player_count_start = league_player_count , is_retry = True ) player_retrieval_successes . extend ( player_data ) except YahooFantasySportsDataNotFound as nested_yfpy_err : player_retrieval_failures . append ( { \"failed_player_retrieval_index\" : league_player_count , \"failed_player_retrieval_url\" : nested_yfpy_err . url , \"failed_player_retrieval_message\" : nested_yfpy_err . message } ) league_player_count += 1 league_player_data . extend ( player_retrieval_successes ) logger . warning ( f \"Players retrieval failures: \\n { prettify_data ( player_retrieval_failures ) } \" ) else : raise yfpy_err logger . debug ( f \"League player count: { league_player_count } \" ) return league_player_data","title":"get_league_players"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_league_draft_results","text":"get_league_draft_results () Retrieve draft results for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_league_draft_results () [ DraftResult({ \"pick\": 1, \"round\": 1, \"team_key\": \"331.l.729259.t.4\", \"player_key\": \"331.p.9317\" }), ..., DraftResult({...}) ] Returns: List [ DraftResult ] \u2013 list[DraftResult]: List of YFPY DraftResult instances. Source code in yfpy/query.py 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 def get_league_draft_results ( self ) -> List [ DraftResult ]: \"\"\"Retrieve draft results for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_draft_results() [ DraftResult({ \"pick\": 1, \"round\": 1, \"team_key\": \"331.l.729259.t.4\", \"player_key\": \"331.p.9317\" }), ..., DraftResult({...}) ] Returns: list[DraftResult]: List of YFPY DraftResult instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /draftresults\" , [ \"league\" , \"draft_results\" ] )","title":"get_league_draft_results"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_league_transactions","text":"get_league_transactions () Retrieve transactions for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_league_transactions () [ Transaction({ \"players\": [ { \"player\": { \"display_position\": \"RB\", \"editorial_team_abbr\": \"NO\", \"name\": { \"ascii_first\": \"Kerwynn\", \"ascii_last\": \"Williams\", \"first\": \"Kerwynn\", \"full\": \"Kerwynn Williams\", \"last\": \"Williams\" }, \"player_id\": \"26853\", \"player_key\": \"331.p.26853\", \"position_type\": \"O\", \"transaction_data\": { \"destination_team_key\": \"331.l.729259.t.1\", \"destination_team_name\": \"Hellacious Hill 12\", \"destination_type\": \"team\", \"source_type\": \"freeagents\", \"type\": \"add\" } } } ], \"status\": \"successful\", \"timestamp\": \"1419188151\", \"transaction_id\": \"282\", \"transaction_key\": \"331.l.729259.tr.282\", \"type\": \"add/drop\" }), ..., Transaction({...}) ] Returns: List [ Transaction ] \u2013 list[Transaction]: List of YFPY Transaction instances. Source code in yfpy/query.py 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 def get_league_transactions ( self ) -> List [ Transaction ]: \"\"\"Retrieve transactions for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_transactions() [ Transaction({ \"players\": [ { \"player\": { \"display_position\": \"RB\", \"editorial_team_abbr\": \"NO\", \"name\": { \"ascii_first\": \"Kerwynn\", \"ascii_last\": \"Williams\", \"first\": \"Kerwynn\", \"full\": \"Kerwynn Williams\", \"last\": \"Williams\" }, \"player_id\": \"26853\", \"player_key\": \"331.p.26853\", \"position_type\": \"O\", \"transaction_data\": { \"destination_team_key\": \"331.l.729259.t.1\", \"destination_team_name\": \"Hellacious Hill 12\", \"destination_type\": \"team\", \"source_type\": \"freeagents\", \"type\": \"add\" } } } ], \"status\": \"successful\", \"timestamp\": \"1419188151\", \"transaction_id\": \"282\", \"transaction_key\": \"331.l.729259.tr.282\", \"type\": \"add/drop\" }), ..., Transaction({...}) ] Returns: list[Transaction]: List of YFPY Transaction instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /transactions\" , [ \"league\" , \"transactions\" ] )","title":"get_league_transactions"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_league_scoreboard_by_week","text":"get_league_scoreboard_by_week ( chosen_week ) Retrieve scoreboard for chosen league by week. Parameters: chosen_week ( int ) \u2013 Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_league_scoreboard_by_week ( 1 ) Scoreboard({ \"week\": \"1\", \"matchups\": [ { \"matchup\": { \"is_consolation\": \"0\", \"is_matchup_recap_available\": 1, \"is_playoffs\": \"0\", \"is_tied\": 0, \"matchup_grades\": [ { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.1\" } }, { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.2\" } } ], \"matchup_recap_title\": \"Wax On Wax Off Gets Victory Against Hellacious Hill 12\", \"matchup_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/recap? week=1&mid1=1&mid2=2\", \"status\": \"postevent\", \"teams\": [ { \"team\": { } }, { \"team\": { } } ], \"week\": \"1\", \"week_end\": \"2014-09-08\", \"week_start\": \"2014-09-04\", \"winner_team_key\": \"331.l.729259.t.2\" } }, ... ] }) Returns: Scoreboard ( Scoreboard ) \u2013 YFPY Scoreboard instance. Source code in yfpy/query.py 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 def get_league_scoreboard_by_week ( self , chosen_week : int ) -> Scoreboard : \"\"\"Retrieve scoreboard for chosen league by week. Args: chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_scoreboard_by_week(1) Scoreboard({ \"week\": \"1\", \"matchups\": [ { \"matchup\": { \"is_consolation\": \"0\", \"is_matchup_recap_available\": 1, \"is_playoffs\": \"0\", \"is_tied\": 0, \"matchup_grades\": [ { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.1\" } }, { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.2\" } } ], \"matchup_recap_title\": \"Wax On Wax Off Gets Victory Against Hellacious Hill 12\", \"matchup_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/recap? week=1&mid1=1&mid2=2\", \"status\": \"postevent\", \"teams\": [ { \"team\": { } }, { \"team\": { } } ], \"week\": \"1\", \"week_end\": \"2014-09-08\", \"week_start\": \"2014-09-04\", \"winner_team_key\": \"331.l.729259.t.2\" } }, ... ] }) Returns: Scoreboard: YFPY Scoreboard instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /scoreboard;\" f \"week= { chosen_week } \" , [ \"league\" , \"scoreboard\" ], Scoreboard )","title":"get_league_scoreboard_by_week"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_league_matchups_by_week","text":"get_league_matchups_by_week ( chosen_week ) Retrieve matchups for chosen league by week. Parameters: chosen_week ( int ) \u2013 Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_league_matchups_by_week ( 1 ) [ Matchup({ \"is_consolation\": \"0\", \"is_matchup_recap_available\": 1, \"is_playoffs\": \"0\", \"is_tied\": 0, \"matchup_grades\": [ { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.1\" } }, { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.2\" } } ], \"matchup_recap_title\": \"Wax On Wax Off Gets Victory Against Hellacious Hill 12\", \"matchup_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/recap? week=1&mid1=1&mid2=2\", \"status\": \"postevent\", \"teams\": [ { \"team\": { } }, { \"team\": { } } ], \"week\": \"1\", \"week_end\": \"2014-09-08\", \"week_start\": \"2014-09-04\", \"winner_team_key\": \"331.l.729259.t.2\" }), ..., Matchup({...}) ] Returns: List [ Matchup ] \u2013 list[Matchup]: List of YFPY Matchup instances. Source code in yfpy/query.py 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 def get_league_matchups_by_week ( self , chosen_week : int ) -> List [ Matchup ]: \"\"\"Retrieve matchups for chosen league by week. Args: chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_matchups_by_week(1) [ Matchup({ \"is_consolation\": \"0\", \"is_matchup_recap_available\": 1, \"is_playoffs\": \"0\", \"is_tied\": 0, \"matchup_grades\": [ { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.1\" } }, { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.2\" } } ], \"matchup_recap_title\": \"Wax On Wax Off Gets Victory Against Hellacious Hill 12\", \"matchup_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/recap? week=1&mid1=1&mid2=2\", \"status\": \"postevent\", \"teams\": [ { \"team\": { } }, { \"team\": { } } ], \"week\": \"1\", \"week_end\": \"2014-09-08\", \"week_start\": \"2014-09-04\", \"winner_team_key\": \"331.l.729259.t.2\" }), ..., Matchup({...}) ] Returns: list[Matchup]: List of YFPY Matchup instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /scoreboard;\" f \"week= { chosen_week } \" , [ \"league\" , \"scoreboard\" , \"0\" , \"matchups\" ] )","title":"get_league_matchups_by_week"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_team_info","text":"get_team_info ( team_id ) Retrieve info of specific team by team_id for chosen league. Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_team_info ( 1 ) Team({ \"clinched_playoffs\": 1, \"draft_grade\": \"B\", \"draft_position\": 4, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1/draftrecap\", \"draft_results\": [ ... ], \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"BMACD7S5UXV7JIQX4PGGUVQJAU\", \"manager_id\": \"1\", \"nickname\": \"--hidden--\" } }, \"matchups\": [ ... ], \"name\": \"Hellacious Hill 12\", \"number_of_moves\": \"71\", \"number_of_trades\": 0, \"roster\": { ... }, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"1\", \"team_key\": \"331.l.729259.t.1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1441/24935131299_a8242dab70_192sq.jpg?ct=fantasy\" } }, \"team_points\": { \"coverage_type\": \"season\", \"season\": \"2014\", \"total\": \"1409.24\" }, \"team_standings\": { \"outcome_totals\": { \"losses\": 5, \"percentage\": 0.643, \"ties\": 0, \"wins\": 9 }, \"playoff_seed\": \"2\", \"points_against\": 1266.6599999999999, \"points_for\": 1409.24, \"rank\": 2, \"streak\": { \"type\": \"win\", \"value\": \"1\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1\", \"waiver_priority\": 9 }) Returns: Team ( Team ) \u2013 YFPY Team instance. Source code in yfpy/query.py 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 def get_team_info ( self , team_id : Union [ str , int ]) -> Team : \"\"\"Retrieve info of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_info(1) Team({ \"clinched_playoffs\": 1, \"draft_grade\": \"B\", \"draft_position\": 4, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1/draftrecap\", \"draft_results\": [ ... ], \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"BMACD7S5UXV7JIQX4PGGUVQJAU\", \"manager_id\": \"1\", \"nickname\": \"--hidden--\" } }, \"matchups\": [ ... ], \"name\": \"Hellacious Hill 12\", \"number_of_moves\": \"71\", \"number_of_trades\": 0, \"roster\": { ... }, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"1\", \"team_key\": \"331.l.729259.t.1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1441/24935131299_a8242dab70_192sq.jpg?ct=fantasy\" } }, \"team_points\": { \"coverage_type\": \"season\", \"season\": \"2014\", \"total\": \"1409.24\" }, \"team_standings\": { \"outcome_totals\": { \"losses\": 5, \"percentage\": 0.643, \"ties\": 0, \"wins\": 9 }, \"playoff_seed\": \"2\", \"points_against\": 1266.6599999999999, \"points_for\": 1409.24, \"rank\": 2, \"streak\": { \"type\": \"win\", \"value\": \"1\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1\", \"waiver_priority\": 9 }) Returns: Team: YFPY Team instance. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } ;\" f \"out=metadata,stats,standings,roster,draftresults,matchups\" , [ \"team\" ], Team )","title":"get_team_info"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_team_metadata","text":"get_team_metadata ( team_id ) Retrieve metadata of specific team by team_id for chosen league. Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_team_metadata ( 1 ) Team({ \"team_key\": \"331.l.729259.t.1\", \"team_id\": \"1\", \"name\": \"Hellacious Hill 12\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1441/24935131299_a8242dab70_192sq.jpg?ct=fantasy\" } }, \"waiver_priority\": 9, \"number_of_moves\": \"71\", \"number_of_trades\": 0, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"clinched_playoffs\": 1, \"league_scoring_type\": \"head\", \"draft_position\": 4, \"has_draft_grade\": 1, \"draft_grade\": \"B\", \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1/draftrecap\", \"managers\": { \"manager\": { \"guid\": \"BMACD7S5UXV7JIQX4PGGUVQJAU\", \"manager_id\": \"1\", \"nickname\": \"--hidden--\" } } }) Returns: Team ( Team ) \u2013 YFPY Team instance. Source code in yfpy/query.py 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 def get_team_metadata ( self , team_id : Union [ str , int ]) -> Team : \"\"\"Retrieve metadata of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_metadata(1) Team({ \"team_key\": \"331.l.729259.t.1\", \"team_id\": \"1\", \"name\": \"Hellacious Hill 12\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1441/24935131299_a8242dab70_192sq.jpg?ct=fantasy\" } }, \"waiver_priority\": 9, \"number_of_moves\": \"71\", \"number_of_trades\": 0, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"clinched_playoffs\": 1, \"league_scoring_type\": \"head\", \"draft_position\": 4, \"has_draft_grade\": 1, \"draft_grade\": \"B\", \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1/draftrecap\", \"managers\": { \"manager\": { \"guid\": \"BMACD7S5UXV7JIQX4PGGUVQJAU\", \"manager_id\": \"1\", \"nickname\": \"--hidden--\" } } }) Returns: Team: YFPY Team instance. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /metadata\" , [ \"team\" ], Team )","title":"get_team_metadata"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_team_stats","text":"get_team_stats ( team_id ) Retrieve stats of specific team by team_id for chosen league. Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_team_stats ( 1 ) TeamPoints({ \"coverage_type\": \"season\", \"season\": \"2014\", \"total\": \"1409.24\" }) Returns: TeamPoints ( TeamPoints ) \u2013 YFPY TeamPoints instance. Source code in yfpy/query.py 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 def get_team_stats ( self , team_id : Union [ str , int ]) -> TeamPoints : \"\"\"Retrieve stats of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_stats(1) TeamPoints({ \"coverage_type\": \"season\", \"season\": \"2014\", \"total\": \"1409.24\" }) Returns: TeamPoints: YFPY TeamPoints instance. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /stats\" , [ \"team\" , \"team_points\" ], TeamPoints )","title":"get_team_stats"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_team_stats_by_week","text":"get_team_stats_by_week ( team_id , chosen_week = 'current' ) Retrieve stats of specific team by team_id and by week for chosen league. Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week ( int , default: 'current' ) \u2013 Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_team_stats_by_week ( 1 , 1 ) { \"team_points\": TeamPoints({ \"coverage_type\": \"week\", \"total\": \"95.06\", \"week\": \"1\" }), \"team_projected_points\": TeamProjectedPoints({ \"coverage_type\": \"week\", \"total\": \"78.85\", \"week\": \"1\" }) } Returns: Dict [ str , Union [ TeamPoints , TeamProjectedPoints ]] \u2013 dict[str, TeamPoints | TeamProjectedPoints]: Dictionary containing keys \"team_points\" and \"team_projected_points\" with respective values YFPY TeamPoints and YFPY TeamProjectedPoints instances. Source code in yfpy/query.py 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 def get_team_stats_by_week ( self , team_id : Union [ str , int ], chosen_week : Union [ int , str ] = \"current\" ) -> Dict [ str , Union [ TeamPoints , TeamProjectedPoints ]]: \"\"\"Retrieve stats of specific team by team_id and by week for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_stats_by_week(1, 1) { \"team_points\": TeamPoints({ \"coverage_type\": \"week\", \"total\": \"95.06\", \"week\": \"1\" }), \"team_projected_points\": TeamProjectedPoints({ \"coverage_type\": \"week\", \"total\": \"78.85\", \"week\": \"1\" }) } Returns: dict[str, TeamPoints | TeamProjectedPoints]: Dictionary containing keys \"team_points\" and \"team_projected_points\" with respective values YFPY TeamPoints and YFPY TeamProjectedPoints instances. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /stats;type=week;week= { chosen_week } \" , [ \"team\" , [ \"team_points\" , \"team_projected_points\" ]] )","title":"get_team_stats_by_week"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_team_standings","text":"get_team_standings ( team_id ) Retrieve standings of specific team by team_id for chosen league. Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_team_standings ( 1 ) TeamStandings({ \"rank\": 2, \"playoff_seed\": \"2\", \"outcome_totals\": { \"losses\": 5, \"percentage\": 0.643, \"ties\": 0, \"wins\": 9 }, \"streak\": { \"type\": \"win\", \"value\": \"1\" }, \"points_for\": \"1409.24\", \"points_against\": 1266.6599999999999 }) Returns: TeamStandings ( TeamStandings ) \u2013 YFPY TeamStandings instance. Source code in yfpy/query.py 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 def get_team_standings ( self , team_id : Union [ str , int ]) -> TeamStandings : \"\"\"Retrieve standings of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_standings(1) TeamStandings({ \"rank\": 2, \"playoff_seed\": \"2\", \"outcome_totals\": { \"losses\": 5, \"percentage\": 0.643, \"ties\": 0, \"wins\": 9 }, \"streak\": { \"type\": \"win\", \"value\": \"1\" }, \"points_for\": \"1409.24\", \"points_against\": 1266.6599999999999 }) Returns: TeamStandings: YFPY TeamStandings instance. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /standings\" , [ \"team\" , \"team_standings\" ], TeamStandings )","title":"get_team_standings"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_team_roster_by_week","text":"get_team_roster_by_week ( team_id , chosen_week = 'current' ) Retrieve roster of specific team by team_id and by week for chosen league. Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week ( int , default: 'current' ) \u2013 Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_team_roster_by_week ( 1 , 1 ) Roster({ \"coverage_type\": \"week\", \"week\": \"1\", \"is_editable\": 0, \"players\": [ { \"player\": { \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt 3PTQ2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"1\" }, \"uniform_number\": \"12\" } }, ... ] }) Returns: Roster ( Roster ) \u2013 YFPY Roster instance. Source code in yfpy/query.py 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 def get_team_roster_by_week ( self , team_id : Union [ str , int ], chosen_week : Union [ int , str ] = \"current\" ) -> Roster : \"\"\"Retrieve roster of specific team by team_id and by week for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_roster_by_week(1, 1) Roster({ \"coverage_type\": \"week\", \"week\": \"1\", \"is_editable\": 0, \"players\": [ { \"player\": { \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt 3PTQ2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"1\" }, \"uniform_number\": \"12\" } }, ... ] }) Returns: Roster: YFPY Roster instance. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /roster;week= { chosen_week } \" , [ \"team\" , \"roster\" ], Roster )","title":"get_team_roster_by_week"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_team_roster_player_info_by_week","text":"get_team_roster_player_info_by_week ( team_id , chosen_week = \"current\" ) Retrieve roster with ALL player info of specific team by team_id and by week for chosen league. Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week ( int , default: 'current' ) \u2013 Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_team_roster_player_info_by_week ( 1 , 1 ) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"draft_analysis\": { \"average_pick\": \"65.9\", \"average_round\": \"7.6\", \"average_cost\": \"5.0\", \"percent_drafted\": \"1.00\" }, \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/ https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"ownership\": { \"ownership_type\": \"team\", \"owner_team_key\": \"331.l.729259.t.1\", \"owner_team_name\": \"Hellacious Hill 12\" }, \"percent_owned\": { \"coverage_type\": \"week\", \"week\": \"17\", \"value\": 99, \"delta\": \"0\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"player_points\": { \"coverage_type\": \"week\", \"week\": \"1\", \"total\": 10.26 }, \"player_stats\": { \"coverage_type\": \"week\", \"week\": \"1\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"249\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"1\" }, \"uniform_number\": \"12\" }), ..., Player({...}) ] Returns: List [ Player ] \u2013 list[Player]: List of YFPY Player instances containing attributes \"draft_analysis\", \"ownership\", \"percent_owned\", and \"player_stats\". Source code in yfpy/query.py 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 def get_team_roster_player_info_by_week ( self , team_id : Union [ str , int ], chosen_week : Union [ int , str ] = \"current\" ) -> List [ Player ]: \"\"\"Retrieve roster with ALL player info of specific team by team_id and by week for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_roster_player_info_by_week(1, 1) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"draft_analysis\": { \"average_pick\": \"65.9\", \"average_round\": \"7.6\", \"average_cost\": \"5.0\", \"percent_drafted\": \"1.00\" }, \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/ https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"ownership\": { \"ownership_type\": \"team\", \"owner_team_key\": \"331.l.729259.t.1\", \"owner_team_name\": \"Hellacious Hill 12\" }, \"percent_owned\": { \"coverage_type\": \"week\", \"week\": \"17\", \"value\": 99, \"delta\": \"0\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"player_points\": { \"coverage_type\": \"week\", \"week\": \"1\", \"total\": 10.26 }, \"player_stats\": { \"coverage_type\": \"week\", \"week\": \"1\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"249\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"1\" }, \"uniform_number\": \"12\" }), ..., Player({...}) ] Returns: list[Player]: List of YFPY Player instances containing attributes \"draft_analysis\", \"ownership\", \"percent_owned\", and \"player_stats\". \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /roster;week= { chosen_week } /players;\" f \"out=metadata,stats,ownership,percent_owned,draft_analysis\" , [ \"team\" , \"roster\" , \"0\" , \"players\" ] )","title":"get_team_roster_player_info_by_week"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_team_roster_player_info_by_date","text":"get_team_roster_player_info_by_date ( team_id , chosen_date = None ) Retrieve roster with ALL player info of specific team by team_id and by date for chosen league. Note This applies to MLB, NBA, and NHL leagues, but does NOT apply to NFL leagues. This query will FAIL if you pass it an INVALID date string! Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_date ( str , default: None ) \u2013 Selected date for which to retrieve data. REQUIRED FORMAT: YYYY-MM-DD (Ex. 2011-05-01) Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nhl\" ) >>> query . get_team_roster_player_info_by_date ( 1 , \"2011-05-01\" ) [ Player({ \"display_position\": \"C\", \"draft_analysis\": { \"average_pick\": 33.2, \"average_round\": 3.5, \"average_cost\": 39.2, \"percent_drafted\": 1.0 }, \"editorial_player_key\": \"nhl.p.3981\", \"editorial_team_abbr\": \"Chi\", \"editorial_team_full_name\": \"Chicago Blackhawks\", \"editorial_team_key\": \"nhl.t.4\", \"eligible_positions\": [ \"C\", \"F\" ], \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/tz.KOMoEiBDch6AJAGaUtg--~C/ YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/ https://s.yimg.com/xe/i/us/sp/v/nhl_cutout/players_l/11032021/3981.png\" }, \"is_editable\": 0, \"is_undroppable\": 0, \"name\": { \"ascii_first\": \"Jonathan\", \"ascii_last\": \"Toews\", \"first\": \"Jonathan\", \"full\": \"Jonathan Toews\", \"last\": \"Toews\" }, \"ownership\": { \"ownership_type\": \"team\", \"owner_team_key\": \"303.l.69624.t.2\", \"owner_team_name\": \"The Bateleurs\" }, \"percent_owned\": { \"coverage_type\": \"week\", \"week\": 25, \"value\": 98, \"delta\": -1.0 }, \"player_id\": 3981, \"player_key\": \"303.p.3981\", \"player_notes_last_timestamp\": 1651606838, \"player_stats\": { \"coverage_type\": \"date\", \"stats\": [ { \"stat\": { \"stat_id\": 1, \"value\": 1.0 } }, ... ] }, \"position_type\": \"P\", \"primary_position\": \"C\", \"selected_position\": { \"coverage_type\": \"date\", \"is_flex\": 0, \"position\": \"C\" }, \"uniform_number\": 19 }), ..., Player({...}) ] Returns: List [ Player ] \u2013 list[Player]: List of YFPY Player instances containing attributes \"draft_analysis\", \"ownership\", \"percent_owned\", and \"player_stats\". Source code in yfpy/query.py 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 def get_team_roster_player_info_by_date ( self , team_id : Union [ str , int ], chosen_date : str = None ) -> List [ Player ]: \"\"\"Retrieve roster with ALL player info of specific team by team_id and by date for chosen league. Note: This applies to MLB, NBA, and NHL leagues, but does NOT apply to NFL leagues. This query will FAIL if you pass it an INVALID date string! Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_date (str): Selected date for which to retrieve data. REQUIRED FORMAT: YYYY-MM-DD (Ex. 2011-05-01) Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nhl\") >>> query.get_team_roster_player_info_by_date(1, \"2011-05-01\") [ Player({ \"display_position\": \"C\", \"draft_analysis\": { \"average_pick\": 33.2, \"average_round\": 3.5, \"average_cost\": 39.2, \"percent_drafted\": 1.0 }, \"editorial_player_key\": \"nhl.p.3981\", \"editorial_team_abbr\": \"Chi\", \"editorial_team_full_name\": \"Chicago Blackhawks\", \"editorial_team_key\": \"nhl.t.4\", \"eligible_positions\": [ \"C\", \"F\" ], \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/tz.KOMoEiBDch6AJAGaUtg--~C/ YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/ https://s.yimg.com/xe/i/us/sp/v/nhl_cutout/players_l/11032021/3981.png\" }, \"is_editable\": 0, \"is_undroppable\": 0, \"name\": { \"ascii_first\": \"Jonathan\", \"ascii_last\": \"Toews\", \"first\": \"Jonathan\", \"full\": \"Jonathan Toews\", \"last\": \"Toews\" }, \"ownership\": { \"ownership_type\": \"team\", \"owner_team_key\": \"303.l.69624.t.2\", \"owner_team_name\": \"The Bateleurs\" }, \"percent_owned\": { \"coverage_type\": \"week\", \"week\": 25, \"value\": 98, \"delta\": -1.0 }, \"player_id\": 3981, \"player_key\": \"303.p.3981\", \"player_notes_last_timestamp\": 1651606838, \"player_stats\": { \"coverage_type\": \"date\", \"stats\": [ { \"stat\": { \"stat_id\": 1, \"value\": 1.0 } }, ... ] }, \"position_type\": \"P\", \"primary_position\": \"C\", \"selected_position\": { \"coverage_type\": \"date\", \"is_flex\": 0, \"position\": \"C\" }, \"uniform_number\": 19 }), ..., Player({...}) ] Returns: list[Player]: List of YFPY Player instances containing attributes \"draft_analysis\", \"ownership\", \"percent_owned\", and \"player_stats\". \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /\" f \"roster { ';date=' + str ( chosen_date ) if chosen_date else '' } /players;\" f \"out=metadata,stats,ownership,percent_owned,draft_analysis\" , [ \"team\" , \"roster\" , \"0\" , \"players\" ] )","title":"get_team_roster_player_info_by_date"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_team_roster_player_stats","text":"get_team_roster_player_stats ( team_id ) Retrieve roster with ALL player info for the season of specific team by team_id and for chosen league. Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_team_roster_player_stats ( 1 ) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"draft_analysis\": { \"average_pick\": \"65.9\", \"average_round\": \"7.6\", \"average_cost\": \"5.0\", \"percent_drafted\": \"1.00\" }, \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"player_points\": { \"coverage_type\": \"season\", \"total\": 287.06 }, \"player_stats\": { \"coverage_type\": \"season\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"4109\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"16\" }, \"uniform_number\": \"12\" }), ..., Player({...}) ] Returns: List [ Player ] \u2013 list[Player]: List of YFPY Player instances containing attributes \"draft_analysis\", \"ownership\", \"percent_owned\", and \"player_stats\". Source code in yfpy/query.py 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 def get_team_roster_player_stats ( self , team_id : Union [ str , int ]) -> List [ Player ]: \"\"\"Retrieve roster with ALL player info for the season of specific team by team_id and for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_roster_player_stats(1) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"draft_analysis\": { \"average_pick\": \"65.9\", \"average_round\": \"7.6\", \"average_cost\": \"5.0\", \"percent_drafted\": \"1.00\" }, \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"player_points\": { \"coverage_type\": \"season\", \"total\": 287.06 }, \"player_stats\": { \"coverage_type\": \"season\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"4109\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"16\" }, \"uniform_number\": \"12\" }), ..., Player({...}) ] Returns: list[Player]: List of YFPY Player instances containing attributes \"draft_analysis\", \"ownership\", \"percent_owned\", and \"player_stats\". \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /roster/players/stats;type=season\" , [ \"team\" , \"roster\" , \"0\" , \"players\" ] )","title":"get_team_roster_player_stats"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_team_roster_player_stats_by_week","text":"get_team_roster_player_stats_by_week ( team_id , chosen_week = \"current\" ) Retrieve roster with player stats of specific team by team_id and by week for chosen league. Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week ( int , default: 'current' ) \u2013 Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_team_roster_player_stats_by_week ( 1 , 1 ) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt 3PTQ2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"player_points\": { \"coverage_type\": \"week\", \"week\": \"1\", \"total\": 10.26 }, \"player_stats\": { \"coverage_type\": \"week\", \"week\": \"1\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"249\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"1\" }, \"uniform_number\": \"12\" }), ..., Player({...}) ] Returns: List [ Player ] \u2013 list[Player]: List of YFPY Player instances containing attribute \"player_stats\". Source code in yfpy/query.py 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 def get_team_roster_player_stats_by_week ( self , team_id : Union [ str , int ], chosen_week : Union [ int , str ] = \"current\" ) -> List [ Player ]: \"\"\"Retrieve roster with player stats of specific team by team_id and by week for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_roster_player_stats_by_week(1, 1) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt 3PTQ2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"player_points\": { \"coverage_type\": \"week\", \"week\": \"1\", \"total\": 10.26 }, \"player_stats\": { \"coverage_type\": \"week\", \"week\": \"1\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"249\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"1\" }, \"uniform_number\": \"12\" }), ..., Player({...}) ] Returns: list[Player]: List of YFPY Player instances containing attribute \"player_stats\". \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /roster;week= { chosen_week } /players/stats\" , [ \"team\" , \"roster\" , \"0\" , \"players\" ] )","title":"get_team_roster_player_stats_by_week"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_team_draft_results","text":"get_team_draft_results ( team_id ) Retrieve draft results of specific team by team_id for chosen league. Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_team_draft_results ( 1 ) [ DraftResult({ \"pick\": 4, \"round\": 1, \"team_key\": \"331.l.729259.t.1\", \"player_key\": \"331.p.8256\" }), ..., DraftResults({...}) ] Returns: List [ DraftResult ] \u2013 list[DraftResult]: List of YFPY DraftResult instances. Source code in yfpy/query.py 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 def get_team_draft_results ( self , team_id : Union [ str , int ]) -> List [ DraftResult ]: \"\"\"Retrieve draft results of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_draft_results(1) [ DraftResult({ \"pick\": 4, \"round\": 1, \"team_key\": \"331.l.729259.t.1\", \"player_key\": \"331.p.8256\" }), ..., DraftResults({...}) ] Returns: list[DraftResult]: List of YFPY DraftResult instances. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /draftresults\" , [ \"team\" , \"draft_results\" ] )","title":"get_team_draft_results"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_team_matchups","text":"get_team_matchups ( team_id ) Retrieve matchups of specific team by team_id for chosen league. Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_team_matchups ( 1 ) [ Matchup({ (see get_league_matchups_by_week docstring for matchup data example) }) ] Returns: List [ Matchup ] \u2013 list[Matchup]: List of YFPY Matchup instances. Source code in yfpy/query.py 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 def get_team_matchups ( self , team_id : Union [ str , int ]) -> List [ Matchup ]: \"\"\"Retrieve matchups of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_matchups(1) [ Matchup({ (see get_league_matchups_by_week docstring for matchup data example) }) ] Returns: list[Matchup]: List of YFPY Matchup instances. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /matchups\" , [ \"team\" , \"matchups\" ] )","title":"get_team_matchups"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_player_stats_for_season","text":"get_player_stats_for_season ( player_key , limit_to_league_stats = True ) Retrieve stats of specific player by player_key for the entire season for chosen league. Parameters: player_key ( str ) \u2013 The player key of chosen player (example: 331.p.7200 - .p. ). limit_to_league_stats ( bool , default: True ) \u2013 Boolean (default: True) to limit the retrieved player stats to those for the selected league. When set to False, query retrieves all player stats for the game (NFL, NHL, NBA, MLB). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_player_stats_for_season ( \"331.p.7200\" ) Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"player_points\": { \"coverage_type\": \"season\", \"total\": 359.14 }, \"player_stats\": { \"coverage_type\": \"season\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"4381\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player ( Player ) \u2013 YFPY Player instance. Source code in yfpy/query.py 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 def get_player_stats_for_season ( self , player_key : str , limit_to_league_stats : bool = True ) -> Player : \"\"\"Retrieve stats of specific player by player_key for the entire season for chosen league. Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). limit_to_league_stats (bool): Boolean (default: True) to limit the retrieved player stats to those for the selected league. When set to False, query retrieves all player stats for the game (NFL, NHL, NBA, MLB). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_player_stats_for_season(\"331.p.7200\") Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"player_points\": { \"coverage_type\": \"season\", \"total\": 359.14 }, \"player_stats\": { \"coverage_type\": \"season\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"4381\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player: YFPY Player instance. \"\"\" if limit_to_league_stats : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /stats\" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player ) else : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/players;\" f \"player_keys= { player_key } /stats\" , [ \"players\" , \"0\" , \"player\" ], Player )","title":"get_player_stats_for_season"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_player_stats_by_week","text":"get_player_stats_by_week ( player_key , chosen_week = \"current\" , limit_to_league_stats = True , ) Retrieve stats of specific player by player_key and by week for chosen league. Parameters: player_key ( str ) \u2013 The player key of chosen player (example: 331.p.7200 - .p. ). chosen_week ( int , default: 'current' ) \u2013 Selected week for which to retrieve data. limit_to_league_stats ( bool , default: True ) \u2013 Boolean (default: True) to limit the retrieved player stats to those for the selected league. When set to False, query retrieves all player stats for the game (NFL, NHL, NBA, MLB). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_player_stats_by_week ( \"331.p.7200\" , 1 ) Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"player_points\": { \"coverage_type\": \"week\", \"week\": \"1\", \"total\": 10.56 }, \"player_stats\": { \"coverage_type\": \"week\", \"week\": \"1\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"189\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player ( Player ) \u2013 YFPY Player instance containing attribute \"player_stats\". Source code in yfpy/query.py 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 def get_player_stats_by_week ( self , player_key : str , chosen_week : Union [ int , str ] = \"current\" , limit_to_league_stats : bool = True ) -> Player : \"\"\"Retrieve stats of specific player by player_key and by week for chosen league. Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). chosen_week (int): Selected week for which to retrieve data. limit_to_league_stats (bool): Boolean (default: True) to limit the retrieved player stats to those for the selected league. When set to False, query retrieves all player stats for the game (NFL, NHL, NBA, MLB). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_player_stats_by_week(\"331.p.7200\", 1) Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"player_points\": { \"coverage_type\": \"week\", \"week\": \"1\", \"total\": 10.56 }, \"player_stats\": { \"coverage_type\": \"week\", \"week\": \"1\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"189\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player: YFPY Player instance containing attribute \"player_stats\". \"\"\" if limit_to_league_stats : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /stats;type=week;week= { chosen_week } \" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player ) else : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/players;\" f \"player_keys= { player_key } /stats;type=week;week= { chosen_week } \" , [ \"players\" , \"0\" , \"player\" ], Player )","title":"get_player_stats_by_week"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_player_stats_by_date","text":"get_player_stats_by_date ( player_key , chosen_date = None , limit_to_league_stats = True ) Retrieve player stats by player_key and by date for chosen league. Note This applies to MLB, NBA, and NHL leagues, but does NOT apply to NFL leagues. This query will FAIL if you pass it an INVALID date string! Parameters: player_key ( str ) \u2013 The player key of chosen player (example: 331.p.7200 - .p. ). chosen_date ( str , default: None ) \u2013 Selected date for which to retrieve data. REQUIRED FORMAT: YYYY-MM-DD (Ex. 2011-05-01) limit_to_league_stats ( bool , default: True ) \u2013 Boolean (default: True) to limit the retrieved player stats to those for the selected league. When set to False, query retrieves all player stats for the game (NFL, NHL, NBA, MLB). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nhl\" ) >>> query . get_player_stats_by_date ( \"nhl.p.4588\" , \"2011-05-01\" ) Player({ \"display_position\": \"G\", \"editorial_player_key\": \"nhl.p.4588\", \"editorial_team_abbr\": \"Was\", \"editorial_team_full_name\": \"Washington Capitals\", \"editorial_team_key\": \"nhl.t.23\", \"eligible_positions\": { \"position\": \"G\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/CzntDh_d59voTqU6fhQy3g--~C/YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2 NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/https://s.yimg.com/ xe/i/us/sp/v/nhl_cutout/players_l/10182019/4588.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Braden\", \"ascii_last\": \"Holtby\", \"first\": \"Braden\", \"full\": \"Braden Holtby\", \"last\": \"Holtby\" }, \"player_id\": \"4588\", \"player_key\": \"303.p.4588\", \"player_notes_last_timestamp\": 1574133600, \"player_stats\": { \"coverage_type\": \"date\", \"stats\": [ { \"stat\": { \"stat_id\": \"19\", \"value\": \"1\" } }, { \"stat\": { \"stat_id\": \"22\", \"value\": \"1\" } }, { \"stat\": { \"stat_id\": \"23\", \"value\": \"1.00\" } }, { \"stat\": { \"stat_id\": \"25\", \"value\": \"29\" } }, { \"stat\": { \"stat_id\": \"24\", \"value\": \"30\" } }, { \"stat\": { \"stat_id\": \"26\", \"value\": \".967\" } }, { \"stat\": { \"stat_id\": \"27\", \"value\": \"0\" } } ] }, \"position_type\": \"G\", \"primary_position\": \"G\", \"uniform_number\": \"70\" }) Returns: Player ( Player ) \u2013 YFPY Player instnace containing attribute \"player_stats\". Source code in yfpy/query.py 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 def get_player_stats_by_date ( self , player_key : str , chosen_date : str = None , limit_to_league_stats : bool = True ) -> Player : \"\"\"Retrieve player stats by player_key and by date for chosen league. Note: This applies to MLB, NBA, and NHL leagues, but does NOT apply to NFL leagues. This query will FAIL if you pass it an INVALID date string! Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). chosen_date (str): Selected date for which to retrieve data. REQUIRED FORMAT: YYYY-MM-DD (Ex. 2011-05-01) limit_to_league_stats (bool): Boolean (default: True) to limit the retrieved player stats to those for the selected league. When set to False, query retrieves all player stats for the game (NFL, NHL, NBA, MLB). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nhl\") >>> query.get_player_stats_by_date(\"nhl.p.4588\", \"2011-05-01\") Player({ \"display_position\": \"G\", \"editorial_player_key\": \"nhl.p.4588\", \"editorial_team_abbr\": \"Was\", \"editorial_team_full_name\": \"Washington Capitals\", \"editorial_team_key\": \"nhl.t.23\", \"eligible_positions\": { \"position\": \"G\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/CzntDh_d59voTqU6fhQy3g--~C/YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2 NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/https://s.yimg.com/ xe/i/us/sp/v/nhl_cutout/players_l/10182019/4588.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Braden\", \"ascii_last\": \"Holtby\", \"first\": \"Braden\", \"full\": \"Braden Holtby\", \"last\": \"Holtby\" }, \"player_id\": \"4588\", \"player_key\": \"303.p.4588\", \"player_notes_last_timestamp\": 1574133600, \"player_stats\": { \"coverage_type\": \"date\", \"stats\": [ { \"stat\": { \"stat_id\": \"19\", \"value\": \"1\" } }, { \"stat\": { \"stat_id\": \"22\", \"value\": \"1\" } }, { \"stat\": { \"stat_id\": \"23\", \"value\": \"1.00\" } }, { \"stat\": { \"stat_id\": \"25\", \"value\": \"29\" } }, { \"stat\": { \"stat_id\": \"24\", \"value\": \"30\" } }, { \"stat\": { \"stat_id\": \"26\", \"value\": \".967\" } }, { \"stat\": { \"stat_id\": \"27\", \"value\": \"0\" } } ] }, \"position_type\": \"G\", \"primary_position\": \"G\", \"uniform_number\": \"70\" }) Returns: Player: YFPY Player instnace containing attribute \"player_stats\". \"\"\" if limit_to_league_stats : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /stats;type=date;date= { chosen_date } \" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player ) else : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/players;\" f \"player_keys= { player_key } /stats;type=date;date= { chosen_date } \" , [ \"players\" , \"0\" , \"player\" ], Player )","title":"get_player_stats_by_date"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_player_ownership","text":"get_player_ownership ( player_key ) Retrieve ownership of specific player by player_key for chosen league. Parameters: player_key ( str ) \u2013 The player key of chosen player (example: 331.p.7200 - .p. ). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_player_ownership ( \"331.p.7200\" ) Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"ownership\": { \"ownership_type\": \"team\", \"owner_team_key\": \"331.l.729259.t.4\", \"owner_team_name\": \"hold my D\", \"teams\": { \"team\": { \"clinched_playoffs\": 1, \"draft_grade\": \"B-\", \"draft_position\": 1, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/4/draftrecap\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"5KLNXUYW5RP22UMRKUXHBCIITI\", \"manager_id\": \"4\", \"nickname\": \"--hidden--\" } }, \"name\": \"hold my D\", \"number_of_moves\": \"27\", \"number_of_trades\": \"1\", \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"4\", \"team_key\": \"331.l.729259.t.4\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1589/24677593583_68859308dd_192sq.jpg?ct=fantasy\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/4\", \"waiver_priority\": 7 } } }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player ( Player ) \u2013 YFPY Player instance containing attribute \"ownership\". Source code in yfpy/query.py 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 def get_player_ownership ( self , player_key : str ) -> Player : \"\"\"Retrieve ownership of specific player by player_key for chosen league. Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_player_ownership(\"331.p.7200\") Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"ownership\": { \"ownership_type\": \"team\", \"owner_team_key\": \"331.l.729259.t.4\", \"owner_team_name\": \"hold my D\", \"teams\": { \"team\": { \"clinched_playoffs\": 1, \"draft_grade\": \"B-\", \"draft_position\": 1, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/4/draftrecap\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"5KLNXUYW5RP22UMRKUXHBCIITI\", \"manager_id\": \"4\", \"nickname\": \"--hidden--\" } }, \"name\": \"hold my D\", \"number_of_moves\": \"27\", \"number_of_trades\": \"1\", \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"4\", \"team_key\": \"331.l.729259.t.4\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1589/24677593583_68859308dd_192sq.jpg?ct=fantasy\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/4\", \"waiver_priority\": 7 } } }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player: YFPY Player instance containing attribute \"ownership\". \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /ownership\" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player )","title":"get_player_ownership"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_player_percent_owned_by_week","text":"get_player_percent_owned_by_week ( player_key , chosen_week = \"current\" ) Retrieve percent-owned of specific player by player_key and by week for chosen league. Parameters: player_key ( str ) \u2013 The player key of chosen player (example: 331.p.7200 - .p. ). chosen_week ( int , default: 'current' ) \u2013 Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_player_percent_owned_by_week ( \"331.p.7200\" , 1 ) Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/ https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"percent_owned\": { \"coverage_type\": \"week\", \"week\": \"1\", \"value\": 100, \"delta\": \"0\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player ( Player ) \u2013 YFPY Player instance containing attribute \"percent_owned\". Source code in yfpy/query.py 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 def get_player_percent_owned_by_week ( self , player_key : str , chosen_week : Union [ int , str ] = \"current\" ) -> Player : \"\"\"Retrieve percent-owned of specific player by player_key and by week for chosen league. Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_player_percent_owned_by_week(\"331.p.7200\", 1) Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/ https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"percent_owned\": { \"coverage_type\": \"week\", \"week\": \"1\", \"value\": 100, \"delta\": \"0\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player: YFPY Player instance containing attribute \"percent_owned\". \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /percent_owned;type=week;week= { chosen_week } \" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player )","title":"get_player_percent_owned_by_week"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_player_draft_analysis","text":"get_player_draft_analysis ( player_key ) Retrieve draft analysis of specific player by player_key for chosen league. Parameters: player_key ( str ) \u2013 The player key of chosen player (example: 331.p.7200 - .p. ). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_player_draft_analysis ( \"331.p.7200\" ) Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"draft_analysis\": { \"average_pick\": \"19.9\", \"average_round\": \"2.8\", \"average_cost\": \"38.5\", \"percent_drafted\": \"1.00\" }, \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player ( Player ) \u2013 YFPY Player instance containing attribute \"draft_analysis\". Source code in yfpy/query.py 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 def get_player_draft_analysis ( self , player_key : str ) -> Player : \"\"\"Retrieve draft analysis of specific player by player_key for chosen league. Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_player_draft_analysis(\"331.p.7200\") Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"draft_analysis\": { \"average_pick\": \"19.9\", \"average_round\": \"2.8\", \"average_cost\": \"38.5\", \"percent_drafted\": \"1.00\" }, \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player: YFPY Player instance containing attribute \"draft_analysis\". \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /draft_analysis\" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player )","title":"get_player_draft_analysis"},{"location":"quickstart/","text":"# -*- coding: utf-8 -*- \"\"\"YFPY demo. \"\"\" __author__ = \"Wren J. R. (uberfastman)\" __email__ = \"uberfastman@uberfastman.dev\" import os import sys from logging import DEBUG from pathlib import Path project_dir = Path ( __file__ ) . parent . parent sys . path . insert ( 0 , str ( project_dir )) from yfpy import Data # noqa: E402 from yfpy.logger import get_logger # noqa: E402 from yfpy.query import YahooFantasySportsQuery # noqa: E402 \"\"\" Example public Yahoo league URL: \"https://archive.fantasysports.yahoo.com/nfl/2014/729259\" Example vars using public Yahoo leagues still require auth through a personal Yahoo account: see README.md \"\"\" # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # ENVIRONMENT SETUP # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # set target directory for data output data_dir = Path ( __file__ ) . parent / \"output\" # create YFPY Data instance for saving/loading data data = Data ( data_dir ) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # VARIABLE SETUP # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # set desired season year def get_season (): # season = 2012 # season = 2013 # season = 2014 # season = 2015 # season = 2016 # season = 2017 # season = 2018 # season = 2019 # season = 2020 # season = 2021 # season = 2022 # season = 2023 season = 2024 return season test_season = get_season () # set desired week def get_chosen_week (): chosen_week = 1 return chosen_week test_chosen_week = get_chosen_week () # set desired date def get_chosen_date (): # HOCKEY # chosen_date = \"2013-04-15\" # NHL - 2013 (for 2012 season) chosen_date = \"2021-10-25\" # NHL - 2021 # BASEBALL # chosen_date = \"2021-04-01\" # MLB - 2021 # chosen_date = \"2022-04-10\" # MLB - 2022 # BASKETBALL # chosen_date = \"2023-11-26\" return chosen_date test_chosen_date = get_chosen_date () # set desired Yahoo Fantasy Sports game code def get_game_code (): # FOOTBALL game_code = \"nfl\" # NFL # HOCKEY # game_code = \"nhl\" # NHL # BASEBALL # game_code = \"mlb\" # MLB # BASKETBALL # game_code = \"nba\" # NBA return game_code test_game_code = get_game_code () # set desired Yahoo Fantasy Sports game ID (see the get_all_yahoo_fantasy_game_keys query to retrieve values) def get_game_id (): # FOOTBALL # game_id = 331 # NFL - 2014 # game_id = 348 # NFL - 2015 (divisions) # game_id = 359 # NFL - 2016 # game_id = 371 # NFL - 2017 # game_id = 380 # NFL - 2018 # game_id = 390 # NFL - 2019 # game_id = 399 # NFL - 2020 # game_id = 406 # NFL - 2021 # game_id = 414 # NFL - 2022 (divisions) # game_id = 423 # NFL - 2023 game_id = 449 # NFL - 2024 # HOCKEY # game_id = 303 # NHL - 2012 # game_id = 411 # NHL - 2021 # game_id = 427 # NHL - 2023 # BASEBALL # game_id = 404 # MLB - 2021 # game_id = 412 # MLB - 2022 # BASKETBALL # game_id = 428 # NBA - 2023 return game_id test_game_id = get_game_id () # set desired Yahoo Fantasy Sports game key (see the get_all_yahoo_fantasy_game_keys query to retrieve values) def get_game_key (): # FOOTBALL # game_key = \"331\" # NFL - 2014 # game_key = \"348\" # NFL - 2015 (divisions) # game_key = \"359\" # NFL - 2016 # game_key = \"371\" # NFL - 2017 # game_key = \"380\" # NFL - 2018 # game_key = \"390\" # NFL - 2019 # game_key = \"399\" # NFL - 2020 # game_key = \"406\" # NFL - 2021 # game_key = \"414\" # NFL - 2022 (divisions) # game_key = \"423\" # NFL - 2023 game_key = \"449\" # NFL - 2024 # HOCKEY # game_key = \"303\" # NHL - 2012 # game_key = \"411\" # NHL - 2021 # game_key = \"427\" # NHL - 2023 # BASEBALL # game_key = \"404\" # MLB - 2021 # game_key = \"412\" # MLB - 2022 # BASKETBALL # game_key = \"428\" # NBA - 2023 return game_key test_game_key = get_game_key () # set desired league ID (see README.md for finding value) def get_league_id (): # FOOTBALL # league_id = \"907359\" # NFL - 2015 (divisions) # league_id = \"79230\" # NFL - 2019 # league_id = \"655434\" # NFL - 2020 # league_id = \"413954\" # NFL - 2021 # league_id = \"791337\" # NFL - 2022 (divisions) # league_id = \"321958\" # NFL - 2023 league_id = \"365083\" # NFL - 2024 # HOCKEY # league_id = \"69624\" # NHL - 2012 # league_id = \"101592\" # NHL - 2021 # league_id = \"6546\" # NHL - 2021 (draft pick trading) # league_id = \"22827\" # NHL - 2023 # league_id = \"1031\" # NHL - 2023 (FAAB) # BASEBALL # league_id = \"40134\" # MLB - 2021 # BASKETBALL # league_id = \"969\" # NBA - 2023 # league_id = \"122731\" # NBA - 2023 return league_id test_league_id = get_league_id () # set desired team ID within desired league def get_team_id (): # FOOTBALL team_id = 1 # NFL # HOCKEY # team_id = 2 # NHL (2012) return team_id test_team_id = get_team_id () # set desired team name within desired league def get_team_name (): # FOOTBALL team_name = \"Let Baker Bake\" # NFL # HOCKEY # team_name = \"The Bateleurs\" # NHL (2012) return team_name test_team_name = get_team_name () # set desired team ID within desired league def get_player_id (): # FOOTBALL player_id = 30123 # NFL: Patrick Mahomes - 2020/2021/2023/2024 # HOCKEY # player_id = 4588 # NHL: Braden Holtby - 2012 # player_id = 8205 # NHL: Jeffrey Viel - 2021 # player_id = 3637 # NHL: Alex Ovechkin - 2021 # BASEBALL # player_id = 9897 # MLB: Tim Anderson - 2021/2022 # BASKETBALL # player_id = 3704 # NBA: LeBron James - 2023 return player_id test_player_id = get_player_id () # set the maximum number players you wish the get_league_players query to retrieve def get_league_player_limit (): league_player_limit = 101 return league_player_limit test_league_player_limit = get_league_player_limit () # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # QUERY SETUP # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # configure the Yahoo Fantasy Sports query (change all_output_as_json_str=True if you want to output JSON strings) query = YahooFantasySportsQuery ( test_league_id , test_game_code , test_game_id , yahoo_consumer_key = os . environ . get ( \"YAHOO_CONSUMER_KEY\" ), yahoo_consumer_secret = os . environ . get ( \"YAHOO_CONSUMER_SECRET\" ), # yahoo_access_token_json=os.environ.get(\"YAHOO_ACCESS_TOKEN_JSON\"), env_var_fallback = True , env_file_location = Path ( __file__ ) . parent . parent , save_token_data_to_env_file = True , all_output_as_json_str = False , offline = False ) # query.save_access_token_data_to_env_file(project_dir, save_json_to_var=True) # Manually override league key for example code to work query . league_key = f \" { test_game_id } .l. { test_league_id } \" # Manually override player key for example code to work test_player_key = f \" { test_game_id } .p. { test_player_id } \" # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # RUN QUERIES # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # print(repr(query.get_all_yahoo_fantasy_game_keys())) # print(repr(query.get_game_key_by_season(test_season))) # print(repr(query.get_current_game_info())) # print(repr(query.get_current_game_metadata())) # print(repr(query.get_game_info_by_game_id(test_game_id))) # print(repr(query.get_game_metadata_by_game_id(test_game_id))) # print(repr(query.get_game_weeks_by_game_id(test_game_id))) # print(repr(query.get_game_stat_categories_by_game_id(test_game_id))) # print(repr(query.get_game_position_types_by_game_id(test_game_id))) # print(repr(query.get_game_roster_positions_by_game_id(test_game_id))) # print(repr(query.get_league_key(test_season))) # print(repr(query.get_current_user())) # print(repr(query.get_user_games())) # print(repr(query.get_user_leagues_by_game_key(test_game_key))) # print(repr(query.get_user_teams())) # print(repr(query.get_league_info())) # print(repr(query.get_league_metadata())) # print(repr(query.get_league_settings())) # print(repr(query.get_league_standings())) # print(repr(query.get_league_teams())) # print(repr(query.get_league_players(player_count_limit=10, player_count_start=0))) # print(repr(query.get_league_draft_results())) # print(repr(query.get_league_transactions())) # print(repr(query.get_league_scoreboard_by_week(test_chosen_week))) # print(repr(query.get_league_matchups_by_week(test_chosen_week))) # print(repr(query.get_team_info(test_team_id))) # print(repr(query.get_team_metadata(test_team_id))) # print(repr(query.get_team_stats(test_team_id))) # print(repr(query.get_team_stats_by_week(test_team_id, test_chosen_week))) # print(repr(query.get_team_standings(test_team_id))) # print(repr(query.get_team_roster_by_week(test_team_id, test_chosen_week))) # print(repr(query.get_team_roster_player_info_by_week(test_team_id, test_chosen_week))) # # print(repr(query.get_team_roster_player_info_by_date(test_team_id, test_chosen_date))) # NHL/MLB/NBA # print(repr(query.get_team_roster_player_stats(test_team_id))) # print(repr(query.get_team_roster_player_stats_by_week(test_team_id, test_chosen_week))) # print(repr(query.get_team_draft_results(test_team_id))) # print(repr(query.get_team_matchups(test_team_id))) # print(repr(query.get_player_stats_for_season(test_player_key))) # print(repr(query.get_player_stats_for_season(test_player_key, limit_to_league_stats=False))) # print(repr(query.get_player_stats_by_week(test_player_key, test_chosen_week))) # print(repr(query.get_player_stats_by_week(test_player_key, test_chosen_week, limit_to_league_stats=False))) # print(repr(query.get_player_stats_by_date(test_player_key, test_chosen_date))) # NHL/MLB/NBA # print(repr(query.get_player_stats_by_date(test_player_key, test_chosen_date, limit_to_league_stats=False))) # NHL/MLB/NBA # noqa: E501 # print(repr(query.get_player_ownership(test_player_key))) # print(repr(query.get_player_percent_owned_by_week(test_player_key, test_chosen_week))) # print(repr(query.get_player_draft_analysis(test_player_key))) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # CHECK FOR MISSING DATA FIELDS # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # logger = get_logger ( \"yfpy.models\" , DEBUG ) # query.get_all_yahoo_fantasy_game_keys() # query.get_game_key_by_season(test_season) # query.get_current_game_info() # query.get_current_game_metadata() # query.get_game_info_by_game_id(test_game_id) # query.get_game_metadata_by_game_id(test_game_id) # query.get_game_weeks_by_game_id(test_game_id) # query.get_game_stat_categories_by_game_id(test_game_id) # query.get_game_position_types_by_game_id(test_game_id) # query.get_game_roster_positions_by_game_id(test_game_id) # query.get_league_key(test_season) # query.get_current_user() # query.get_user_games() # query.get_user_leagues_by_game_key(test_game_key) # query.get_user_teams() # query.get_league_info() # query.get_league_metadata() # query.get_league_settings() # query.get_league_standings() # query.get_league_teams() # query.get_league_players(player_count_limit=10, player_count_start=0) # query.get_league_draft_results() # query.get_league_transactions() # query.get_league_scoreboard_by_week(test_chosen_week) # query.get_league_matchups_by_week(test_chosen_week) # query.get_team_info(test_team_id) # query.get_team_metadata(test_team_id) # query.get_team_stats(test_team_id) # query.get_team_stats_by_week(test_team_id, test_chosen_week) # query.get_team_standings(test_team_id) # query.get_team_roster_by_week(test_team_id, test_chosen_week) # query.get_team_roster_player_info_by_week(test_team_id, test_chosen_week) # # query.get_team_roster_player_info_by_date(test_team_id, test_chosen_date) # NHL/MLB/NBA # query.get_team_roster_player_stats(test_team_id) # query.get_team_roster_player_stats_by_week(test_team_id, test_chosen_week) # query.get_team_draft_results(test_team_id) # query.get_team_matchups(test_team_id) # query.get_player_stats_for_season(test_player_key) # query.get_player_stats_for_season(test_player_key, limit_to_league_stats=False) # query.get_player_stats_by_week(test_player_key, test_chosen_week) # query.get_player_stats_by_week(test_player_key, test_chosen_week, limit_to_league_stats=False) # query.get_player_stats_by_date(test_player_key, test_chosen_date) # NHL/MLB/NBA # query.get_player_stats_by_date(test_player_key, test_chosen_date, limit_to_league_stats=False) # NHL/MLB/NBA # query.get_player_ownership(test_player_key) # query.get_player_percent_owned_by_week(test_player_key, test_chosen_week) # query.get_player_draft_analysis(test_player_key)","title":"Quickstart"},{"location":"readme/","text":"YFPY - Yahoo Fantasy Sports API Wrapper \u00b6 Python API wrapper for the Yahoo Fantasy Sports public API Author: Wren J. R. (uberfastman) Do you like the YFPY API wrapper? Star the repository on GitHub and please consider helping support its ongoing development: Cryptocurrency Address Bitcoin (BTC) bc1qataspvklhewtswm357m0677q4raag5new2xt3e Ethereum (ETH) 0x5eAa522e66a90577D49e9E72f253EC952CDB4059 READ THE DOCS HERE! Detailed documentation on YFPY can be found at https://yfpy.uberfastman.com . Table of Contents \u00b6 About Installation Pip Manual Setup Yahoo Developer Network App Environment Variables Usage Authentication Programmatic Persistent Authentication Persistent Authentication Using Access Token Fields Persistent Authentication Using Access Token JSON Querying the Yahoo Fantasy Sports API Docker Docker Development Docker Image Deployment Testing Unit Tests Integration Tests Run Tests Dependencies Platform Python Development Troubleshooting Yahoo Fantasy Sports API About \u00b6 YFPY is a comprehensive wrapper around the Yahoo Fantasy Sports API. It allows for easy retrieval and parsing of almost any data you might wish to extract and use from any Yahoo fantasy league to which your Yahoo account has access (or for public leagues). The primary focus of this wrapper is on fantasy football (NFL), but it also supports usage with fantasy hockey (NHL), fantasy baseball (MLB), and fantasy basketball (NBA). Installation \u00b6 Pip \u00b6 If you wish to use YFPY within another project, from within your project directory, run shell pip install yfpy or add yfpy to your project requirements.txt . Manual \u00b6 If you wish to download and use YFPY locally, clone the git repository: shell git clone git@github.com:uberfastman/yfpy.git Setup \u00b6 Yahoo Developer Network App \u00b6 In order to use YFPY with private fantasy leagues, you must set up an app on your Yahoo account to allow access. Follow the step-by-step guide below for instructions on how to do so, or see Getting Started in the Yahoo Developer Network docs for more details. Note: If you are only planning on using YFPY to pull \"read only\" data from public leagues, you do not need to do this. Log in to a Yahoo account with access to whatever fantasy leagues from which you wish to retrieve data. Go to https://developer.yahoo.com/apps/create/ and create an app (you must be logged into your Yahoo account as stated above). For the app, select the following options: Application Name ( Required ): yfpy (you can name your app whatever you want, but this is just an example). Application Type ( Required ): select the Installed Application radio button. Description ( Optional ): you may write a short description of what the app does. Home Page URL ( Optional ): if you have a web address related to your app you may add it here. Redirect URI(s) ( Required ): this field must contain a valid redirect address, so you can use https://localhost:8080 API Permissions ( Required ): check the Fantasy Sports checkbox. You can leave the Read option selected (appears in an accordion expansion underneath the Fantasy Sports checkbox once you select it). Click the Create App button. Once the app is created, it should redirect you to a page for your app, which will show both a Client ID and a Client Secret . Copy the Client ID and Client Secret and proceed with the steps in Environment Variables or Programmatic Persistent Authentication . Environment Variables \u00b6 YFPY now supports the usage of environment variables, either directly within the command line or using a .env file. Any environment variables exported to the same shell in which YFPY runs will automatically be read when a YahooFantasySportsQuery object is instantiated when env_var_fallback=True (default). If you wish to also use environment variables stored in a .env file, you can set up a .env file by making a copy of .env.template in the root project directory and renaming it .env (you can do this in the command line by running cp .env.template .env ). Paste the Client ID and Client Secret retrieved by following the steps in Yahoo Developer Network App into their respective environment variables in your .env file: YAHOO_CONSUMER_KEY= YAHOO_CONSUMER_SECRET= YFPY is configured by default to check for environment variables for authentication with Yahoo, so you will now be able to proceed directly to Authentication . Note : You can disable the fallback to environment variables behavior during instantiation of a YFPY query by passing the argument env_var_fallback=False to the object: from yfpy.query import YahooFantasySportsQuery query = YahooFantasySportsQuery ( league_id = \"\" , game_code = \"nfl\" , game_id = 449 , yahoo_consumer_key = \"\" , yahoo_consumer_secret = \"\" , env_var_fallback = False ) Usage \u00b6 Authentication \u00b6 Follow the instructions in the Installation and Setup sections. The first time you use YFPY, a browser window will open up asking you to allow your app to access your Yahoo fantasy sports data. You MUST hit allow, and then copy the verification code that pops up into the command line prompt where it will now be asking for verification, hit enter, and the OAuth2 three-legged handshake should be complete and your data should have been successfully retrieved. Note : If you are running YFPY in Docker, instead of opening a new browser window, YFPY will output a URL to the command line, which you must then copy to a browser window in order to log in to your Yahoo account, allow access to your app, and retrieve the required verification code. Programmatic Persistent Authentication \u00b6 YFPY supports programmatic authentication using yahoo_consumer_key and yahoo_consumer_secret arguments when instantiating a YahooFantasySportsQuery object. Additionally, you can pass in either a valid JSON string or a Python dictionary to yahoo_access_token_json containing all required fields of a Yahoo access token. Providing yahoo_consumer_key and yahoo_consumer_secret overrides any values provided in a .env file. Providing a value to yahoo_access_token_json overrides yahoo_consumer_key / yahoo_consumer_secret values and any values provided in a .env file for Yahoo access token individual fields. Required fields (either in a JSON string with escaped double quotes or a Python dictionary) for the value of yahoo_access_token_json are the following: access_token consumer_key consumer_secret guid refresh_token token_time token_type The consumer_key and consumer_secret fields in yahoo_access_token_json override any values provided in yahoo_consumer_key / yahoo_consumer_secret . Example of Using yahoo_access_token_json : from yfpy.query import YahooFantasySportsQuery query = YahooFantasySportsQuery ( league_id = \"\" , game_code = \"nfl\" , game_id = 449 , yahoo_access_token_json = { \"access_token\" : \"\" , \"consumer_key\" : \"\" , \"consumer_secret\" : \"\" , \"guid\" : \"\" , \"refresh_token\" : \"\" , \"token_time\" : 1234567890.123456 , \"token_type\" : \"bearer\" } ) Persistent Authentication Using Access Token Fields \u00b6 YFPY no longer uses JSON files to store Yahoo credentials or access tokens. However, if you wish to preserve your access token in order to remain verified, you can now instantiate a YFPY query with save_token_data_to_env_file=True , which will write all required Yahoo access token fields an .env file located in the provided env_file_location directory. For all subsequent runs of your app, you should be able to keep retrieving Yahoo fantasy sports data using YFPY without re-verifying, since the generated refresh token should now just renew whenever you use the same .env file to authenticate your app. Note : You MUST provide a value for env_file_location or else NO Yahoo access token data will be saved! Persistent Authentication Using Access Token JSON \u00b6 YFPY also supports the use of a single environment variable by providing a valid JSON string in YAHOO_ACCESS_TOKEN_JSON . This environment variable is only used if env_var_fallback=True (default) when instantiating a YFPY query. Querying the Yahoo Fantasy Sports API \u00b6 See the documentation on the yfpy.query.YahooFantasySportsQuery class for example usage of all available queries. See quickstart/quickstart.py for example usage output. Uncomment/comment out whichever configuration values in their respective functions with which you wish to experiment. Uncomment/comment out whichever query lines in the RUN QUERIES section you wish to run. Uncomment/comment out whichever query lines in the CHECK FOR MISSING DATA FIELDS section you wish to check for any new/missing data fields returned by the Yahoo Sports Fantasy Football API. Docker \u00b6 YFPY can be used within Docker for a more seamless, platform-agnostic experience. Run the Docker container (pulls the YFPY Docker image from GitHub Package Registry): shell docker compose up You can then run commands in the Docker container in two different ways: Connect to the running container and run commands from within it: shell docker exec -it yfpy-package-1 bash Then: shell python quickstart/quickstart.py Send commands to the running container from your host machine: shell docker exec -i yfpy-package-1 bash -c \"python quickstart/quickstart.py\" Docker Development \u00b6 Run the Docker container for local development (mount all local code into container): shell docker compose -f compose.yaml -f compose.dev.yaml up Docker Image Deployment \u00b6 See DEPLOYMENT.md for Docker image deployment. Testing \u00b6 YFPY has a collection of fully functional code snippets that can be run using pytest . These snippets demonstrate how to use YFPY to retrieve your Yahoo Fantasy Sports data. Unit Tests \u00b6 See the test/unit directory for example code snippets using pytest. Integration Tests \u00b6 See the test/integration directory for example code snippets using pytest. Before running any integration tests, make a copy of auth/.env.template in the auth/ directory and rename it to .env . Copy your Yahoo Client ID and Client Secret into the environment variables in .env so that pytest can use them when hitting the Yahoo Fantasy Sports API. If this is the first time running pytest with your Yahoo API credentials, you MUST allow interactive prompts within pytest by using the -s flag. The fixture values in test/integration/conftest.py are defined in quickstart/quickstart.py , and can be changed for testing by uncommenting/commenting out the values inside each respective function. Run Tests \u00b6 You can invoke all pytest tests (both integration test and unit tests) by running the below from the root directory: pytest -v -s If you want to run only the unit tests, you can run: pytest -v -s -m unit If you want to run only the integration tests, you can run: pytest -v -s -m integration Dependencies \u00b6 Platform \u00b6 YFPY has only been tested extensively on macOS, but is written to be platform-agnostic, and seems to work without issue on Windows and Linux. Python \u00b6 YFPY requires Python 3.10 or later, and has been tested through Python 3.12. Development \u00b6 Direct project dependencies can be viewed in requirements.txt , and additional development and build dependencies ( not including transitive dependencies) can be viewed in requirements-dev.txt . Troubleshooting \u00b6 Yahoo Fantasy Sports API \u00b6 Occasionally when you use the Yahoo Fantasy Sports API, there are hangups on the other end that can cause data not to transmit, and you might encounter an error similar to this: Traceback ( most recent call last ) : File \"yfpy-app.py\" , line 114 , in var = app.run () File \"/Users/your_username/PATH/T0/LOCAL/PROJECT/yfpy-app.py\" , line 429 , in run for team in team_standings: IndexError: list index out of range Typically, when the above error (or a similar error) occurs, it simply means that one of the Yahoo Fantasy Sports API calls failed and so no data was retrieved. This can be fixed by simply re-running data query.","title":"YFPY - Yahoo Fantasy Sports API Wrapper"},{"location":"readme/#yfpy-yahoo-fantasy-sports-api-wrapper","text":"Python API wrapper for the Yahoo Fantasy Sports public API Author: Wren J. R. (uberfastman) Do you like the YFPY API wrapper? Star the repository on GitHub and please consider helping support its ongoing development: Cryptocurrency Address Bitcoin (BTC) bc1qataspvklhewtswm357m0677q4raag5new2xt3e Ethereum (ETH) 0x5eAa522e66a90577D49e9E72f253EC952CDB4059 READ THE DOCS HERE! Detailed documentation on YFPY can be found at https://yfpy.uberfastman.com .","title":"YFPY - Yahoo Fantasy Sports API Wrapper"},{"location":"readme/#table-of-contents","text":"About Installation Pip Manual Setup Yahoo Developer Network App Environment Variables Usage Authentication Programmatic Persistent Authentication Persistent Authentication Using Access Token Fields Persistent Authentication Using Access Token JSON Querying the Yahoo Fantasy Sports API Docker Docker Development Docker Image Deployment Testing Unit Tests Integration Tests Run Tests Dependencies Platform Python Development Troubleshooting Yahoo Fantasy Sports API","title":"Table of Contents"},{"location":"readme/#about","text":"YFPY is a comprehensive wrapper around the Yahoo Fantasy Sports API. It allows for easy retrieval and parsing of almost any data you might wish to extract and use from any Yahoo fantasy league to which your Yahoo account has access (or for public leagues). The primary focus of this wrapper is on fantasy football (NFL), but it also supports usage with fantasy hockey (NHL), fantasy baseball (MLB), and fantasy basketball (NBA).","title":"About"},{"location":"readme/#installation","text":"","title":"Installation"},{"location":"readme/#pip","text":"If you wish to use YFPY within another project, from within your project directory, run shell pip install yfpy or add yfpy to your project requirements.txt .","title":"Pip"},{"location":"readme/#manual","text":"If you wish to download and use YFPY locally, clone the git repository: shell git clone git@github.com:uberfastman/yfpy.git","title":"Manual"},{"location":"readme/#setup","text":"","title":"Setup"},{"location":"readme/#yahoo-developer-network-app","text":"In order to use YFPY with private fantasy leagues, you must set up an app on your Yahoo account to allow access. Follow the step-by-step guide below for instructions on how to do so, or see Getting Started in the Yahoo Developer Network docs for more details. Note: If you are only planning on using YFPY to pull \"read only\" data from public leagues, you do not need to do this. Log in to a Yahoo account with access to whatever fantasy leagues from which you wish to retrieve data. Go to https://developer.yahoo.com/apps/create/ and create an app (you must be logged into your Yahoo account as stated above). For the app, select the following options: Application Name ( Required ): yfpy (you can name your app whatever you want, but this is just an example). Application Type ( Required ): select the Installed Application radio button. Description ( Optional ): you may write a short description of what the app does. Home Page URL ( Optional ): if you have a web address related to your app you may add it here. Redirect URI(s) ( Required ): this field must contain a valid redirect address, so you can use https://localhost:8080 API Permissions ( Required ): check the Fantasy Sports checkbox. You can leave the Read option selected (appears in an accordion expansion underneath the Fantasy Sports checkbox once you select it). Click the Create App button. Once the app is created, it should redirect you to a page for your app, which will show both a Client ID and a Client Secret . Copy the Client ID and Client Secret and proceed with the steps in Environment Variables or Programmatic Persistent Authentication .","title":"Yahoo Developer Network App"},{"location":"readme/#environment-variables","text":"YFPY now supports the usage of environment variables, either directly within the command line or using a .env file. Any environment variables exported to the same shell in which YFPY runs will automatically be read when a YahooFantasySportsQuery object is instantiated when env_var_fallback=True (default). If you wish to also use environment variables stored in a .env file, you can set up a .env file by making a copy of .env.template in the root project directory and renaming it .env (you can do this in the command line by running cp .env.template .env ). Paste the Client ID and Client Secret retrieved by following the steps in Yahoo Developer Network App into their respective environment variables in your .env file: YAHOO_CONSUMER_KEY= YAHOO_CONSUMER_SECRET= YFPY is configured by default to check for environment variables for authentication with Yahoo, so you will now be able to proceed directly to Authentication . Note : You can disable the fallback to environment variables behavior during instantiation of a YFPY query by passing the argument env_var_fallback=False to the object: from yfpy.query import YahooFantasySportsQuery query = YahooFantasySportsQuery ( league_id = \"\" , game_code = \"nfl\" , game_id = 449 , yahoo_consumer_key = \"\" , yahoo_consumer_secret = \"\" , env_var_fallback = False )","title":"Environment Variables"},{"location":"readme/#usage","text":"","title":"Usage"},{"location":"readme/#authentication","text":"Follow the instructions in the Installation and Setup sections. The first time you use YFPY, a browser window will open up asking you to allow your app to access your Yahoo fantasy sports data. You MUST hit allow, and then copy the verification code that pops up into the command line prompt where it will now be asking for verification, hit enter, and the OAuth2 three-legged handshake should be complete and your data should have been successfully retrieved. Note : If you are running YFPY in Docker, instead of opening a new browser window, YFPY will output a URL to the command line, which you must then copy to a browser window in order to log in to your Yahoo account, allow access to your app, and retrieve the required verification code.","title":"Authentication"},{"location":"readme/#programmatic-persistent-authentication","text":"YFPY supports programmatic authentication using yahoo_consumer_key and yahoo_consumer_secret arguments when instantiating a YahooFantasySportsQuery object. Additionally, you can pass in either a valid JSON string or a Python dictionary to yahoo_access_token_json containing all required fields of a Yahoo access token. Providing yahoo_consumer_key and yahoo_consumer_secret overrides any values provided in a .env file. Providing a value to yahoo_access_token_json overrides yahoo_consumer_key / yahoo_consumer_secret values and any values provided in a .env file for Yahoo access token individual fields. Required fields (either in a JSON string with escaped double quotes or a Python dictionary) for the value of yahoo_access_token_json are the following: access_token consumer_key consumer_secret guid refresh_token token_time token_type The consumer_key and consumer_secret fields in yahoo_access_token_json override any values provided in yahoo_consumer_key / yahoo_consumer_secret . Example of Using yahoo_access_token_json : from yfpy.query import YahooFantasySportsQuery query = YahooFantasySportsQuery ( league_id = \"\" , game_code = \"nfl\" , game_id = 449 , yahoo_access_token_json = { \"access_token\" : \"\" , \"consumer_key\" : \"\" , \"consumer_secret\" : \"\" , \"guid\" : \"\" , \"refresh_token\" : \"\" , \"token_time\" : 1234567890.123456 , \"token_type\" : \"bearer\" } )","title":"Programmatic Persistent Authentication"},{"location":"readme/#persistent-authentication-using-access-token-fields","text":"YFPY no longer uses JSON files to store Yahoo credentials or access tokens. However, if you wish to preserve your access token in order to remain verified, you can now instantiate a YFPY query with save_token_data_to_env_file=True , which will write all required Yahoo access token fields an .env file located in the provided env_file_location directory. For all subsequent runs of your app, you should be able to keep retrieving Yahoo fantasy sports data using YFPY without re-verifying, since the generated refresh token should now just renew whenever you use the same .env file to authenticate your app. Note : You MUST provide a value for env_file_location or else NO Yahoo access token data will be saved!","title":"Persistent Authentication Using Access Token Fields"},{"location":"readme/#persistent-authentication-using-access-token-json","text":"YFPY also supports the use of a single environment variable by providing a valid JSON string in YAHOO_ACCESS_TOKEN_JSON . This environment variable is only used if env_var_fallback=True (default) when instantiating a YFPY query.","title":"Persistent Authentication Using Access Token JSON"},{"location":"readme/#querying-the-yahoo-fantasy-sports-api","text":"See the documentation on the yfpy.query.YahooFantasySportsQuery class for example usage of all available queries. See quickstart/quickstart.py for example usage output. Uncomment/comment out whichever configuration values in their respective functions with which you wish to experiment. Uncomment/comment out whichever query lines in the RUN QUERIES section you wish to run. Uncomment/comment out whichever query lines in the CHECK FOR MISSING DATA FIELDS section you wish to check for any new/missing data fields returned by the Yahoo Sports Fantasy Football API.","title":"Querying the Yahoo Fantasy Sports API"},{"location":"readme/#docker","text":"YFPY can be used within Docker for a more seamless, platform-agnostic experience. Run the Docker container (pulls the YFPY Docker image from GitHub Package Registry): shell docker compose up You can then run commands in the Docker container in two different ways: Connect to the running container and run commands from within it: shell docker exec -it yfpy-package-1 bash Then: shell python quickstart/quickstart.py Send commands to the running container from your host machine: shell docker exec -i yfpy-package-1 bash -c \"python quickstart/quickstart.py\"","title":"Docker"},{"location":"readme/#docker-development","text":"Run the Docker container for local development (mount all local code into container): shell docker compose -f compose.yaml -f compose.dev.yaml up","title":"Docker Development"},{"location":"readme/#docker-image-deployment","text":"See DEPLOYMENT.md for Docker image deployment.","title":"Docker Image Deployment"},{"location":"readme/#testing","text":"YFPY has a collection of fully functional code snippets that can be run using pytest . These snippets demonstrate how to use YFPY to retrieve your Yahoo Fantasy Sports data.","title":"Testing"},{"location":"readme/#unit-tests","text":"See the test/unit directory for example code snippets using pytest.","title":"Unit Tests"},{"location":"readme/#integration-tests","text":"See the test/integration directory for example code snippets using pytest. Before running any integration tests, make a copy of auth/.env.template in the auth/ directory and rename it to .env . Copy your Yahoo Client ID and Client Secret into the environment variables in .env so that pytest can use them when hitting the Yahoo Fantasy Sports API. If this is the first time running pytest with your Yahoo API credentials, you MUST allow interactive prompts within pytest by using the -s flag. The fixture values in test/integration/conftest.py are defined in quickstart/quickstart.py , and can be changed for testing by uncommenting/commenting out the values inside each respective function.","title":"Integration Tests"},{"location":"readme/#run-tests","text":"You can invoke all pytest tests (both integration test and unit tests) by running the below from the root directory: pytest -v -s If you want to run only the unit tests, you can run: pytest -v -s -m unit If you want to run only the integration tests, you can run: pytest -v -s -m integration","title":"Run Tests"},{"location":"readme/#dependencies","text":"","title":"Dependencies"},{"location":"readme/#platform","text":"YFPY has only been tested extensively on macOS, but is written to be platform-agnostic, and seems to work without issue on Windows and Linux.","title":"Platform"},{"location":"readme/#python","text":"YFPY requires Python 3.10 or later, and has been tested through Python 3.12.","title":"Python"},{"location":"readme/#development","text":"Direct project dependencies can be viewed in requirements.txt , and additional development and build dependencies ( not including transitive dependencies) can be viewed in requirements-dev.txt .","title":"Development"},{"location":"readme/#troubleshooting","text":"","title":"Troubleshooting"},{"location":"readme/#yahoo-fantasy-sports-api","text":"Occasionally when you use the Yahoo Fantasy Sports API, there are hangups on the other end that can cause data not to transmit, and you might encounter an error similar to this: Traceback ( most recent call last ) : File \"yfpy-app.py\" , line 114 , in var = app.run () File \"/Users/your_username/PATH/T0/LOCAL/PROJECT/yfpy-app.py\" , line 429 , in run for team in team_standings: IndexError: list index out of range Typically, when the above error (or a similar error) occurs, it simply means that one of the Yahoo Fantasy Sports API calls failed and so no data was retrieved. This can be fixed by simply re-running data query.","title":"Yahoo Fantasy Sports API"},{"location":"test/","text":"PyTest \u00b6 conftest \u00b6 Pytest top-level conftest.py. show_log_output \u00b6 show_log_output () Turn on/off example code stdout logging output. Returns: bool ( bool ) \u2013 Boolean value representing if log output is turned on or off. Source code in test/conftest.py 11 12 13 14 15 16 17 18 19 20 @pytest . fixture def show_log_output () -> bool : \"\"\"Turn on/off example code stdout logging output. Returns: bool: Boolean value representing if log output is turned on or off. \"\"\" log_output = False return log_output integration \u00b6 Pytest integration tests for YFPY. conftest \u00b6 Pytest integration test conftest.py. data_dir \u00b6 data_dir () Code tests will output data to this directory. Source code in test/integration/conftest.py 25 26 27 28 @pytest . fixture def data_dir () -> Path : \"\"\"Code tests will output data to this directory.\"\"\" return Path ( __file__ ) . parent / \"test_output\" yahoo_data \u00b6 yahoo_data ( data_dir ) Instantiate yfpy Data object. Source code in test/integration/conftest.py 31 32 33 34 @pytest . fixture def yahoo_data ( data_dir : Union [ Path , str ]) -> Data : \"\"\"Instantiate yfpy Data object.\"\"\" return Data ( data_dir ) yahoo_query \u00b6 yahoo_query ( league_id , game_code , game_id , browser_callback ) Instantiate yfpy YahooFantasySportsQuery object and override league key. Source code in test/integration/conftest.py 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 @pytest . fixture def yahoo_query ( league_id : str , game_code : str , game_id : int , browser_callback : bool ) -> YahooFantasySportsQuery : \"\"\"Instantiate yfpy YahooFantasySportsQuery object and override league key.\"\"\" yahoo_query = YahooFantasySportsQuery ( league_id , game_code , game_id = game_id , yahoo_consumer_key = os . environ . get ( \"YFPY_CONSUMER_KEY\" ), yahoo_consumer_secret = os . environ . get ( \"YFPY_CONSUMER_SECRET\" ), env_file_location = Path ( __file__ ) . parent . parent . parent / \"env\" , all_output_as_json_str = False , browser_callback = browser_callback , offline = False , ) # Manually override league key for example code to work yahoo_query . league_key = f \" { game_id } .l. { league_id } \" return yahoo_query browser_callback \u00b6 browser_callback () Turn on/off automatic opening of browser window for OAuth. Source code in test/integration/conftest.py 58 59 60 61 62 @pytest . fixture def browser_callback () -> bool : \"\"\"Turn on/off automatic opening of browser window for OAuth.\"\"\" browser_callback = True return browser_callback season \u00b6 season () Set Yahoo Fantasy Sports season for testing. Source code in test/integration/conftest.py 65 66 67 68 @pytest . fixture def season () -> int : \"\"\"Set Yahoo Fantasy Sports season for testing.\"\"\" return quickstart . get_season () chosen_week \u00b6 chosen_week () Set Yahoo Fantasy Sports chosen week for testing. Source code in test/integration/conftest.py 71 72 73 74 @pytest . fixture def chosen_week () -> int : \"\"\"Set Yahoo Fantasy Sports chosen week for testing.\"\"\" return quickstart . get_chosen_week () chosen_date \u00b6 chosen_date () Set Yahoo Fantasy Sports chosen date for testing. Source code in test/integration/conftest.py 77 78 79 80 @pytest . fixture def chosen_date () -> str : \"\"\"Set Yahoo Fantasy Sports chosen date for testing.\"\"\" return quickstart . get_chosen_date () game_code \u00b6 game_code () Set Yahoo Fantasy Sports game code for testing. Source code in test/integration/conftest.py 83 84 85 86 @pytest . fixture def game_code () -> str : \"\"\"Set Yahoo Fantasy Sports game code for testing.\"\"\" return quickstart . get_game_code () game_id \u00b6 game_id () Set Yahoo Fantasy Sports game ID for testing. Source code in test/integration/conftest.py 89 90 91 92 @pytest . fixture def game_id () -> int : \"\"\"Set Yahoo Fantasy Sports game ID for testing.\"\"\" return quickstart . get_game_id () game_key \u00b6 game_key () Set Yahoo Fantasy Sports game key for testing. Source code in test/integration/conftest.py 95 96 97 98 @pytest . fixture def game_key () -> str : \"\"\"Set Yahoo Fantasy Sports game key for testing.\"\"\" return quickstart . get_game_key () league_id \u00b6 league_id () Set Yahoo Fantasy Sports league ID for testing. Source code in test/integration/conftest.py 101 102 103 104 @pytest . fixture def league_id () -> str : \"\"\"Set Yahoo Fantasy Sports league ID for testing.\"\"\" return quickstart . get_league_id () team_id \u00b6 team_id () Set Yahoo Fantasy Sports team ID for testing. Source code in test/integration/conftest.py 107 108 109 110 @pytest . fixture def team_id () -> int : \"\"\"Set Yahoo Fantasy Sports team ID for testing.\"\"\" return quickstart . get_team_id () team_name \u00b6 team_name () Set Yahoo Fantasy Sports team name for testing. Source code in test/integration/conftest.py 113 114 115 116 @pytest . fixture def team_name () -> str : \"\"\"Set Yahoo Fantasy Sports team name for testing.\"\"\" return quickstart . get_team_name () player_id \u00b6 player_id () Create and set Yahoo Fantasy Sports player ID for testing. Source code in test/integration/conftest.py 119 120 121 122 @pytest . fixture def player_id () -> int : \"\"\"Create and set Yahoo Fantasy Sports player ID for testing.\"\"\" return quickstart . get_player_id () player_key \u00b6 player_key ( game_id , player_id ) Create and set Yahoo Fantasy Sports player key for testing. Source code in test/integration/conftest.py 125 126 127 128 129 130 131 @pytest . fixture def player_key ( game_id , player_id ) -> str : \"\"\"Create and set Yahoo Fantasy Sports player key for testing.\"\"\" player_key = f \" { game_id } .p. { player_id } \" return player_key league_player_limit \u00b6 league_player_limit () Set Yahoo Fantasy Sports league player retrieval limit for testing. Source code in test/integration/conftest.py 134 135 136 137 @pytest . fixture def league_player_limit () -> int : \"\"\"Set Yahoo Fantasy Sports league player retrieval limit for testing.\"\"\" return quickstart . get_league_player_limit () test_api_game_data \u00b6 Pytest integration tests for Yahoo Fantasy Sports API game data. Note Tests saving and loading all Yahoo Fantasy Sports API game data. Attributes: logger ( Logger ) \u2013 Game data integration tests logger. test_get_all_yahoo_fantasy_game_keys \u00b6 test_get_all_yahoo_fantasy_game_keys ( yahoo_query , yahoo_data , game_code , game_id , show_log_output , ) Integration test for retrieval of all Yahoo fantasy football game keys. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_all_yahoo_fantasy_game_keys . Source code in test/integration/test_api_game_data.py 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 @pytest . mark . integration def test_get_all_yahoo_fantasy_game_keys ( yahoo_query , yahoo_data , game_code , game_id , show_log_output ): \"\"\"Integration test for retrieval of all Yahoo fantasy football game keys. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_all_yahoo_fantasy_game_keys`. \"\"\" query_result_data = yahoo_data . save ( f \" { game_code } -game_keys\" , yahoo_query . get_all_yahoo_fantasy_game_keys ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { game_code } -game_keys\" , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( f \" { prettify_data ( loaded_result_data ) } \\n ---------- \\n \" ) assert query_result_data == loaded_result_data test_get_game_key_by_season \u00b6 test_get_game_key_by_season ( yahoo_query , season , game_key , show_log_output ) Integration test for retrieval of specific game key by season. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_game_key_by_season . Source code in test/integration/test_api_game_data.py 57 58 59 60 61 62 63 64 65 66 67 68 69 @pytest . mark . integration def test_get_game_key_by_season ( yahoo_query , season , game_key , show_log_output ): \"\"\"Integration test for retrieval of specific game key by season. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_game_key_by_season`. \"\"\" query_result_data = yahoo_query . get_game_key_by_season ( season = season ) if show_log_output : logger . info ( prettify_data ( query_result_data )) assert query_result_data == game_key test_get_current_game_info \u00b6 test_get_current_game_info ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of game info for current fantasy season. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_current_game_info . Source code in test/integration/test_api_game_data.py 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 @pytest . mark . integration def test_get_current_game_info ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of game info for current fantasy season. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_current_game_info`. \"\"\" query_result_data = yahoo_data . save ( \"current-game-info\" , yahoo_query . get_current_game_info ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( \"current-game-info\" , Game , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_current_game_metadata \u00b6 test_get_current_game_metadata ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of game metadata for current fantasy season. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_current_game_metadata . Source code in test/integration/test_api_game_data.py 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 @pytest . mark . integration def test_get_current_game_metadata ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of game metadata for current fantasy season. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_current_game_metadata`. \"\"\" query_result_data = yahoo_data . save ( \"current-game-metadata\" , yahoo_query . get_current_game_metadata ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( \"current-game-metadata\" , Game , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_game_info_by_game_id \u00b6 test_get_game_info_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of game info for specific game by id. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_game_info_by_game_id . Source code in test/integration/test_api_game_data.py 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 @pytest . mark . integration def test_get_game_info_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of game info for specific game by id. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_game_info_by_game_id`. \"\"\" new_data_dir = data_dir / str ( season ) query_result_data = yahoo_data . save ( f \" { game_id } -game-info\" , yahoo_query . get_game_info_by_game_id , params = { \"game_id\" : game_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { game_id } -game-info\" , Game , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_game_metadata_by_game_id \u00b6 test_get_game_metadata_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of game metadata for specific game by id. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_game_metadata_by_game_id . Source code in test/integration/test_api_game_data.py 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 @pytest . mark . integration def test_get_game_metadata_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of game metadata for specific game by id. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_game_metadata_by_game_id`. \"\"\" new_data_dir = data_dir / str ( season ) query_result_data = yahoo_data . save ( f \" { game_id } -game-metadata\" , yahoo_query . get_game_metadata_by_game_id , params = { \"game_id\" : game_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { game_id } -game-metadata\" , Game , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_league_key \u00b6 test_get_league_key ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output , ) Integration test for retrieval of league key for selected league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_key . Source code in test/integration/test_api_game_data.py 184 185 186 187 188 189 190 191 192 193 194 195 196 @pytest . mark . integration def test_get_league_key ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output ): \"\"\"Integration test for retrieval of league key for selected league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_key`. \"\"\" query_result_data = yahoo_query . get_league_key () if show_log_output : logger . info ( prettify_data ( query_result_data )) assert query_result_data == f \" { game_id } .l. { league_id } \" test_get_game_weeks_by_game_id \u00b6 test_get_game_weeks_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of all valid weeks of a specific game by id. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_game_weeks_by_game_id . Source code in test/integration/test_api_game_data.py 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 @pytest . mark . integration def test_get_game_weeks_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of all valid weeks of a specific game by id. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_game_weeks_by_game_id`. \"\"\" new_data_dir = data_dir / str ( season ) query_result_data = yahoo_data . save ( f \" { game_id } -game-weeks\" , yahoo_query . get_game_weeks_by_game_id , params = { \"game_id\" : game_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { game_id } -game-weeks\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_game_stat_categories_by_game_id \u00b6 test_get_game_stat_categories_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of all valid stat categories of a specific game by id. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_game_stat_categories_by_game_id . Source code in test/integration/test_api_game_data.py 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 @pytest . mark . integration def test_get_game_stat_categories_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of all valid stat categories of a specific game by id. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_game_stat_categories_by_game_id`. \"\"\" new_data_dir = data_dir / str ( season ) query_result_data = yahoo_data . save ( f \" { game_id } -game-stat_categories\" , yahoo_query . get_game_stat_categories_by_game_id , params = { \"game_id\" : game_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { game_id } -game-stat_categories\" , StatCategories , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( query_result_data )) assert query_result_data == loaded_result_data test_get_game_position_types_by_game_id \u00b6 test_get_game_position_types_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of all valid position types for specific game by id. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_game_position_types_by_game_id . Source code in test/integration/test_api_game_data.py 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 @pytest . mark . integration def test_get_game_position_types_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of all valid position types for specific game by id. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_game_position_types_by_game_id`. \"\"\" new_data_dir = data_dir / str ( season ) query_result_data = yahoo_data . save ( f \" { game_id } -game-position_types\" , yahoo_query . get_game_position_types_by_game_id , params = { \"game_id\" : game_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { game_id } -game-position_types\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_game_roster_positions_by_game_id \u00b6 test_get_game_roster_positions_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of all valid roster positions for specific game by id. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_game_roster_positions_by_game_id . Source code in test/integration/test_api_game_data.py 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 @pytest . mark . integration def test_get_game_roster_positions_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of all valid roster positions for specific game by id. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_game_roster_positions_by_game_id`. \"\"\" new_data_dir = data_dir / str ( season ) query_result_data = yahoo_data . save ( f \" { game_id } -game-roster_positions\" , yahoo_query . get_game_roster_positions_by_game_id , params = { \"game_id\" : game_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { game_id } -game-roster_positions\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_api_league_data \u00b6 Pytest integration tests for Yahoo Fantasy Sports API league data. Note Tests saving and loading all Yahoo Fantasy Sports API league data. Attributes: logger ( Logger ) \u2013 Game data integration tests logger. test_get_league_info \u00b6 test_get_league_info ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output , ) Integration test for retrieval of info for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_info . Source code in test/integration/test_api_league_data.py 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 @pytest . mark . integration def test_get_league_info ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output ): \"\"\"Integration test for retrieval of info for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_info`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" query_result_data = yahoo_data . save ( f \" { league_id } -league-info\" , yahoo_query . get_league_info , new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { league_id } -league-info\" , League , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_league_metadata \u00b6 test_get_league_metadata ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output , ) Integration test for retrieval of metadata for chosen Yahoo fantasy league.. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_metadata . Source code in test/integration/test_api_league_data.py 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 @pytest . mark . integration def test_get_league_metadata ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output ): \"\"\"Integration test for retrieval of metadata for chosen Yahoo fantasy league.. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_metadata`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" query_result_data = yahoo_data . save ( f \" { league_id } -league-metadata\" , yahoo_query . get_league_metadata , new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { league_id } -league-metadata\" , League , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_league_settings \u00b6 test_get_league_settings ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output , ) Integration test for retrieval of settings for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_settings . Source code in test/integration/test_api_league_data.py 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 @pytest . mark . integration def test_get_league_settings ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output ): \"\"\"Integration test for retrieval of settings for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_settings`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" query_result_data = yahoo_data . save ( f \" { league_id } -league-settings\" , yahoo_query . get_league_settings , new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { league_id } -league-settings\" , Settings , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_league_standings \u00b6 test_get_league_standings ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output , ) Integration test for retrieval of standings for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_standings . Source code in test/integration/test_api_league_data.py 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 @pytest . mark . integration def test_get_league_standings ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output ): \"\"\"Integration test for retrieval of standings for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_standings`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" query_result_data = yahoo_data . save ( f \" { league_id } -league-standings\" , yahoo_query . get_league_standings , new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { league_id } -league-standings\" , Standings , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_league_teams \u00b6 test_get_league_teams ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output , ) Integration test for retrieval of all teams in chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_teams . Source code in test/integration/test_api_league_data.py 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 @pytest . mark . integration def test_get_league_teams ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output ): \"\"\"Integration test for retrieval of all teams in chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_teams`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" query_result_data = yahoo_data . save ( f \" { league_id } -league-teams\" , yahoo_query . get_league_teams , new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { league_id } -league-teams\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_league_players \u00b6 test_get_league_players ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output , ) Integration test for retrieval of players in chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_players . Source code in test/integration/test_api_league_data.py 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 @pytest . mark . skip ( reason = \"Skipping test_get_league_players: high player volume slows down tests. Run this test separately.\" ) @pytest . mark . integration def test_get_league_players ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output ): \"\"\"Integration test for retrieval of players in chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_players`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" query_result_data = yahoo_data . save ( f \" { league_id } -league-players\" , yahoo_query . get_league_players , # params={\"player_count_start\": 1400, \"player_count_limit\": 1475}, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { league_id } -league-players\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_league_players_with_limit \u00b6 test_get_league_players_with_limit ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , league_player_limit , show_log_output , ) Integration test for retrieval of a specified maximum of players in chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_players . Source code in test/integration/test_api_league_data.py 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 @pytest . mark . integration def test_get_league_players_with_limit ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , league_player_limit , show_log_output ): \"\"\"Integration test for retrieval of a specified maximum of players in chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_players`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" query_result_data = yahoo_data . save ( f \" { league_id } -league-players\" , yahoo_query . get_league_players , params = { \"player_count_limit\" : league_player_limit }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { league_id } -league-players\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_league_draft_results \u00b6 test_get_league_draft_results ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output , ) Integration test for retrieval of draft results for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_draft_results . Source code in test/integration/test_api_league_data.py 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 @pytest . mark . integration def test_get_league_draft_results ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output ): \"\"\"Integration test for retrieval of draft results for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_draft_results`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" query_result_data = yahoo_data . save ( f \" { league_id } -league-draft_results\" , yahoo_query . get_league_draft_results , new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { league_id } -league-draft_results\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_league_transactions \u00b6 test_get_league_transactions ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output , ) Integration test for retrieval of transactions for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_transactions . Source code in test/integration/test_api_league_data.py 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 @pytest . mark . integration def test_get_league_transactions ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output ): \"\"\"Integration test for retrieval of transactions for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_transactions`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" query_result_data = yahoo_data . save ( f \" { league_id } -league-transactions\" , yahoo_query . get_league_transactions , new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { league_id } -league-transactions\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_league_scoreboard_by_week \u00b6 test_get_league_scoreboard_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , show_log_output , ) Integration test for retrieval of scoreboard by week for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_scoreboard_by_week . Source code in test/integration/test_api_league_data.py 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 @pytest . mark . integration def test_get_league_scoreboard_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , show_log_output ): \"\"\"Integration test for retrieval of scoreboard by week for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_scoreboard_by_week`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / f \"week_ { chosen_week } \" query_result_data = yahoo_data . save ( f \"week_ { chosen_week } -scoreboard\" , yahoo_query . get_league_scoreboard_by_week , params = { \"chosen_week\" : chosen_week }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \"week_ { chosen_week } -scoreboard\" , Scoreboard , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_league_matchups_by_week \u00b6 test_get_league_matchups_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , show_log_output , ) Integration test for retrieval of matchups by week for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_matchups_by_week . Source code in test/integration/test_api_league_data.py 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 @pytest . mark . integration def test_get_league_matchups_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , show_log_output ): \"\"\"Integration test for retrieval of matchups by week for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_matchups_by_week`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / f \"week_ { chosen_week } \" query_result_data = yahoo_data . save ( f \"week_ { chosen_week } -matchups\" , yahoo_query . get_league_matchups_by_week , params = { \"chosen_week\" : chosen_week }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \"week_ { chosen_week } -matchups\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_api_player_data \u00b6 Pytest integration tests for Yahoo Fantasy Sports API player data. Note Tests saving and loading all Yahoo Fantasy Sports API player data. Attributes: logger ( Logger ) \u2013 Game data integration tests logger. test_get_player_stats_for_season \u00b6 test_get_player_stats_for_season ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , player_id , player_key , show_log_output , ) Integration test for retrieval of player stats by season for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_player_stats_for_season . Source code in test/integration/test_api_player_data.py 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 @pytest . mark . integration def test_get_player_stats_for_season ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , player_id , player_key , show_log_output ): \"\"\"Integration test for retrieval of player stats by season for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_player_stats_for_season`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / \"players\" query_result_data = yahoo_data . save ( f \" { player_id } -player-season-stats\" , yahoo_query . get_player_stats_for_season , params = { \"player_key\" : str ( player_key )}, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { player_id } -player-season-stats\" , Player , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_player_stats_by_week \u00b6 test_get_player_stats_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , player_id , player_key , show_log_output , ) Integration test for retrieval of player stats by week for chosen Yahoo fantasy league.. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_player_stats_by_week . Source code in test/integration/test_api_player_data.py 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 @pytest . mark . integration def test_get_player_stats_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , player_id , player_key , show_log_output ): \"\"\"Integration test for retrieval of player stats by week for chosen Yahoo fantasy league.. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_player_stats_by_week`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / f \"week_ { chosen_week } \" / \"players\" query_result_data = yahoo_data . save ( f \" { player_id } -player-stats\" , yahoo_query . get_player_stats_by_week , params = { \"player_key\" : str ( player_key ), \"chosen_week\" : str ( chosen_week )}, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { player_id } -player-stats\" , Player , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_player_stats_by_date \u00b6 test_get_player_stats_by_date ( yahoo_query , yahoo_data , data_dir , season , chosen_date , game_id , league_id , player_id , player_key , show_log_output , ) Integration test for retrieval of player stats by date for Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_player_stats_by_date . Source code in test/integration/test_api_player_data.py 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 @pytest . mark . skip ( reason = \"Skipping test_get_player_stats_by_date: retrieval by date supported by NHL/NBA/MLB, not NFL.\" ) @pytest . mark . integration def test_get_player_stats_by_date ( yahoo_query , yahoo_data , data_dir , season , chosen_date , game_id , league_id , player_id , player_key , show_log_output ): \"\"\"Integration test for retrieval of player stats by date for Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_player_stats_by_date`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / str ( chosen_date ) / \"players\" query_result_data = yahoo_data . save ( f \" { player_id } -player-stats\" , yahoo_query . get_player_stats_by_date , params = { \"player_key\" : str ( player_key ), \"chosen_date\" : chosen_date }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { player_id } -player-stats\" , Player , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_player_ownership \u00b6 test_get_player_ownership ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , player_id , player_key , show_log_output , ) Integration test for retrieval of ownership of chosen player for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_player_ownership . Source code in test/integration/test_api_player_data.py 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 @pytest . mark . integration def test_get_player_ownership ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , player_id , player_key , show_log_output ): \"\"\"Integration test for retrieval of ownership of chosen player for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_player_ownership`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / \"players\" query_result_data = yahoo_data . save ( f \" { player_id } -player-ownership\" , yahoo_query . get_player_ownership , params = { \"player_key\" : str ( player_key )}, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { player_id } -player-ownership\" , Player , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_player_percent_owned_by_week \u00b6 test_get_player_percent_owned_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , player_id , player_key , show_log_output , ) Integration test for retrieval of percent ownership by week of chosen player for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_player_percent_owned_by_week . Source code in test/integration/test_api_player_data.py 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 @pytest . mark . integration def test_get_player_percent_owned_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , player_id , player_key , show_log_output ): \"\"\"Integration test for retrieval of percent ownership by week of chosen player for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_player_percent_owned_by_week`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / f \"week_ { chosen_week } \" / \"players\" query_result_data = yahoo_data . save ( f \" { player_id } -player-percent_owned\" , yahoo_query . get_player_percent_owned_by_week , params = { \"player_key\" : str ( player_key ), \"chosen_week\" : str ( chosen_week )}, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { player_id } -player-percent_owned\" , Player , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_player_draft_analysis \u00b6 test_get_player_draft_analysis ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , player_id , player_key , show_log_output , ) Integration test for retrieval of player draft analysis of chosen player for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_player_draft_analysis . Source code in test/integration/test_api_player_data.py 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 @pytest . mark . integration def test_get_player_draft_analysis ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , player_id , player_key , show_log_output ): \"\"\"Integration test for retrieval of player draft analysis of chosen player for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_player_draft_analysis`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / \"players\" query_result_data = yahoo_data . save ( f \" { player_id } -player-draft_analysis\" , yahoo_query . get_player_draft_analysis , params = { \"player_key\" : str ( player_key )}, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { player_id } -player-draft_analysis\" , Player , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_api_team_data \u00b6 Pytest integration tests for Yahoo Fantasy Sports API team data. Note Tests saving and loading all Yahoo Fantasy Sports API team data. Attributes: logger ( Logger ) \u2013 Game data integration tests logger. test_get_team_info \u00b6 test_get_team_info ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of info for chosen team by team ID for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_info . Source code in test/integration/test_api_team_data.py 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 @pytest . mark . integration def test_get_team_info ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of info for chosen team by team ID for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_info`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / \"teams\" / f \" { team_id } - { team_name } \" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -info\" , yahoo_query . get_team_info , params = { \"team_id\" : team_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -info\" , Team , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_team_metadata \u00b6 test_get_team_metadata ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of metadata for chosen team by team ID for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_metadata . Source code in test/integration/test_api_team_data.py 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 @pytest . mark . integration def test_get_team_metadata ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of metadata for chosen team by team ID for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_metadata`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / \"teams\" / f \" { team_id } - { team_name } \" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -metadata\" , yahoo_query . get_team_metadata , params = { \"team_id\" : team_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -metadata\" , Team , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_team_stats \u00b6 test_get_team_stats ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of stats for chosen team by team ID for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_stats . Source code in test/integration/test_api_team_data.py 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 @pytest . mark . integration def test_get_team_stats ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of stats for chosen team by team ID for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_stats`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / \"teams\" / f \" { team_id } - { team_name } \" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -stats\" , yahoo_query . get_team_stats , params = { \"team_id\" : team_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -stats\" , TeamPoints , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_team_stats_by_week \u00b6 test_get_team_stats_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of stats for chosen team by team ID and by week for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_stats_by_week . Source code in test/integration/test_api_team_data.py 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 @pytest . mark . integration def test_get_team_stats_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of stats for chosen team by team ID and by week for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_stats_by_week`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / f \"week_ { chosen_week } \" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -stats\" , yahoo_query . get_team_stats_by_week , params = { \"team_id\" : team_id , \"chosen_week\" : chosen_week }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -stats\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_team_standings \u00b6 test_get_team_standings ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of standings for chosen team by team ID for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_standings . Source code in test/integration/test_api_team_data.py 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 @pytest . mark . integration def test_get_team_standings ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of standings for chosen team by team ID for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_standings`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / \"teams\" / f \" { team_id } - { team_name } \" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -standings\" , yahoo_query . get_team_standings , params = { \"team_id\" : team_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -standings\" , TeamStandings , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_team_roster_by_week \u00b6 test_get_team_roster_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of roster for chosen team by team ID and by week for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_roster_by_week . Source code in test/integration/test_api_team_data.py 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 @pytest . mark . integration def test_get_team_roster_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of roster for chosen team by team ID and by week for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_roster_by_week`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / f \"week_ { chosen_week } \" / \"rosters\" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -roster_by_week\" , yahoo_query . get_team_roster_by_week , params = { \"team_id\" : team_id , \"chosen_week\" : chosen_week }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -roster_by_week\" , Roster , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_team_roster_player_info_by_week \u00b6 test_get_team_roster_player_info_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of roster with player info for chosen team by team ID and by week for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_roster_player_info_by_week . Source code in test/integration/test_api_team_data.py 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 @pytest . mark . integration def test_get_team_roster_player_info_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of roster with player info for chosen team by team ID and by week for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_roster_player_info_by_week`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / f \"week_ { chosen_week } \" / \"rosters\" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -roster-player_info_by_week\" , yahoo_query . get_team_roster_player_info_by_week , params = { \"team_id\" : team_id , \"chosen_week\" : chosen_week }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -roster-player_info_by_week\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_team_roster_player_info_by_date \u00b6 test_get_team_roster_player_info_by_date ( yahoo_query , yahoo_data , data_dir , season , chosen_date , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of roster with player info for chosen team by team ID and by date for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_roster_player_info_by_date . Source code in test/integration/test_api_team_data.py 248 249 250 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 @pytest . mark . skip ( reason = \"Skipping test_get_team_roster_player_info_by_date: retrieval by date supported by NHL/NBA/MLB, not NFL.\" ) @pytest . mark . integration def test_get_team_roster_player_info_by_date ( yahoo_query , yahoo_data , data_dir , season , chosen_date , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of roster with player info for chosen team by team ID and by date for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_roster_player_info_by_date`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / str ( chosen_date ) / \"rosters\" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -roster-player_info_by_date\" , yahoo_query . get_team_roster_player_info_by_date , params = { \"team_id\" : team_id , \"chosen_date\" : chosen_date }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -roster-player_info_by_date\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_team_roster_player_stats \u00b6 test_get_team_roster_player_stats ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of roster with player info for chosen team by team ID and for chosen season for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_roster_player_stats . Source code in test/integration/test_api_team_data.py 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 @pytest . mark . integration def test_get_team_roster_player_stats ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of roster with player info for chosen team by team ID and for chosen season for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_roster_player_stats`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / \"rosters\" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -roster-player_stats\" , yahoo_query . get_team_roster_player_stats , params = { \"team_id\" : team_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -roster-player_stats\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_team_roster_player_stats_by_week \u00b6 test_get_team_roster_player_stats_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of roster with player info for chosen team by team ID and by week for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_roster_player_stats_by_week . Source code in test/integration/test_api_team_data.py 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 @pytest . mark . integration def test_get_team_roster_player_stats_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of roster with player info for chosen team by team ID and by week for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_roster_player_stats_by_week`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / f \"week_ { chosen_week } \" / \"rosters\" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -roster-player_stats_by_week\" , yahoo_query . get_team_roster_player_stats_by_week , params = { \"team_id\" : team_id , \"chosen_week\" : chosen_week }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -roster-player_stats_by_week\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_team_draft_results \u00b6 test_get_team_draft_results ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of draft results for chosen team by team ID for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_draft_results . Source code in test/integration/test_api_team_data.py 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 @pytest . mark . integration def test_get_team_draft_results ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of draft results for chosen team by team ID for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_draft_results`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / \"teams\" / f \" { team_id } - { team_name } \" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -draft_results\" , yahoo_query . get_team_draft_results , params = { \"team_id\" : team_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -draft_results\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_team_matchups \u00b6 test_get_team_matchups ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of matchups for chosen team by team ID for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_matchups . Source code in test/integration/test_api_team_data.py 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 @pytest . mark . integration def test_get_team_matchups ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of matchups for chosen team by team ID for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_matchups`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / \"teams\" / f \" { team_id } - { team_name } \" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -matchups\" , yahoo_query . get_team_matchups , params = { \"team_id\" : team_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -matchups\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_api_user_data \u00b6 Pytest integration tests for Yahoo Fantasy Sports API user data. Note Tests saving and loading all Yahoo Fantasy Sports API user data. Attributes: logger ( Logger ) \u2013 Game data integration tests logger. test_get_current_user \u00b6 test_get_current_user ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of metadata for current logged-in Yahoo user. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_current_user . Source code in test/integration/test_api_user_data.py 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 @pytest . mark . integration def test_get_current_user ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of metadata for current logged-in Yahoo user. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_current_user`. \"\"\" new_data_dir = data_dir query_result_data = yahoo_data . save ( \"user\" , yahoo_query . get_current_user , new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( \"user\" , User , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_user_games \u00b6 test_get_user_games ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of game history for current logged-in Yahoo user. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_user_games . Source code in test/integration/test_api_user_data.py 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 @pytest . mark . integration def test_get_user_games ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of game history for current logged-in Yahoo user. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_user_games`. \"\"\" new_data_dir = data_dir query_result_data = yahoo_data . save ( \"user-games\" , yahoo_query . get_user_games , new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( \"user-games\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_user_leagues_by_game_id \u00b6 test_get_user_leagues_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of league history by game ID for current logged-in Yahoo user. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_user_leagues_by_game_key . Source code in test/integration/test_api_user_data.py 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 @pytest . mark . skip ( reason = \"Skipping get_user_leagues_by_game_key: current logged-in user must have leagues from test season/year.\" ) @pytest . mark . integration def test_get_user_leagues_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of league history by game ID for current logged-in Yahoo user. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_user_leagues_by_game_key`. \"\"\" new_data_dir = data_dir query_result_data = yahoo_data . save ( \"user-leagues\" , yahoo_query . get_user_leagues_by_game_key , params = { \"game_key\" : game_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( \"user-leagues\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_user_teams \u00b6 test_get_user_teams ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of teams for the current game for the current logged-in Yahoo user. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_user_teams . Source code in test/integration/test_api_user_data.py 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 @pytest . mark . integration def test_get_user_teams ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of teams for the current game for the current logged-in Yahoo user. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_user_teams`. \"\"\" \"\"\"Retrieve teams for all leagues for current logged-in user for current game. \"\"\" new_data_dir = data_dir query_result_data = yahoo_data . save ( \"user-teams\" , yahoo_query . get_user_teams , new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( \"user-teams\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"PyTest"},{"location":"test/#pytest","text":"","title":"PyTest"},{"location":"test/#test.conftest","text":"Pytest top-level conftest.py.","title":"conftest"},{"location":"test/#test.conftest.show_log_output","text":"show_log_output () Turn on/off example code stdout logging output. Returns: bool ( bool ) \u2013 Boolean value representing if log output is turned on or off. Source code in test/conftest.py 11 12 13 14 15 16 17 18 19 20 @pytest . fixture def show_log_output () -> bool : \"\"\"Turn on/off example code stdout logging output. Returns: bool: Boolean value representing if log output is turned on or off. \"\"\" log_output = False return log_output","title":"show_log_output"},{"location":"test/#test.integration","text":"Pytest integration tests for YFPY.","title":"integration"},{"location":"test/#test.integration.conftest","text":"Pytest integration test conftest.py.","title":"conftest"},{"location":"test/#test.integration.conftest.data_dir","text":"data_dir () Code tests will output data to this directory. Source code in test/integration/conftest.py 25 26 27 28 @pytest . fixture def data_dir () -> Path : \"\"\"Code tests will output data to this directory.\"\"\" return Path ( __file__ ) . parent / \"test_output\"","title":"data_dir"},{"location":"test/#test.integration.conftest.yahoo_data","text":"yahoo_data ( data_dir ) Instantiate yfpy Data object. Source code in test/integration/conftest.py 31 32 33 34 @pytest . fixture def yahoo_data ( data_dir : Union [ Path , str ]) -> Data : \"\"\"Instantiate yfpy Data object.\"\"\" return Data ( data_dir )","title":"yahoo_data"},{"location":"test/#test.integration.conftest.yahoo_query","text":"yahoo_query ( league_id , game_code , game_id , browser_callback ) Instantiate yfpy YahooFantasySportsQuery object and override league key. Source code in test/integration/conftest.py 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 @pytest . fixture def yahoo_query ( league_id : str , game_code : str , game_id : int , browser_callback : bool ) -> YahooFantasySportsQuery : \"\"\"Instantiate yfpy YahooFantasySportsQuery object and override league key.\"\"\" yahoo_query = YahooFantasySportsQuery ( league_id , game_code , game_id = game_id , yahoo_consumer_key = os . environ . get ( \"YFPY_CONSUMER_KEY\" ), yahoo_consumer_secret = os . environ . get ( \"YFPY_CONSUMER_SECRET\" ), env_file_location = Path ( __file__ ) . parent . parent . parent / \"env\" , all_output_as_json_str = False , browser_callback = browser_callback , offline = False , ) # Manually override league key for example code to work yahoo_query . league_key = f \" { game_id } .l. { league_id } \" return yahoo_query","title":"yahoo_query"},{"location":"test/#test.integration.conftest.browser_callback","text":"browser_callback () Turn on/off automatic opening of browser window for OAuth. Source code in test/integration/conftest.py 58 59 60 61 62 @pytest . fixture def browser_callback () -> bool : \"\"\"Turn on/off automatic opening of browser window for OAuth.\"\"\" browser_callback = True return browser_callback","title":"browser_callback"},{"location":"test/#test.integration.conftest.season","text":"season () Set Yahoo Fantasy Sports season for testing. Source code in test/integration/conftest.py 65 66 67 68 @pytest . fixture def season () -> int : \"\"\"Set Yahoo Fantasy Sports season for testing.\"\"\" return quickstart . get_season ()","title":"season"},{"location":"test/#test.integration.conftest.chosen_week","text":"chosen_week () Set Yahoo Fantasy Sports chosen week for testing. Source code in test/integration/conftest.py 71 72 73 74 @pytest . fixture def chosen_week () -> int : \"\"\"Set Yahoo Fantasy Sports chosen week for testing.\"\"\" return quickstart . get_chosen_week ()","title":"chosen_week"},{"location":"test/#test.integration.conftest.chosen_date","text":"chosen_date () Set Yahoo Fantasy Sports chosen date for testing. Source code in test/integration/conftest.py 77 78 79 80 @pytest . fixture def chosen_date () -> str : \"\"\"Set Yahoo Fantasy Sports chosen date for testing.\"\"\" return quickstart . get_chosen_date ()","title":"chosen_date"},{"location":"test/#test.integration.conftest.game_code","text":"game_code () Set Yahoo Fantasy Sports game code for testing. Source code in test/integration/conftest.py 83 84 85 86 @pytest . fixture def game_code () -> str : \"\"\"Set Yahoo Fantasy Sports game code for testing.\"\"\" return quickstart . get_game_code ()","title":"game_code"},{"location":"test/#test.integration.conftest.game_id","text":"game_id () Set Yahoo Fantasy Sports game ID for testing. Source code in test/integration/conftest.py 89 90 91 92 @pytest . fixture def game_id () -> int : \"\"\"Set Yahoo Fantasy Sports game ID for testing.\"\"\" return quickstart . get_game_id ()","title":"game_id"},{"location":"test/#test.integration.conftest.game_key","text":"game_key () Set Yahoo Fantasy Sports game key for testing. Source code in test/integration/conftest.py 95 96 97 98 @pytest . fixture def game_key () -> str : \"\"\"Set Yahoo Fantasy Sports game key for testing.\"\"\" return quickstart . get_game_key ()","title":"game_key"},{"location":"test/#test.integration.conftest.league_id","text":"league_id () Set Yahoo Fantasy Sports league ID for testing. Source code in test/integration/conftest.py 101 102 103 104 @pytest . fixture def league_id () -> str : \"\"\"Set Yahoo Fantasy Sports league ID for testing.\"\"\" return quickstart . get_league_id ()","title":"league_id"},{"location":"test/#test.integration.conftest.team_id","text":"team_id () Set Yahoo Fantasy Sports team ID for testing. Source code in test/integration/conftest.py 107 108 109 110 @pytest . fixture def team_id () -> int : \"\"\"Set Yahoo Fantasy Sports team ID for testing.\"\"\" return quickstart . get_team_id ()","title":"team_id"},{"location":"test/#test.integration.conftest.team_name","text":"team_name () Set Yahoo Fantasy Sports team name for testing. Source code in test/integration/conftest.py 113 114 115 116 @pytest . fixture def team_name () -> str : \"\"\"Set Yahoo Fantasy Sports team name for testing.\"\"\" return quickstart . get_team_name ()","title":"team_name"},{"location":"test/#test.integration.conftest.player_id","text":"player_id () Create and set Yahoo Fantasy Sports player ID for testing. Source code in test/integration/conftest.py 119 120 121 122 @pytest . fixture def player_id () -> int : \"\"\"Create and set Yahoo Fantasy Sports player ID for testing.\"\"\" return quickstart . get_player_id ()","title":"player_id"},{"location":"test/#test.integration.conftest.player_key","text":"player_key ( game_id , player_id ) Create and set Yahoo Fantasy Sports player key for testing. Source code in test/integration/conftest.py 125 126 127 128 129 130 131 @pytest . fixture def player_key ( game_id , player_id ) -> str : \"\"\"Create and set Yahoo Fantasy Sports player key for testing.\"\"\" player_key = f \" { game_id } .p. { player_id } \" return player_key","title":"player_key"},{"location":"test/#test.integration.conftest.league_player_limit","text":"league_player_limit () Set Yahoo Fantasy Sports league player retrieval limit for testing. Source code in test/integration/conftest.py 134 135 136 137 @pytest . fixture def league_player_limit () -> int : \"\"\"Set Yahoo Fantasy Sports league player retrieval limit for testing.\"\"\" return quickstart . get_league_player_limit ()","title":"league_player_limit"},{"location":"test/#test.integration.test_api_game_data","text":"Pytest integration tests for Yahoo Fantasy Sports API game data. Note Tests saving and loading all Yahoo Fantasy Sports API game data. Attributes: logger ( Logger ) \u2013 Game data integration tests logger.","title":"test_api_game_data"},{"location":"test/#test.integration.test_api_game_data.test_get_all_yahoo_fantasy_game_keys","text":"test_get_all_yahoo_fantasy_game_keys ( yahoo_query , yahoo_data , game_code , game_id , show_log_output , ) Integration test for retrieval of all Yahoo fantasy football game keys. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_all_yahoo_fantasy_game_keys . Source code in test/integration/test_api_game_data.py 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 @pytest . mark . integration def test_get_all_yahoo_fantasy_game_keys ( yahoo_query , yahoo_data , game_code , game_id , show_log_output ): \"\"\"Integration test for retrieval of all Yahoo fantasy football game keys. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_all_yahoo_fantasy_game_keys`. \"\"\" query_result_data = yahoo_data . save ( f \" { game_code } -game_keys\" , yahoo_query . get_all_yahoo_fantasy_game_keys ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { game_code } -game_keys\" , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( f \" { prettify_data ( loaded_result_data ) } \\n ---------- \\n \" ) assert query_result_data == loaded_result_data","title":"test_get_all_yahoo_fantasy_game_keys"},{"location":"test/#test.integration.test_api_game_data.test_get_game_key_by_season","text":"test_get_game_key_by_season ( yahoo_query , season , game_key , show_log_output ) Integration test for retrieval of specific game key by season. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_game_key_by_season . Source code in test/integration/test_api_game_data.py 57 58 59 60 61 62 63 64 65 66 67 68 69 @pytest . mark . integration def test_get_game_key_by_season ( yahoo_query , season , game_key , show_log_output ): \"\"\"Integration test for retrieval of specific game key by season. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_game_key_by_season`. \"\"\" query_result_data = yahoo_query . get_game_key_by_season ( season = season ) if show_log_output : logger . info ( prettify_data ( query_result_data )) assert query_result_data == game_key","title":"test_get_game_key_by_season"},{"location":"test/#test.integration.test_api_game_data.test_get_current_game_info","text":"test_get_current_game_info ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of game info for current fantasy season. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_current_game_info . Source code in test/integration/test_api_game_data.py 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 @pytest . mark . integration def test_get_current_game_info ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of game info for current fantasy season. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_current_game_info`. \"\"\" query_result_data = yahoo_data . save ( \"current-game-info\" , yahoo_query . get_current_game_info ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( \"current-game-info\" , Game , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_current_game_info"},{"location":"test/#test.integration.test_api_game_data.test_get_current_game_metadata","text":"test_get_current_game_metadata ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of game metadata for current fantasy season. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_current_game_metadata . Source code in test/integration/test_api_game_data.py 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 @pytest . mark . integration def test_get_current_game_metadata ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of game metadata for current fantasy season. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_current_game_metadata`. \"\"\" query_result_data = yahoo_data . save ( \"current-game-metadata\" , yahoo_query . get_current_game_metadata ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( \"current-game-metadata\" , Game , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_current_game_metadata"},{"location":"test/#test.integration.test_api_game_data.test_get_game_info_by_game_id","text":"test_get_game_info_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of game info for specific game by id. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_game_info_by_game_id . Source code in test/integration/test_api_game_data.py 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 @pytest . mark . integration def test_get_game_info_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of game info for specific game by id. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_game_info_by_game_id`. \"\"\" new_data_dir = data_dir / str ( season ) query_result_data = yahoo_data . save ( f \" { game_id } -game-info\" , yahoo_query . get_game_info_by_game_id , params = { \"game_id\" : game_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { game_id } -game-info\" , Game , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_game_info_by_game_id"},{"location":"test/#test.integration.test_api_game_data.test_get_game_metadata_by_game_id","text":"test_get_game_metadata_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of game metadata for specific game by id. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_game_metadata_by_game_id . Source code in test/integration/test_api_game_data.py 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 @pytest . mark . integration def test_get_game_metadata_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of game metadata for specific game by id. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_game_metadata_by_game_id`. \"\"\" new_data_dir = data_dir / str ( season ) query_result_data = yahoo_data . save ( f \" { game_id } -game-metadata\" , yahoo_query . get_game_metadata_by_game_id , params = { \"game_id\" : game_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { game_id } -game-metadata\" , Game , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_game_metadata_by_game_id"},{"location":"test/#test.integration.test_api_game_data.test_get_league_key","text":"test_get_league_key ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output , ) Integration test for retrieval of league key for selected league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_key . Source code in test/integration/test_api_game_data.py 184 185 186 187 188 189 190 191 192 193 194 195 196 @pytest . mark . integration def test_get_league_key ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output ): \"\"\"Integration test for retrieval of league key for selected league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_key`. \"\"\" query_result_data = yahoo_query . get_league_key () if show_log_output : logger . info ( prettify_data ( query_result_data )) assert query_result_data == f \" { game_id } .l. { league_id } \"","title":"test_get_league_key"},{"location":"test/#test.integration.test_api_game_data.test_get_game_weeks_by_game_id","text":"test_get_game_weeks_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of all valid weeks of a specific game by id. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_game_weeks_by_game_id . Source code in test/integration/test_api_game_data.py 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 @pytest . mark . integration def test_get_game_weeks_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of all valid weeks of a specific game by id. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_game_weeks_by_game_id`. \"\"\" new_data_dir = data_dir / str ( season ) query_result_data = yahoo_data . save ( f \" { game_id } -game-weeks\" , yahoo_query . get_game_weeks_by_game_id , params = { \"game_id\" : game_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { game_id } -game-weeks\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_game_weeks_by_game_id"},{"location":"test/#test.integration.test_api_game_data.test_get_game_stat_categories_by_game_id","text":"test_get_game_stat_categories_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of all valid stat categories of a specific game by id. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_game_stat_categories_by_game_id . Source code in test/integration/test_api_game_data.py 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 @pytest . mark . integration def test_get_game_stat_categories_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of all valid stat categories of a specific game by id. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_game_stat_categories_by_game_id`. \"\"\" new_data_dir = data_dir / str ( season ) query_result_data = yahoo_data . save ( f \" { game_id } -game-stat_categories\" , yahoo_query . get_game_stat_categories_by_game_id , params = { \"game_id\" : game_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { game_id } -game-stat_categories\" , StatCategories , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( query_result_data )) assert query_result_data == loaded_result_data","title":"test_get_game_stat_categories_by_game_id"},{"location":"test/#test.integration.test_api_game_data.test_get_game_position_types_by_game_id","text":"test_get_game_position_types_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of all valid position types for specific game by id. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_game_position_types_by_game_id . Source code in test/integration/test_api_game_data.py 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 @pytest . mark . integration def test_get_game_position_types_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of all valid position types for specific game by id. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_game_position_types_by_game_id`. \"\"\" new_data_dir = data_dir / str ( season ) query_result_data = yahoo_data . save ( f \" { game_id } -game-position_types\" , yahoo_query . get_game_position_types_by_game_id , params = { \"game_id\" : game_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { game_id } -game-position_types\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_game_position_types_by_game_id"},{"location":"test/#test.integration.test_api_game_data.test_get_game_roster_positions_by_game_id","text":"test_get_game_roster_positions_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of all valid roster positions for specific game by id. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_game_roster_positions_by_game_id . Source code in test/integration/test_api_game_data.py 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 @pytest . mark . integration def test_get_game_roster_positions_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of all valid roster positions for specific game by id. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_game_roster_positions_by_game_id`. \"\"\" new_data_dir = data_dir / str ( season ) query_result_data = yahoo_data . save ( f \" { game_id } -game-roster_positions\" , yahoo_query . get_game_roster_positions_by_game_id , params = { \"game_id\" : game_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { game_id } -game-roster_positions\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_game_roster_positions_by_game_id"},{"location":"test/#test.integration.test_api_league_data","text":"Pytest integration tests for Yahoo Fantasy Sports API league data. Note Tests saving and loading all Yahoo Fantasy Sports API league data. Attributes: logger ( Logger ) \u2013 Game data integration tests logger.","title":"test_api_league_data"},{"location":"test/#test.integration.test_api_league_data.test_get_league_info","text":"test_get_league_info ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output , ) Integration test for retrieval of info for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_info . Source code in test/integration/test_api_league_data.py 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 @pytest . mark . integration def test_get_league_info ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output ): \"\"\"Integration test for retrieval of info for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_info`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" query_result_data = yahoo_data . save ( f \" { league_id } -league-info\" , yahoo_query . get_league_info , new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { league_id } -league-info\" , League , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_league_info"},{"location":"test/#test.integration.test_api_league_data.test_get_league_metadata","text":"test_get_league_metadata ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output , ) Integration test for retrieval of metadata for chosen Yahoo fantasy league.. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_metadata . Source code in test/integration/test_api_league_data.py 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 @pytest . mark . integration def test_get_league_metadata ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output ): \"\"\"Integration test for retrieval of metadata for chosen Yahoo fantasy league.. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_metadata`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" query_result_data = yahoo_data . save ( f \" { league_id } -league-metadata\" , yahoo_query . get_league_metadata , new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { league_id } -league-metadata\" , League , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_league_metadata"},{"location":"test/#test.integration.test_api_league_data.test_get_league_settings","text":"test_get_league_settings ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output , ) Integration test for retrieval of settings for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_settings . Source code in test/integration/test_api_league_data.py 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 @pytest . mark . integration def test_get_league_settings ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output ): \"\"\"Integration test for retrieval of settings for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_settings`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" query_result_data = yahoo_data . save ( f \" { league_id } -league-settings\" , yahoo_query . get_league_settings , new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { league_id } -league-settings\" , Settings , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_league_settings"},{"location":"test/#test.integration.test_api_league_data.test_get_league_standings","text":"test_get_league_standings ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output , ) Integration test for retrieval of standings for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_standings . Source code in test/integration/test_api_league_data.py 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 @pytest . mark . integration def test_get_league_standings ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output ): \"\"\"Integration test for retrieval of standings for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_standings`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" query_result_data = yahoo_data . save ( f \" { league_id } -league-standings\" , yahoo_query . get_league_standings , new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { league_id } -league-standings\" , Standings , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_league_standings"},{"location":"test/#test.integration.test_api_league_data.test_get_league_teams","text":"test_get_league_teams ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output , ) Integration test for retrieval of all teams in chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_teams . Source code in test/integration/test_api_league_data.py 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 @pytest . mark . integration def test_get_league_teams ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output ): \"\"\"Integration test for retrieval of all teams in chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_teams`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" query_result_data = yahoo_data . save ( f \" { league_id } -league-teams\" , yahoo_query . get_league_teams , new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { league_id } -league-teams\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_league_teams"},{"location":"test/#test.integration.test_api_league_data.test_get_league_players","text":"test_get_league_players ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output , ) Integration test for retrieval of players in chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_players . Source code in test/integration/test_api_league_data.py 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 @pytest . mark . skip ( reason = \"Skipping test_get_league_players: high player volume slows down tests. Run this test separately.\" ) @pytest . mark . integration def test_get_league_players ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output ): \"\"\"Integration test for retrieval of players in chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_players`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" query_result_data = yahoo_data . save ( f \" { league_id } -league-players\" , yahoo_query . get_league_players , # params={\"player_count_start\": 1400, \"player_count_limit\": 1475}, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { league_id } -league-players\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_league_players"},{"location":"test/#test.integration.test_api_league_data.test_get_league_players_with_limit","text":"test_get_league_players_with_limit ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , league_player_limit , show_log_output , ) Integration test for retrieval of a specified maximum of players in chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_players . Source code in test/integration/test_api_league_data.py 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 @pytest . mark . integration def test_get_league_players_with_limit ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , league_player_limit , show_log_output ): \"\"\"Integration test for retrieval of a specified maximum of players in chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_players`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" query_result_data = yahoo_data . save ( f \" { league_id } -league-players\" , yahoo_query . get_league_players , params = { \"player_count_limit\" : league_player_limit }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { league_id } -league-players\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_league_players_with_limit"},{"location":"test/#test.integration.test_api_league_data.test_get_league_draft_results","text":"test_get_league_draft_results ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output , ) Integration test for retrieval of draft results for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_draft_results . Source code in test/integration/test_api_league_data.py 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 @pytest . mark . integration def test_get_league_draft_results ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output ): \"\"\"Integration test for retrieval of draft results for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_draft_results`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" query_result_data = yahoo_data . save ( f \" { league_id } -league-draft_results\" , yahoo_query . get_league_draft_results , new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { league_id } -league-draft_results\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_league_draft_results"},{"location":"test/#test.integration.test_api_league_data.test_get_league_transactions","text":"test_get_league_transactions ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output , ) Integration test for retrieval of transactions for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_transactions . Source code in test/integration/test_api_league_data.py 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 @pytest . mark . integration def test_get_league_transactions ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output ): \"\"\"Integration test for retrieval of transactions for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_transactions`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" query_result_data = yahoo_data . save ( f \" { league_id } -league-transactions\" , yahoo_query . get_league_transactions , new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { league_id } -league-transactions\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_league_transactions"},{"location":"test/#test.integration.test_api_league_data.test_get_league_scoreboard_by_week","text":"test_get_league_scoreboard_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , show_log_output , ) Integration test for retrieval of scoreboard by week for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_scoreboard_by_week . Source code in test/integration/test_api_league_data.py 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 @pytest . mark . integration def test_get_league_scoreboard_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , show_log_output ): \"\"\"Integration test for retrieval of scoreboard by week for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_scoreboard_by_week`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / f \"week_ { chosen_week } \" query_result_data = yahoo_data . save ( f \"week_ { chosen_week } -scoreboard\" , yahoo_query . get_league_scoreboard_by_week , params = { \"chosen_week\" : chosen_week }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \"week_ { chosen_week } -scoreboard\" , Scoreboard , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_league_scoreboard_by_week"},{"location":"test/#test.integration.test_api_league_data.test_get_league_matchups_by_week","text":"test_get_league_matchups_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , show_log_output , ) Integration test for retrieval of matchups by week for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_matchups_by_week . Source code in test/integration/test_api_league_data.py 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 @pytest . mark . integration def test_get_league_matchups_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , show_log_output ): \"\"\"Integration test for retrieval of matchups by week for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_matchups_by_week`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / f \"week_ { chosen_week } \" query_result_data = yahoo_data . save ( f \"week_ { chosen_week } -matchups\" , yahoo_query . get_league_matchups_by_week , params = { \"chosen_week\" : chosen_week }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \"week_ { chosen_week } -matchups\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_league_matchups_by_week"},{"location":"test/#test.integration.test_api_player_data","text":"Pytest integration tests for Yahoo Fantasy Sports API player data. Note Tests saving and loading all Yahoo Fantasy Sports API player data. Attributes: logger ( Logger ) \u2013 Game data integration tests logger.","title":"test_api_player_data"},{"location":"test/#test.integration.test_api_player_data.test_get_player_stats_for_season","text":"test_get_player_stats_for_season ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , player_id , player_key , show_log_output , ) Integration test for retrieval of player stats by season for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_player_stats_for_season . Source code in test/integration/test_api_player_data.py 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 @pytest . mark . integration def test_get_player_stats_for_season ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , player_id , player_key , show_log_output ): \"\"\"Integration test for retrieval of player stats by season for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_player_stats_for_season`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / \"players\" query_result_data = yahoo_data . save ( f \" { player_id } -player-season-stats\" , yahoo_query . get_player_stats_for_season , params = { \"player_key\" : str ( player_key )}, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { player_id } -player-season-stats\" , Player , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_player_stats_for_season"},{"location":"test/#test.integration.test_api_player_data.test_get_player_stats_by_week","text":"test_get_player_stats_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , player_id , player_key , show_log_output , ) Integration test for retrieval of player stats by week for chosen Yahoo fantasy league.. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_player_stats_by_week . Source code in test/integration/test_api_player_data.py 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 @pytest . mark . integration def test_get_player_stats_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , player_id , player_key , show_log_output ): \"\"\"Integration test for retrieval of player stats by week for chosen Yahoo fantasy league.. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_player_stats_by_week`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / f \"week_ { chosen_week } \" / \"players\" query_result_data = yahoo_data . save ( f \" { player_id } -player-stats\" , yahoo_query . get_player_stats_by_week , params = { \"player_key\" : str ( player_key ), \"chosen_week\" : str ( chosen_week )}, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { player_id } -player-stats\" , Player , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_player_stats_by_week"},{"location":"test/#test.integration.test_api_player_data.test_get_player_stats_by_date","text":"test_get_player_stats_by_date ( yahoo_query , yahoo_data , data_dir , season , chosen_date , game_id , league_id , player_id , player_key , show_log_output , ) Integration test for retrieval of player stats by date for Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_player_stats_by_date . Source code in test/integration/test_api_player_data.py 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 @pytest . mark . skip ( reason = \"Skipping test_get_player_stats_by_date: retrieval by date supported by NHL/NBA/MLB, not NFL.\" ) @pytest . mark . integration def test_get_player_stats_by_date ( yahoo_query , yahoo_data , data_dir , season , chosen_date , game_id , league_id , player_id , player_key , show_log_output ): \"\"\"Integration test for retrieval of player stats by date for Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_player_stats_by_date`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / str ( chosen_date ) / \"players\" query_result_data = yahoo_data . save ( f \" { player_id } -player-stats\" , yahoo_query . get_player_stats_by_date , params = { \"player_key\" : str ( player_key ), \"chosen_date\" : chosen_date }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { player_id } -player-stats\" , Player , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_player_stats_by_date"},{"location":"test/#test.integration.test_api_player_data.test_get_player_ownership","text":"test_get_player_ownership ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , player_id , player_key , show_log_output , ) Integration test for retrieval of ownership of chosen player for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_player_ownership . Source code in test/integration/test_api_player_data.py 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 @pytest . mark . integration def test_get_player_ownership ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , player_id , player_key , show_log_output ): \"\"\"Integration test for retrieval of ownership of chosen player for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_player_ownership`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / \"players\" query_result_data = yahoo_data . save ( f \" { player_id } -player-ownership\" , yahoo_query . get_player_ownership , params = { \"player_key\" : str ( player_key )}, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { player_id } -player-ownership\" , Player , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_player_ownership"},{"location":"test/#test.integration.test_api_player_data.test_get_player_percent_owned_by_week","text":"test_get_player_percent_owned_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , player_id , player_key , show_log_output , ) Integration test for retrieval of percent ownership by week of chosen player for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_player_percent_owned_by_week . Source code in test/integration/test_api_player_data.py 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 @pytest . mark . integration def test_get_player_percent_owned_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , player_id , player_key , show_log_output ): \"\"\"Integration test for retrieval of percent ownership by week of chosen player for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_player_percent_owned_by_week`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / f \"week_ { chosen_week } \" / \"players\" query_result_data = yahoo_data . save ( f \" { player_id } -player-percent_owned\" , yahoo_query . get_player_percent_owned_by_week , params = { \"player_key\" : str ( player_key ), \"chosen_week\" : str ( chosen_week )}, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { player_id } -player-percent_owned\" , Player , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_player_percent_owned_by_week"},{"location":"test/#test.integration.test_api_player_data.test_get_player_draft_analysis","text":"test_get_player_draft_analysis ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , player_id , player_key , show_log_output , ) Integration test for retrieval of player draft analysis of chosen player for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_player_draft_analysis . Source code in test/integration/test_api_player_data.py 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 @pytest . mark . integration def test_get_player_draft_analysis ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , player_id , player_key , show_log_output ): \"\"\"Integration test for retrieval of player draft analysis of chosen player for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_player_draft_analysis`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / \"players\" query_result_data = yahoo_data . save ( f \" { player_id } -player-draft_analysis\" , yahoo_query . get_player_draft_analysis , params = { \"player_key\" : str ( player_key )}, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { player_id } -player-draft_analysis\" , Player , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_player_draft_analysis"},{"location":"test/#test.integration.test_api_team_data","text":"Pytest integration tests for Yahoo Fantasy Sports API team data. Note Tests saving and loading all Yahoo Fantasy Sports API team data. Attributes: logger ( Logger ) \u2013 Game data integration tests logger.","title":"test_api_team_data"},{"location":"test/#test.integration.test_api_team_data.test_get_team_info","text":"test_get_team_info ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of info for chosen team by team ID for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_info . Source code in test/integration/test_api_team_data.py 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 @pytest . mark . integration def test_get_team_info ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of info for chosen team by team ID for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_info`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / \"teams\" / f \" { team_id } - { team_name } \" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -info\" , yahoo_query . get_team_info , params = { \"team_id\" : team_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -info\" , Team , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_team_info"},{"location":"test/#test.integration.test_api_team_data.test_get_team_metadata","text":"test_get_team_metadata ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of metadata for chosen team by team ID for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_metadata . Source code in test/integration/test_api_team_data.py 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 @pytest . mark . integration def test_get_team_metadata ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of metadata for chosen team by team ID for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_metadata`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / \"teams\" / f \" { team_id } - { team_name } \" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -metadata\" , yahoo_query . get_team_metadata , params = { \"team_id\" : team_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -metadata\" , Team , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_team_metadata"},{"location":"test/#test.integration.test_api_team_data.test_get_team_stats","text":"test_get_team_stats ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of stats for chosen team by team ID for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_stats . Source code in test/integration/test_api_team_data.py 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 @pytest . mark . integration def test_get_team_stats ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of stats for chosen team by team ID for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_stats`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / \"teams\" / f \" { team_id } - { team_name } \" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -stats\" , yahoo_query . get_team_stats , params = { \"team_id\" : team_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -stats\" , TeamPoints , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_team_stats"},{"location":"test/#test.integration.test_api_team_data.test_get_team_stats_by_week","text":"test_get_team_stats_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of stats for chosen team by team ID and by week for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_stats_by_week . Source code in test/integration/test_api_team_data.py 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 @pytest . mark . integration def test_get_team_stats_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of stats for chosen team by team ID and by week for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_stats_by_week`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / f \"week_ { chosen_week } \" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -stats\" , yahoo_query . get_team_stats_by_week , params = { \"team_id\" : team_id , \"chosen_week\" : chosen_week }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -stats\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_team_stats_by_week"},{"location":"test/#test.integration.test_api_team_data.test_get_team_standings","text":"test_get_team_standings ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of standings for chosen team by team ID for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_standings . Source code in test/integration/test_api_team_data.py 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 @pytest . mark . integration def test_get_team_standings ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of standings for chosen team by team ID for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_standings`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / \"teams\" / f \" { team_id } - { team_name } \" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -standings\" , yahoo_query . get_team_standings , params = { \"team_id\" : team_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -standings\" , TeamStandings , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_team_standings"},{"location":"test/#test.integration.test_api_team_data.test_get_team_roster_by_week","text":"test_get_team_roster_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of roster for chosen team by team ID and by week for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_roster_by_week . Source code in test/integration/test_api_team_data.py 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 @pytest . mark . integration def test_get_team_roster_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of roster for chosen team by team ID and by week for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_roster_by_week`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / f \"week_ { chosen_week } \" / \"rosters\" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -roster_by_week\" , yahoo_query . get_team_roster_by_week , params = { \"team_id\" : team_id , \"chosen_week\" : chosen_week }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -roster_by_week\" , Roster , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_team_roster_by_week"},{"location":"test/#test.integration.test_api_team_data.test_get_team_roster_player_info_by_week","text":"test_get_team_roster_player_info_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of roster with player info for chosen team by team ID and by week for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_roster_player_info_by_week . Source code in test/integration/test_api_team_data.py 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 @pytest . mark . integration def test_get_team_roster_player_info_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of roster with player info for chosen team by team ID and by week for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_roster_player_info_by_week`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / f \"week_ { chosen_week } \" / \"rosters\" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -roster-player_info_by_week\" , yahoo_query . get_team_roster_player_info_by_week , params = { \"team_id\" : team_id , \"chosen_week\" : chosen_week }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -roster-player_info_by_week\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_team_roster_player_info_by_week"},{"location":"test/#test.integration.test_api_team_data.test_get_team_roster_player_info_by_date","text":"test_get_team_roster_player_info_by_date ( yahoo_query , yahoo_data , data_dir , season , chosen_date , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of roster with player info for chosen team by team ID and by date for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_roster_player_info_by_date . Source code in test/integration/test_api_team_data.py 248 249 250 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 @pytest . mark . skip ( reason = \"Skipping test_get_team_roster_player_info_by_date: retrieval by date supported by NHL/NBA/MLB, not NFL.\" ) @pytest . mark . integration def test_get_team_roster_player_info_by_date ( yahoo_query , yahoo_data , data_dir , season , chosen_date , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of roster with player info for chosen team by team ID and by date for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_roster_player_info_by_date`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / str ( chosen_date ) / \"rosters\" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -roster-player_info_by_date\" , yahoo_query . get_team_roster_player_info_by_date , params = { \"team_id\" : team_id , \"chosen_date\" : chosen_date }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -roster-player_info_by_date\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_team_roster_player_info_by_date"},{"location":"test/#test.integration.test_api_team_data.test_get_team_roster_player_stats","text":"test_get_team_roster_player_stats ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of roster with player info for chosen team by team ID and for chosen season for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_roster_player_stats . Source code in test/integration/test_api_team_data.py 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 @pytest . mark . integration def test_get_team_roster_player_stats ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of roster with player info for chosen team by team ID and for chosen season for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_roster_player_stats`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / \"rosters\" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -roster-player_stats\" , yahoo_query . get_team_roster_player_stats , params = { \"team_id\" : team_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -roster-player_stats\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_team_roster_player_stats"},{"location":"test/#test.integration.test_api_team_data.test_get_team_roster_player_stats_by_week","text":"test_get_team_roster_player_stats_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of roster with player info for chosen team by team ID and by week for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_roster_player_stats_by_week . Source code in test/integration/test_api_team_data.py 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 @pytest . mark . integration def test_get_team_roster_player_stats_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of roster with player info for chosen team by team ID and by week for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_roster_player_stats_by_week`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / f \"week_ { chosen_week } \" / \"rosters\" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -roster-player_stats_by_week\" , yahoo_query . get_team_roster_player_stats_by_week , params = { \"team_id\" : team_id , \"chosen_week\" : chosen_week }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -roster-player_stats_by_week\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_team_roster_player_stats_by_week"},{"location":"test/#test.integration.test_api_team_data.test_get_team_draft_results","text":"test_get_team_draft_results ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of draft results for chosen team by team ID for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_draft_results . Source code in test/integration/test_api_team_data.py 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 @pytest . mark . integration def test_get_team_draft_results ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of draft results for chosen team by team ID for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_draft_results`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / \"teams\" / f \" { team_id } - { team_name } \" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -draft_results\" , yahoo_query . get_team_draft_results , params = { \"team_id\" : team_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -draft_results\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_team_draft_results"},{"location":"test/#test.integration.test_api_team_data.test_get_team_matchups","text":"test_get_team_matchups ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of matchups for chosen team by team ID for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_matchups . Source code in test/integration/test_api_team_data.py 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 @pytest . mark . integration def test_get_team_matchups ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of matchups for chosen team by team ID for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_matchups`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / \"teams\" / f \" { team_id } - { team_name } \" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -matchups\" , yahoo_query . get_team_matchups , params = { \"team_id\" : team_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -matchups\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_team_matchups"},{"location":"test/#test.integration.test_api_user_data","text":"Pytest integration tests for Yahoo Fantasy Sports API user data. Note Tests saving and loading all Yahoo Fantasy Sports API user data. Attributes: logger ( Logger ) \u2013 Game data integration tests logger.","title":"test_api_user_data"},{"location":"test/#test.integration.test_api_user_data.test_get_current_user","text":"test_get_current_user ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of metadata for current logged-in Yahoo user. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_current_user . Source code in test/integration/test_api_user_data.py 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 @pytest . mark . integration def test_get_current_user ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of metadata for current logged-in Yahoo user. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_current_user`. \"\"\" new_data_dir = data_dir query_result_data = yahoo_data . save ( \"user\" , yahoo_query . get_current_user , new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( \"user\" , User , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_current_user"},{"location":"test/#test.integration.test_api_user_data.test_get_user_games","text":"test_get_user_games ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of game history for current logged-in Yahoo user. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_user_games . Source code in test/integration/test_api_user_data.py 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 @pytest . mark . integration def test_get_user_games ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of game history for current logged-in Yahoo user. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_user_games`. \"\"\" new_data_dir = data_dir query_result_data = yahoo_data . save ( \"user-games\" , yahoo_query . get_user_games , new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( \"user-games\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_user_games"},{"location":"test/#test.integration.test_api_user_data.test_get_user_leagues_by_game_id","text":"test_get_user_leagues_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of league history by game ID for current logged-in Yahoo user. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_user_leagues_by_game_key . Source code in test/integration/test_api_user_data.py 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 @pytest . mark . skip ( reason = \"Skipping get_user_leagues_by_game_key: current logged-in user must have leagues from test season/year.\" ) @pytest . mark . integration def test_get_user_leagues_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of league history by game ID for current logged-in Yahoo user. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_user_leagues_by_game_key`. \"\"\" new_data_dir = data_dir query_result_data = yahoo_data . save ( \"user-leagues\" , yahoo_query . get_user_leagues_by_game_key , params = { \"game_key\" : game_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( \"user-leagues\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_user_leagues_by_game_id"},{"location":"test/#test.integration.test_api_user_data.test_get_user_teams","text":"test_get_user_teams ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of teams for the current game for the current logged-in Yahoo user. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_user_teams . Source code in test/integration/test_api_user_data.py 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 @pytest . mark . integration def test_get_user_teams ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of teams for the current game for the current logged-in Yahoo user. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_user_teams`. \"\"\" \"\"\"Retrieve teams for all leagues for current logged-in user for current game. \"\"\" new_data_dir = data_dir query_result_data = yahoo_data . save ( \"user-teams\" , yahoo_query . get_user_teams , new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( \"user-teams\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_user_teams"},{"location":"utils/","text":"Utilities \u00b6 YFPY module for managing complex JSON data structures. Attributes: logger ( Logger ) \u2013 Module level logger for usage and debugging. retrieve_game_code_from_user \u00b6 retrieve_game_code_from_user () Recursive function to retrieve required Yahoo Fantasy Sports game code from user input. Returns: str ( str ) \u2013 Yahoo Fantasy Sports game code (\"nfl\", \"nhl\", \"mlb\", or \"nba\"). Source code in yfpy/utils.py 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 def retrieve_game_code_from_user () -> str : \"\"\"Recursive function to retrieve required Yahoo Fantasy Sports game code from user input. Returns: str: Yahoo Fantasy Sports game code (\"nfl\", \"nhl\", \"mlb\", or \"nba\"). \"\"\" game_code = input ( \"YFPY requires the use of a Yahoo Fantasy Sports game code in order to select the correct sport. Please enter \" \"NFL, NHL, MLB, or NBA (case does not matter) here -> \" ) game_code = game_code . strip () . lower () if game_code in yahoo_fantasy_sports_game_codes : return game_code else : logger . warning ( f \"Selection \\\" { game_code } \\\" is not a valid Yahoo Fantasy Sports game code. Please try again.\" ) sleep ( 0.25 ) return retrieve_game_code_from_user () complex_json_handler \u00b6 complex_json_handler ( obj ) Custom handler to allow custom YFPY objects to be serialized into JSON. Parameters: obj ( Any ) \u2013 Unserializable Python object to be serialized into JSON. Returns: Any ( Any ) \u2013 Serializable version of the Python object. Source code in yfpy/utils.py 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 def complex_json_handler ( obj : Any ) -> Any : \"\"\"Custom handler to allow custom YFPY objects to be serialized into JSON. Args: obj (Any): Unserializable Python object to be serialized into JSON. Returns: Any: Serializable version of the Python object. \"\"\" if hasattr ( obj , \"serialized\" ): return obj . serialized () else : try : return str ( obj , \"utf-8\" ) except TypeError : raise TypeError ( 'Object of type %s with value of %s is not JSON serializable' % ( type ( obj ), repr ( obj ))) jsonify_data \u00b6 jsonify_data ( data ) Function to serialize a YahooFantasyObject to a JSON string. Parameters: data ( object ) \u2013 YahooFantasyObject to be serialized to a JSON string. Returns: str ( str ) \u2013 JSON string serialized from YahooFantasyObject. Source code in yfpy/utils.py 65 66 67 68 69 70 71 72 73 74 75 def jsonify_data ( data : object ) -> str : \"\"\"Function to serialize a YahooFantasyObject to a JSON string. Args: data (object): YahooFantasyObject to be serialized to a JSON string. Returns: str: JSON string serialized from YahooFantasyObject. \"\"\" return json . dumps ( data , indent = 2 , ensure_ascii = False , default = complex_json_handler ) jsonify_data_to_file \u00b6 jsonify_data_to_file ( data , data_file ) Function to serialize a YahooFantasyObject to JSON and output it to a file. Parameters: data ( object ) \u2013 YahooFantasyObject to be serialized to JSON and output to a file. data_file ( IO [ str ] ) \u2013 Target filestream for writing the data. Source code in yfpy/utils.py 78 79 80 81 82 83 84 85 86 def jsonify_data_to_file ( data : object , data_file : IO [ str ]) -> None : \"\"\"Function to serialize a YahooFantasyObject to JSON and output it to a file. Args: data (object): YahooFantasyObject to be serialized to JSON and output to a file. data_file (IO[str]): Target filestream for writing the data. \"\"\" json . dump ( data , data_file , indent = 2 , ensure_ascii = False , default = complex_json_handler ) prettify_data \u00b6 prettify_data ( data ) Function to return pretty formatted JSON strings for easily readable output from objects. Parameters: data ( object ) \u2013 Data object to be printed as an easily readable JSON string. Returns: str ( str ) \u2013 JSON string that has been formatted with indents (two spaces). Source code in yfpy/utils.py 89 90 91 92 93 94 95 96 97 98 99 def prettify_data ( data : object ) -> str : \"\"\"Function to return pretty formatted JSON strings for easily readable output from objects. Args: data (object): Data object to be printed as an easily readable JSON string. Returns: str: JSON string that has been formatted with indents (two spaces). \"\"\" return f \" \\n { jsonify_data ( data ) } \\n \" unpack_data \u00b6 unpack_data ( json_obj , parent_class = None ) Recursive function to parse, clean, and assign custom data types to retrieved Yahoo Fantasy Sports data. Parameters: json_obj ( Any ) \u2013 JSON object for parsing (can be a dictionary, list, or primitive). parent_class ( Type , default: None ) \u2013 Parent class type used to extract custom subclass type options for casting. Returns: Any ( Any ) \u2013 Recursively returns JSON objects until data is completely parsed, cleaned, and typed (where applicable). Source code in yfpy/utils.py 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 def unpack_data ( json_obj : Any , parent_class : Type = None ) -> Any : \"\"\"Recursive function to parse, clean, and assign custom data types to retrieved Yahoo Fantasy Sports data. Args: json_obj (Any): JSON object for parsing (can be a dictionary, list, or primitive). parent_class (Type): Parent class type used to extract custom subclass type options for casting. Returns: Any: Recursively returns JSON objects until data is completely parsed, cleaned, and typed (where applicable). \"\"\" # extract subclasses from parent class for typing subclasses = {} if parent_class : subclasses = { stringcase . snakecase ( cls . __name__ ): cls for cls in parent_class . __subclasses__ ()} # discard empty lists and dictionaries and include when json value = 0 if json_obj == 0 or json_obj : # handle lists if isinstance ( json_obj , list ): json_obj = [ obj for obj in json_obj if ( obj == 0 or obj )] if len ( json_obj ) == 1 : return unpack_data ( json_obj [ 0 ], parent_class ) else : # flatten list of dicts if any objects in the list are dicts if any ( isinstance ( obj , dict ) for obj in json_obj ): return flatten_json_dict_list ( json_obj , parent_class ) return [ unpack_data ( obj , parent_class ) for obj in json_obj if ( obj == 0 or obj )] # handle dictionaries elif isinstance ( json_obj , dict ): # eliminate odd single-key Yahoo dicts with key = \"0\" and value = if \"0\" in json_obj . keys () and \"1\" not in json_obj . keys (): if len ( json_obj . keys ()) == 1 : return unpack_data ( json_obj . get ( \"0\" ), parent_class ) else : if isinstance ( json_obj . get ( \"0\" ), dict ): json_obj . update ( json_obj . pop ( \"0\" )) # eliminate data obj counts (except in player_position dicts, which have position counts in league settings) if \"count\" in json_obj . keys () and \"position\" in json_obj . keys (): # assign/cast data type where applicable # TODO: figure out how to do this without explicit object type keys return get_type ( { k : unpack_data ( v , parent_class ) for k , v in json_obj . items ()}, parent_class , subclasses ) else : # assign/cast data type where applicable # TODO: figure out how to do this without explicit object type keys json_obj = get_type ( { k : unpack_data ( v , parent_class ) for k , v in json_obj . items () if k != \"count\" }, parent_class , subclasses ) # flatten dicts with keys \"0\", \"1\",..., \"n\" to a list of objects if \"0\" in json_obj . keys () and \"1\" in json_obj . keys (): json_obj = flatten_to_list ( json_obj ) # TODO: figure out how to do this without breaking the above unpacking using explicit type keys # else: # # flatten dicts with redundant keys to a list of objects # if len(json_obj.keys()) == 1 and len(json_obj.values()) == 1: # key = list(json_obj.keys())[0] # value = list(json_obj.values())[0] # json_obj = value return json_obj else : return convert_strings_to_numeric_equivalents ( json_obj ) convert_strings_to_numeric_equivalents \u00b6 convert_strings_to_numeric_equivalents ( json_obj ) Convert JSON strings with integer or float numeric representations to their respective integer or float values. Parameters: json_obj ( Any ) \u2013 JSON object (typically a dictionary or list, but can also be a primitive). Returns: Union [ int , float , Any ] \u2013 int | float | Any: The numeric representation of any JSON strings that can be represented as integers or floats, Union [ int , float , Any ] \u2013 else the original JSON object. Source code in yfpy/utils.py 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 def convert_strings_to_numeric_equivalents ( json_obj : Any ) -> Union [ int , float , Any ]: \"\"\"Convert JSON strings with integer or float numeric representations to their respective integer or float values. Args: json_obj (Any): JSON object (typically a dictionary or list, but can also be a primitive). Returns: int | float | Any: The numeric representation of any JSON strings that can be represented as integers or floats, else the original JSON object. \"\"\" if isinstance ( json_obj , str ): if len ( json_obj ) > 1 and str . startswith ( json_obj , \"0\" ): return json_obj else : if str . isdigit ( json_obj ): return int ( json_obj ) elif str . isdigit ( re . sub ( \"[-]\" , \"\" , re . sub ( \"[.]\" , \"\" , json_obj , count = 1 ), count = 1 )): return float ( json_obj ) else : return json_obj else : return json_obj get_type \u00b6 get_type ( json_obj_dict , parent_class , subclasses ) Cast JSON object to custom subclass type extracted from parent class. Parameters: json_obj_dict ( dict of str ) \u2013 Any): JSON dictionary with strings of data type as keys and JSON objects as values. parent_class ( Type ) \u2013 Parent class from which to derive subclasses for casting. subclasses ( dict of str ) \u2013 Type): Dictionary of subclasses with strings that match the json dict keys as keys and classes for casting as values. Returns: object ( Dict [ str , Any ] ) \u2013 A Python object (representing the original JSON object) that has been cast to the specified type. Source code in yfpy/utils.py 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 def get_type ( json_obj_dict : Dict [ str , Any ], parent_class : Type , subclasses : Dict [ str , Type ]) -> Dict [ str , Any ]: \"\"\"Cast JSON object to custom subclass type extracted from parent class. Args: json_obj_dict (dict of str: Any): JSON dictionary with strings of data type as keys and JSON objects as values. parent_class (Type): Parent class from which to derive subclasses for casting. subclasses (dict of str: Type): Dictionary of subclasses with strings that match the json dict keys as keys and classes for casting as values. Returns: object: A Python object (representing the original JSON object) that has been cast to the specified type. \"\"\" for k , v in json_obj_dict . items (): # check if key is in the provided subclasses' dict, that the object isn't already cast if k in subclasses . keys () and isinstance ( v , dict ) and not isinstance ( v , subclasses . get ( k )): json_obj_dict [ k ] = subclasses [ k ]( unpack_data ( v , parent_class )) return json_obj_dict flatten_json_dict_list \u00b6 flatten_json_dict_list ( json_obj_dict_list , parent_class ) Recursive function to flatten JSON lists containing all disparate JSON dictionaries with no overlapping keys. Parameters: json_obj_dict_list ( list [ dict [ str , Any ]] ) \u2013 List of JSON dictionaries. parent_class ( Type ) \u2013 Parent class type used to extract custom subclass type options. Returns: Any \u2013 dict | list: Returns a dictionary if the list was flattened, else a cleaned list if no flattening was needed. Source code in yfpy/utils.py 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 def flatten_json_dict_list ( json_obj_dict_list : List [ Dict [ str , Any ]], parent_class : Type ) -> Any : \"\"\"Recursive function to flatten JSON lists containing all disparate JSON dictionaries with no overlapping keys. Args: json_obj_dict_list (list[dict[str, Any]]): List of JSON dictionaries. parent_class (Type): Parent class type used to extract custom subclass type options. Returns: dict | list: Returns a dictionary if the list was flattened, else a cleaned list if no flattening was needed. \"\"\" # filter out empty lists and dicts but include when value = 0 json_obj_dict_list = [ obj for obj in json_obj_dict_list if ( obj == 0 or obj )] item_keys = [] ndx = 0 for item in json_obj_dict_list : if isinstance ( item , list ): flattened_item = flatten_json_dict_list ( item , parent_class ) json_obj_dict_list [ ndx ] = flattened_item item_keys . extend ( list ( flattened_item . keys ())) else : item_keys . extend ( list ( item . keys ())) ndx += 1 if len ( item_keys ) == len ( set ( item_keys )): agg_dict = {} for dict_item in json_obj_dict_list : agg_dict . update ( dict_item ) return unpack_data ( agg_dict , parent_class ) else : return [ unpack_data ( obj , parent_class ) for obj in json_obj_dict_list if ( obj == 0 or obj )] flatten_to_list \u00b6 flatten_to_list ( json_obj ) Function to flatten JSON dictionaries with unnecessary keys to a list of objects. Parameters: json_obj ( Any ) \u2013 JSON object (typically a dictionary or list, but can also be a primitive). Returns: list ( Any ) \u2013 A list made from a flattened dictionary if json_obj was a dictionary, the original list if json_obj was a Any \u2013 list, or the original value if json_obj was a primitive. Source code in yfpy/utils.py 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 def flatten_to_list ( json_obj : Any ) -> Any : \"\"\"Function to flatten JSON dictionaries with unnecessary keys to a list of objects. Args: json_obj (Any): JSON object (typically a dictionary or list, but can also be a primitive). Returns: list: A list made from a flattened dictionary if json_obj was a dictionary, the original list if json_obj was a list, or the original value if json_obj was a primitive. \"\"\" if isinstance ( json_obj , dict ): out = [] for k , v in json_obj . items (): out . append ( v ) return out else : return json_obj flatten_to_objects \u00b6 flatten_to_objects ( json_obj ) Function to flatten a JSON dictionary (or a JSON dictionary in a list) to a dictionary of cast objects. Parameters: json_obj ( Any ) \u2013 JSON object (typically a dictionary or list, but can also be a primitive). Returns: Any \u2013 dict | list | int | float | str | bool: JSON dictionary/list/primitive with contents cast to Python objects. Source code in yfpy/utils.py 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 def flatten_to_objects ( json_obj : Any ) -> Any : \"\"\"Function to flatten a JSON dictionary (or a JSON dictionary in a list) to a dictionary of cast objects. Args: json_obj (Any): JSON object (typically a dictionary or list, but can also be a primitive). Returns: dict | list | int | float | str | bool: JSON dictionary/list/primitive with contents cast to Python objects. \"\"\" if isinstance ( json_obj , dict ): return dict_to_list ( json_obj ) elif isinstance ( json_obj , list ): if isinstance ( json_obj [ 0 ], dict ): return dict_to_list ( json_obj [ 0 ]) else : return json_obj dict_to_list \u00b6 dict_to_list ( json_dict ) Function to convert a JSON dictionary to a list. Parameters: json_dict ( dict [ str , Any ] ) \u2013 JSON dictionary. Returns: list ( Any ) \u2013 A list derived from a JSON dictionary, or the original dictionary if it does not contain dictionaries as Any \u2013 values. Source code in yfpy/utils.py 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 def dict_to_list ( json_dict : Dict [ str , Any ]) -> Any : \"\"\"Function to convert a JSON dictionary to a list. Args: json_dict (dict[str, Any]): JSON dictionary. Returns: list: A list derived from a JSON dictionary, or the original dictionary if it does not contain dictionaries as values. \"\"\" first_key = list ( json_dict . keys ())[ 0 ] if isinstance ( json_dict . get ( first_key ), dict ): first_val_key = list ( json_dict . get ( first_key ) . keys ())[ 0 ] if first_key [: - 1 ] == first_val_key : out = [] for k , v in json_dict . items (): out . append ( v . get ( first_val_key )) return out return json_dict reorganize_json_dict \u00b6 reorganize_json_dict ( json_dict , obj_key , val_to_key ) Function to reorganize a JSON dictionary of dictionaries. The reorganized JSON dictionary is an ordered dictionary sorted by a specific attribute of the value dictionaries. Parameters: json_dict ( dict of str ) \u2013 Any): JSON dictionary. obj_key ( str ) \u2013 Key to access the dictionaries contained in json_dict. val_to_key ( str ) \u2013 Key used to sort the dictionaries contained in json_dict. Returns: Dict [ str , Any ] \u2013 dict[str, Any]: An ordered dictionary of dictionaries sorted by val_to_key. Source code in yfpy/utils.py 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 def reorganize_json_dict ( json_dict : Dict [ str , Any ], obj_key : str , val_to_key : str ) -> Dict [ str , Any ]: \"\"\"Function to reorganize a JSON dictionary of dictionaries. The reorganized JSON dictionary is an ordered dictionary sorted by a specific attribute of the value dictionaries. Args: json_dict (dict of str: Any): JSON dictionary. obj_key (str): Key to access the dictionaries contained in json_dict. val_to_key (str): Key used to sort the dictionaries contained in json_dict. Returns: dict[str, Any]: An ordered dictionary of dictionaries sorted by val_to_key. \"\"\" out = {} for k , v in json_dict . items (): out [ str ( getattr ( v . get ( obj_key ), val_to_key ))] = v . get ( obj_key ) return OrderedDict ( ( str ( k ), out [ str ( k )]) for k in sorted ( [ int ( k_v ) if isinstance ( k_v , int ) else k_v for k_v in out . keys ()])) reformat_json_list \u00b6 reformat_json_list ( json_obj ) Function to clean and reformat JSON lists to eliminate empty values and unnecessarily nested lists. Parameters: json_obj ( Any ) \u2013 JSON object (typically a dictionary or list, but can also be a primitive) to be cleaned. Returns: Any ( Any ) \u2013 Reformatted JSON list derived from original JSON object. Source code in yfpy/utils.py 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 def reformat_json_list ( json_obj : Any ) -> Any : \"\"\"Function to clean and reformat JSON lists to eliminate empty values and unnecessarily nested lists. Args: json_obj (Any): JSON object (typically a dictionary or list, but can also be a primitive) to be cleaned. Returns: Any: Reformatted JSON list derived from original JSON object. \"\"\" if isinstance ( json_obj [ 0 ], list ): if len ( json_obj ) > 1 : return reformat_json_list ( [ reformat_json_list ( item ) if isinstance ( item , list ) else item for item in json_obj ]) else : return reformat_json_list ( json_obj [ 0 ]) else : # create chain map that filters out empty lists/dicts but leaves objects where value = 0 return ChainMap ( * [ value for value in json_obj if ( value == 0 or value )])","title":"Utilities"},{"location":"utils/#utilities","text":"YFPY module for managing complex JSON data structures. Attributes: logger ( Logger ) \u2013 Module level logger for usage and debugging.","title":"Utilities"},{"location":"utils/#yfpy.utils.retrieve_game_code_from_user","text":"retrieve_game_code_from_user () Recursive function to retrieve required Yahoo Fantasy Sports game code from user input. Returns: str ( str ) \u2013 Yahoo Fantasy Sports game code (\"nfl\", \"nhl\", \"mlb\", or \"nba\"). Source code in yfpy/utils.py 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 def retrieve_game_code_from_user () -> str : \"\"\"Recursive function to retrieve required Yahoo Fantasy Sports game code from user input. Returns: str: Yahoo Fantasy Sports game code (\"nfl\", \"nhl\", \"mlb\", or \"nba\"). \"\"\" game_code = input ( \"YFPY requires the use of a Yahoo Fantasy Sports game code in order to select the correct sport. Please enter \" \"NFL, NHL, MLB, or NBA (case does not matter) here -> \" ) game_code = game_code . strip () . lower () if game_code in yahoo_fantasy_sports_game_codes : return game_code else : logger . warning ( f \"Selection \\\" { game_code } \\\" is not a valid Yahoo Fantasy Sports game code. Please try again.\" ) sleep ( 0.25 ) return retrieve_game_code_from_user ()","title":"retrieve_game_code_from_user"},{"location":"utils/#yfpy.utils.complex_json_handler","text":"complex_json_handler ( obj ) Custom handler to allow custom YFPY objects to be serialized into JSON. Parameters: obj ( Any ) \u2013 Unserializable Python object to be serialized into JSON. Returns: Any ( Any ) \u2013 Serializable version of the Python object. Source code in yfpy/utils.py 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 def complex_json_handler ( obj : Any ) -> Any : \"\"\"Custom handler to allow custom YFPY objects to be serialized into JSON. Args: obj (Any): Unserializable Python object to be serialized into JSON. Returns: Any: Serializable version of the Python object. \"\"\" if hasattr ( obj , \"serialized\" ): return obj . serialized () else : try : return str ( obj , \"utf-8\" ) except TypeError : raise TypeError ( 'Object of type %s with value of %s is not JSON serializable' % ( type ( obj ), repr ( obj )))","title":"complex_json_handler"},{"location":"utils/#yfpy.utils.jsonify_data","text":"jsonify_data ( data ) Function to serialize a YahooFantasyObject to a JSON string. Parameters: data ( object ) \u2013 YahooFantasyObject to be serialized to a JSON string. Returns: str ( str ) \u2013 JSON string serialized from YahooFantasyObject. Source code in yfpy/utils.py 65 66 67 68 69 70 71 72 73 74 75 def jsonify_data ( data : object ) -> str : \"\"\"Function to serialize a YahooFantasyObject to a JSON string. Args: data (object): YahooFantasyObject to be serialized to a JSON string. Returns: str: JSON string serialized from YahooFantasyObject. \"\"\" return json . dumps ( data , indent = 2 , ensure_ascii = False , default = complex_json_handler )","title":"jsonify_data"},{"location":"utils/#yfpy.utils.jsonify_data_to_file","text":"jsonify_data_to_file ( data , data_file ) Function to serialize a YahooFantasyObject to JSON and output it to a file. Parameters: data ( object ) \u2013 YahooFantasyObject to be serialized to JSON and output to a file. data_file ( IO [ str ] ) \u2013 Target filestream for writing the data. Source code in yfpy/utils.py 78 79 80 81 82 83 84 85 86 def jsonify_data_to_file ( data : object , data_file : IO [ str ]) -> None : \"\"\"Function to serialize a YahooFantasyObject to JSON and output it to a file. Args: data (object): YahooFantasyObject to be serialized to JSON and output to a file. data_file (IO[str]): Target filestream for writing the data. \"\"\" json . dump ( data , data_file , indent = 2 , ensure_ascii = False , default = complex_json_handler )","title":"jsonify_data_to_file"},{"location":"utils/#yfpy.utils.prettify_data","text":"prettify_data ( data ) Function to return pretty formatted JSON strings for easily readable output from objects. Parameters: data ( object ) \u2013 Data object to be printed as an easily readable JSON string. Returns: str ( str ) \u2013 JSON string that has been formatted with indents (two spaces). Source code in yfpy/utils.py 89 90 91 92 93 94 95 96 97 98 99 def prettify_data ( data : object ) -> str : \"\"\"Function to return pretty formatted JSON strings for easily readable output from objects. Args: data (object): Data object to be printed as an easily readable JSON string. Returns: str: JSON string that has been formatted with indents (two spaces). \"\"\" return f \" \\n { jsonify_data ( data ) } \\n \"","title":"prettify_data"},{"location":"utils/#yfpy.utils.unpack_data","text":"unpack_data ( json_obj , parent_class = None ) Recursive function to parse, clean, and assign custom data types to retrieved Yahoo Fantasy Sports data. Parameters: json_obj ( Any ) \u2013 JSON object for parsing (can be a dictionary, list, or primitive). parent_class ( Type , default: None ) \u2013 Parent class type used to extract custom subclass type options for casting. Returns: Any ( Any ) \u2013 Recursively returns JSON objects until data is completely parsed, cleaned, and typed (where applicable). Source code in yfpy/utils.py 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 def unpack_data ( json_obj : Any , parent_class : Type = None ) -> Any : \"\"\"Recursive function to parse, clean, and assign custom data types to retrieved Yahoo Fantasy Sports data. Args: json_obj (Any): JSON object for parsing (can be a dictionary, list, or primitive). parent_class (Type): Parent class type used to extract custom subclass type options for casting. Returns: Any: Recursively returns JSON objects until data is completely parsed, cleaned, and typed (where applicable). \"\"\" # extract subclasses from parent class for typing subclasses = {} if parent_class : subclasses = { stringcase . snakecase ( cls . __name__ ): cls for cls in parent_class . __subclasses__ ()} # discard empty lists and dictionaries and include when json value = 0 if json_obj == 0 or json_obj : # handle lists if isinstance ( json_obj , list ): json_obj = [ obj for obj in json_obj if ( obj == 0 or obj )] if len ( json_obj ) == 1 : return unpack_data ( json_obj [ 0 ], parent_class ) else : # flatten list of dicts if any objects in the list are dicts if any ( isinstance ( obj , dict ) for obj in json_obj ): return flatten_json_dict_list ( json_obj , parent_class ) return [ unpack_data ( obj , parent_class ) for obj in json_obj if ( obj == 0 or obj )] # handle dictionaries elif isinstance ( json_obj , dict ): # eliminate odd single-key Yahoo dicts with key = \"0\" and value = if \"0\" in json_obj . keys () and \"1\" not in json_obj . keys (): if len ( json_obj . keys ()) == 1 : return unpack_data ( json_obj . get ( \"0\" ), parent_class ) else : if isinstance ( json_obj . get ( \"0\" ), dict ): json_obj . update ( json_obj . pop ( \"0\" )) # eliminate data obj counts (except in player_position dicts, which have position counts in league settings) if \"count\" in json_obj . keys () and \"position\" in json_obj . keys (): # assign/cast data type where applicable # TODO: figure out how to do this without explicit object type keys return get_type ( { k : unpack_data ( v , parent_class ) for k , v in json_obj . items ()}, parent_class , subclasses ) else : # assign/cast data type where applicable # TODO: figure out how to do this without explicit object type keys json_obj = get_type ( { k : unpack_data ( v , parent_class ) for k , v in json_obj . items () if k != \"count\" }, parent_class , subclasses ) # flatten dicts with keys \"0\", \"1\",..., \"n\" to a list of objects if \"0\" in json_obj . keys () and \"1\" in json_obj . keys (): json_obj = flatten_to_list ( json_obj ) # TODO: figure out how to do this without breaking the above unpacking using explicit type keys # else: # # flatten dicts with redundant keys to a list of objects # if len(json_obj.keys()) == 1 and len(json_obj.values()) == 1: # key = list(json_obj.keys())[0] # value = list(json_obj.values())[0] # json_obj = value return json_obj else : return convert_strings_to_numeric_equivalents ( json_obj )","title":"unpack_data"},{"location":"utils/#yfpy.utils.convert_strings_to_numeric_equivalents","text":"convert_strings_to_numeric_equivalents ( json_obj ) Convert JSON strings with integer or float numeric representations to their respective integer or float values. Parameters: json_obj ( Any ) \u2013 JSON object (typically a dictionary or list, but can also be a primitive). Returns: Union [ int , float , Any ] \u2013 int | float | Any: The numeric representation of any JSON strings that can be represented as integers or floats, Union [ int , float , Any ] \u2013 else the original JSON object. Source code in yfpy/utils.py 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 def convert_strings_to_numeric_equivalents ( json_obj : Any ) -> Union [ int , float , Any ]: \"\"\"Convert JSON strings with integer or float numeric representations to their respective integer or float values. Args: json_obj (Any): JSON object (typically a dictionary or list, but can also be a primitive). Returns: int | float | Any: The numeric representation of any JSON strings that can be represented as integers or floats, else the original JSON object. \"\"\" if isinstance ( json_obj , str ): if len ( json_obj ) > 1 and str . startswith ( json_obj , \"0\" ): return json_obj else : if str . isdigit ( json_obj ): return int ( json_obj ) elif str . isdigit ( re . sub ( \"[-]\" , \"\" , re . sub ( \"[.]\" , \"\" , json_obj , count = 1 ), count = 1 )): return float ( json_obj ) else : return json_obj else : return json_obj","title":"convert_strings_to_numeric_equivalents"},{"location":"utils/#yfpy.utils.get_type","text":"get_type ( json_obj_dict , parent_class , subclasses ) Cast JSON object to custom subclass type extracted from parent class. Parameters: json_obj_dict ( dict of str ) \u2013 Any): JSON dictionary with strings of data type as keys and JSON objects as values. parent_class ( Type ) \u2013 Parent class from which to derive subclasses for casting. subclasses ( dict of str ) \u2013 Type): Dictionary of subclasses with strings that match the json dict keys as keys and classes for casting as values. Returns: object ( Dict [ str , Any ] ) \u2013 A Python object (representing the original JSON object) that has been cast to the specified type. Source code in yfpy/utils.py 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 def get_type ( json_obj_dict : Dict [ str , Any ], parent_class : Type , subclasses : Dict [ str , Type ]) -> Dict [ str , Any ]: \"\"\"Cast JSON object to custom subclass type extracted from parent class. Args: json_obj_dict (dict of str: Any): JSON dictionary with strings of data type as keys and JSON objects as values. parent_class (Type): Parent class from which to derive subclasses for casting. subclasses (dict of str: Type): Dictionary of subclasses with strings that match the json dict keys as keys and classes for casting as values. Returns: object: A Python object (representing the original JSON object) that has been cast to the specified type. \"\"\" for k , v in json_obj_dict . items (): # check if key is in the provided subclasses' dict, that the object isn't already cast if k in subclasses . keys () and isinstance ( v , dict ) and not isinstance ( v , subclasses . get ( k )): json_obj_dict [ k ] = subclasses [ k ]( unpack_data ( v , parent_class )) return json_obj_dict","title":"get_type"},{"location":"utils/#yfpy.utils.flatten_json_dict_list","text":"flatten_json_dict_list ( json_obj_dict_list , parent_class ) Recursive function to flatten JSON lists containing all disparate JSON dictionaries with no overlapping keys. Parameters: json_obj_dict_list ( list [ dict [ str , Any ]] ) \u2013 List of JSON dictionaries. parent_class ( Type ) \u2013 Parent class type used to extract custom subclass type options. Returns: Any \u2013 dict | list: Returns a dictionary if the list was flattened, else a cleaned list if no flattening was needed. Source code in yfpy/utils.py 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 def flatten_json_dict_list ( json_obj_dict_list : List [ Dict [ str , Any ]], parent_class : Type ) -> Any : \"\"\"Recursive function to flatten JSON lists containing all disparate JSON dictionaries with no overlapping keys. Args: json_obj_dict_list (list[dict[str, Any]]): List of JSON dictionaries. parent_class (Type): Parent class type used to extract custom subclass type options. Returns: dict | list: Returns a dictionary if the list was flattened, else a cleaned list if no flattening was needed. \"\"\" # filter out empty lists and dicts but include when value = 0 json_obj_dict_list = [ obj for obj in json_obj_dict_list if ( obj == 0 or obj )] item_keys = [] ndx = 0 for item in json_obj_dict_list : if isinstance ( item , list ): flattened_item = flatten_json_dict_list ( item , parent_class ) json_obj_dict_list [ ndx ] = flattened_item item_keys . extend ( list ( flattened_item . keys ())) else : item_keys . extend ( list ( item . keys ())) ndx += 1 if len ( item_keys ) == len ( set ( item_keys )): agg_dict = {} for dict_item in json_obj_dict_list : agg_dict . update ( dict_item ) return unpack_data ( agg_dict , parent_class ) else : return [ unpack_data ( obj , parent_class ) for obj in json_obj_dict_list if ( obj == 0 or obj )]","title":"flatten_json_dict_list"},{"location":"utils/#yfpy.utils.flatten_to_list","text":"flatten_to_list ( json_obj ) Function to flatten JSON dictionaries with unnecessary keys to a list of objects. Parameters: json_obj ( Any ) \u2013 JSON object (typically a dictionary or list, but can also be a primitive). Returns: list ( Any ) \u2013 A list made from a flattened dictionary if json_obj was a dictionary, the original list if json_obj was a Any \u2013 list, or the original value if json_obj was a primitive. Source code in yfpy/utils.py 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 def flatten_to_list ( json_obj : Any ) -> Any : \"\"\"Function to flatten JSON dictionaries with unnecessary keys to a list of objects. Args: json_obj (Any): JSON object (typically a dictionary or list, but can also be a primitive). Returns: list: A list made from a flattened dictionary if json_obj was a dictionary, the original list if json_obj was a list, or the original value if json_obj was a primitive. \"\"\" if isinstance ( json_obj , dict ): out = [] for k , v in json_obj . items (): out . append ( v ) return out else : return json_obj","title":"flatten_to_list"},{"location":"utils/#yfpy.utils.flatten_to_objects","text":"flatten_to_objects ( json_obj ) Function to flatten a JSON dictionary (or a JSON dictionary in a list) to a dictionary of cast objects. Parameters: json_obj ( Any ) \u2013 JSON object (typically a dictionary or list, but can also be a primitive). Returns: Any \u2013 dict | list | int | float | str | bool: JSON dictionary/list/primitive with contents cast to Python objects. Source code in yfpy/utils.py 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 def flatten_to_objects ( json_obj : Any ) -> Any : \"\"\"Function to flatten a JSON dictionary (or a JSON dictionary in a list) to a dictionary of cast objects. Args: json_obj (Any): JSON object (typically a dictionary or list, but can also be a primitive). Returns: dict | list | int | float | str | bool: JSON dictionary/list/primitive with contents cast to Python objects. \"\"\" if isinstance ( json_obj , dict ): return dict_to_list ( json_obj ) elif isinstance ( json_obj , list ): if isinstance ( json_obj [ 0 ], dict ): return dict_to_list ( json_obj [ 0 ]) else : return json_obj","title":"flatten_to_objects"},{"location":"utils/#yfpy.utils.dict_to_list","text":"dict_to_list ( json_dict ) Function to convert a JSON dictionary to a list. Parameters: json_dict ( dict [ str , Any ] ) \u2013 JSON dictionary. Returns: list ( Any ) \u2013 A list derived from a JSON dictionary, or the original dictionary if it does not contain dictionaries as Any \u2013 values. Source code in yfpy/utils.py 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 def dict_to_list ( json_dict : Dict [ str , Any ]) -> Any : \"\"\"Function to convert a JSON dictionary to a list. Args: json_dict (dict[str, Any]): JSON dictionary. Returns: list: A list derived from a JSON dictionary, or the original dictionary if it does not contain dictionaries as values. \"\"\" first_key = list ( json_dict . keys ())[ 0 ] if isinstance ( json_dict . get ( first_key ), dict ): first_val_key = list ( json_dict . get ( first_key ) . keys ())[ 0 ] if first_key [: - 1 ] == first_val_key : out = [] for k , v in json_dict . items (): out . append ( v . get ( first_val_key )) return out return json_dict","title":"dict_to_list"},{"location":"utils/#yfpy.utils.reorganize_json_dict","text":"reorganize_json_dict ( json_dict , obj_key , val_to_key ) Function to reorganize a JSON dictionary of dictionaries. The reorganized JSON dictionary is an ordered dictionary sorted by a specific attribute of the value dictionaries. Parameters: json_dict ( dict of str ) \u2013 Any): JSON dictionary. obj_key ( str ) \u2013 Key to access the dictionaries contained in json_dict. val_to_key ( str ) \u2013 Key used to sort the dictionaries contained in json_dict. Returns: Dict [ str , Any ] \u2013 dict[str, Any]: An ordered dictionary of dictionaries sorted by val_to_key. Source code in yfpy/utils.py 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 def reorganize_json_dict ( json_dict : Dict [ str , Any ], obj_key : str , val_to_key : str ) -> Dict [ str , Any ]: \"\"\"Function to reorganize a JSON dictionary of dictionaries. The reorganized JSON dictionary is an ordered dictionary sorted by a specific attribute of the value dictionaries. Args: json_dict (dict of str: Any): JSON dictionary. obj_key (str): Key to access the dictionaries contained in json_dict. val_to_key (str): Key used to sort the dictionaries contained in json_dict. Returns: dict[str, Any]: An ordered dictionary of dictionaries sorted by val_to_key. \"\"\" out = {} for k , v in json_dict . items (): out [ str ( getattr ( v . get ( obj_key ), val_to_key ))] = v . get ( obj_key ) return OrderedDict ( ( str ( k ), out [ str ( k )]) for k in sorted ( [ int ( k_v ) if isinstance ( k_v , int ) else k_v for k_v in out . keys ()]))","title":"reorganize_json_dict"},{"location":"utils/#yfpy.utils.reformat_json_list","text":"reformat_json_list ( json_obj ) Function to clean and reformat JSON lists to eliminate empty values and unnecessarily nested lists. Parameters: json_obj ( Any ) \u2013 JSON object (typically a dictionary or list, but can also be a primitive) to be cleaned. Returns: Any ( Any ) \u2013 Reformatted JSON list derived from original JSON object. Source code in yfpy/utils.py 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 def reformat_json_list ( json_obj : Any ) -> Any : \"\"\"Function to clean and reformat JSON lists to eliminate empty values and unnecessarily nested lists. Args: json_obj (Any): JSON object (typically a dictionary or list, but can also be a primitive) to be cleaned. Returns: Any: Reformatted JSON list derived from original JSON object. \"\"\" if isinstance ( json_obj [ 0 ], list ): if len ( json_obj ) > 1 : return reformat_json_list ( [ reformat_json_list ( item ) if isinstance ( item , list ) else item for item in json_obj ]) else : return reformat_json_list ( json_obj [ 0 ]) else : # create chain map that filters out empty lists/dicts but leaves objects where value = 0 return ChainMap ( * [ value for value in json_obj if ( value == 0 or value )])","title":"reformat_json_list"}]} \ No newline at end of file +{"config":{"indexing":"full","lang":["en"],"min_search_length":3,"prebuild_index":false,"separator":"[\\s\\-]+"},"docs":[{"location":"","text":"Welcome to YFPY! \u00b6 Please check out the README to get started!","title":"Welcome"},{"location":"#welcome-to-yfpy","text":"Please check out the README to get started!","title":"Welcome to YFPY!"},{"location":"data/","text":"Data \u00b6 YFPY module for retrieving, saving, and loading all Yahoo Fantasy Sports data. This module is designed to allow for easy data management, such that both retrieving and managing Yahoo Fantasy Sports data can be done in one place without the need to manually run the queries and manage data saved to JSON files. Example The Data module can be used as follows:: yahoo_query = YahooFantasySportsQuery ( \"\" , \"\" , game_id = \"\" , yahoo_consumer_key = os . environ . get ( \"YFPY_CONSUMER_KEY\" ), yahoo_consumer_secret = os . environ . get ( \"YFPY_CONSUMER_SECRET\" ), all_output_as_json_str = False , browser_callback = True , offline = False ) data_directory = Path ( __file__ ) . parent / \"output\" data = Data ( data_dir ) data . save ( \"file_name\" , yahoo_query . get_all_yahoo_fantasy_game_keys ) data . load ( \"file_name\" ) Attributes: logger ( Logger ) \u2013 Module level logger for usage and debugging. Data \u00b6 Bases: object YFPY Data object for Yahoo Fantasy Sports data retrieval, saving, and loading data as JSON. Source code in yfpy/data.py 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 227 228 class Data ( object ): \"\"\"YFPY Data object for Yahoo Fantasy Sports data retrieval, saving, and loading data as JSON. \"\"\" YFO = TypeVar ( \"YFO\" , bound = YahooFantasyObject ) def __init__ ( self , data_dir : Union [ Path , str ], save_data : bool = False , dev_offline : bool = False ): \"\"\"Instantiate data object to retrieve, save, and load Yahoo Fantasy Sports data. Args: data_dir (Path | str): Directory path where data will be saved/loaded. save_data (bool, optional): Boolean determining whether data is saved after retrieval from the Yahoo FF API. dev_offline (bool, optional): Boolean for offline development (requires a prior online run with save_data = True). \"\"\" self . data_dir : Path = data_dir if isinstance ( data_dir , PosixPath ) else Path ( data_dir ) self . save_data : bool = save_data self . dev_offline : bool = dev_offline def update_data_dir ( self , new_save_dir : Union [ Path , str ]) -> None : \"\"\"Modify the data storage directory if it needs to be updated. Args: new_save_dir (str | Path): Full path to new desired directory where data will be saved/loaded. Returns: None \"\"\" self . data_dir : Path = new_save_dir if isinstance ( new_save_dir , PosixPath ) else Path ( new_save_dir ) @staticmethod def fetch ( yf_query : Callable , params : Union [ Dict [ str , str ], None ] = None ) -> Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]]: \"\"\"Run query to retrieve Yahoo Fantasy Sports data. Args: yf_query (Callable of YahooFantasySportsQuery): Chosen yfpy query method to run. params (dict of str: str, optional): Dictionary of parameters to be passed to chosen yfpy query function. Returns: object: Data retrieved by the yfpy query. \"\"\" if params : return yf_query ( ** params ) else : return yf_query () def save ( self , file_name : str , yf_query : Callable , params : Union [ Dict [ str , Any ], None ] = None , new_data_dir : Union [ Path , str , None ] = None ) -> Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]]: \"\"\"Retrieve and save Yahoo Fantasy Sports data locally. Args: file_name (str): Name of file to which data will be saved. yf_query (Callable of YahooFantasySportsQuery): Chosen yfpy query method to run. params (dict of str: str, optional): Dictionary of parameters to be passed to chosen yfpy query function. new_data_dir (str | Path, optional): Full path to new desired directory to which data will be saved. Returns: object: Data retrieved by the yfpy query. \"\"\" # change data save directory if new_data_dir : new_data_dir = new_data_dir if isinstance ( new_data_dir , PosixPath ) else Path ( new_data_dir ) logger . debug ( f \"Data directory changed from { self . data_dir } to { new_data_dir } .\" ) self . update_data_dir ( new_data_dir ) # create full directory path if any directories in it do not already exist if not self . data_dir . exists (): self . data_dir . mkdir ( parents = True , exist_ok = True ) # check if parent YahooFantasySportsQuery.all_output_as_json_str = True, unset it for data saving, then reset it all_output_as_json = False # noinspection PyUnresolvedReferences if yf_query . __self__ . all_output_as_json_str : if inspect . ismethod ( yf_query ): # noinspection PyUnresolvedReferences for cls in inspect . getmro ( yf_query . __self__ . __class__ ): if yf_query . __name__ in cls . __dict__ : # noinspection PyUnresolvedReferences yf_query . __self__ . all_output_as_json_str = False all_output_as_json = True # run the actual yfpy query and retrieve the query results data = self . fetch ( yf_query , params ) # save the retrieved data locally saved_data_file_path = self . data_dir / f \" { file_name } .json\" with open ( saved_data_file_path , \"w\" , encoding = \"utf-8\" ) as data_file : if isinstance ( data , list ): # unflatten list of object values to list of single-key dictionaries with object values if top level of # data to be saved is a list unnested_data = [{ snakecase ( el . __class__ . __name__ ): el } for el in data ] else : unnested_data = data jsonify_data_to_file ( unnested_data , data_file ) logger . debug ( f \"Data saved locally to: { saved_data_file_path } \" ) # reset parent YahooFantasySportsQuery all_output_as_json_str = True and re-run query for json string return if all_output_as_json : # noinspection PyUnresolvedReferences yf_query . __self__ . all_output_as_json_str = True # data = self.get(yf_query, params) data = jsonify_data ( data ) return data def load ( self , file_name : str , data_type_class : Type [ YahooFantasyObject ] = None , new_data_dir : Union [ Path , str , None ] = None , all_output_as_json_str : bool = False ) -> Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]]: \"\"\"Load Yahoo Fantasy Sports data already stored locally. Note: This method will fail if the `save` method has not been called previously. Args: file_name (str): Name of file from which data will be loaded. data_type_class (Type[YahooFantasyObject], optional): YFPY models.py class for data casting. new_data_dir (str | Path, optional): Full path to new desired directory from which data will be loaded. all_output_as_json_str (bool): Boolean indicating if the output has been requested as a raw JSON string. Returns: object: Data loaded from the selected JSON file. \"\"\" # change data load directory if new_data_dir : new_data_dir = new_data_dir if isinstance ( new_data_dir , PosixPath ) else Path ( new_data_dir ) self . update_data_dir ( new_data_dir ) # load selected data file saved_data_file_path = self . data_dir / f \" { file_name } .json\" if saved_data_file_path . exists (): with open ( saved_data_file_path , \"r\" , encoding = \"utf-8\" ) as data_file : unpacked = unpack_data ( json . load ( data_file ), YahooFantasyObject ) data = data_type_class ( unpacked ) if data_type_class else unpacked if isinstance ( data , list ): # flatten list of single-key dictionaries with object values to list of object values if top level # of loaded data is a list data_element_key = list ( data [ 0 ] . keys ())[ 0 ] data = [ el [ data_element_key ] for el in data ] logger . debug ( f \"Data loaded locally from: { saved_data_file_path } \" ) else : raise FileNotFoundError ( f \"File { saved_data_file_path } does not exist. Cannot load data locally without \" f \"having previously saved data.\" ) if all_output_as_json_str : return jsonify_data ( data ) else : return data def retrieve ( self , file_name : str , yf_query : Callable , params : Union [ Dict [ str , str ], None ] = None , data_type_class : Type [ YahooFantasyObject ] = None , new_data_dir : Union [ Path , str , None ] = None ) -> Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]]: \"\"\"Fetch data from the web or load it locally (combination of the save and load methods). Args: file_name (str): Name of file to/from which data will be saved/loaded. yf_query (Callable of YahooFantasySportsQuery): Chosen yfpy query method to run. params (dict of str: str, optional): Dictionary of parameters to be passed to chosen yfpy query function. data_type_class (Type[YahooFantasyObject], optional): YFPY models.py class for data casting. new_data_dir (str | Path, optional): Full path to new desired directory to/from which data will be saved/loaded. Returns: object: Data retrieved by the yfpy query OR loaded from the selected JSON file. \"\"\" if self . dev_offline : return self . load ( file_name , data_type_class , new_data_dir ) else : if self . save_data : return self . save ( file_name , yf_query , params , new_data_dir ) else : return self . fetch ( yf_query , params ) __init__ \u00b6 __init__ ( data_dir , save_data = False , dev_offline = False ) Instantiate data object to retrieve, save, and load Yahoo Fantasy Sports data. Parameters: data_dir ( Path | str ) \u2013 Directory path where data will be saved/loaded. save_data ( bool , default: False ) \u2013 Boolean determining whether data is saved after retrieval from the Yahoo FF API. dev_offline ( bool , default: False ) \u2013 Boolean for offline development (requires a prior online run with save_data = True). Source code in yfpy/data.py 54 55 56 57 58 59 60 61 62 63 64 65 66 def __init__ ( self , data_dir : Union [ Path , str ], save_data : bool = False , dev_offline : bool = False ): \"\"\"Instantiate data object to retrieve, save, and load Yahoo Fantasy Sports data. Args: data_dir (Path | str): Directory path where data will be saved/loaded. save_data (bool, optional): Boolean determining whether data is saved after retrieval from the Yahoo FF API. dev_offline (bool, optional): Boolean for offline development (requires a prior online run with save_data = True). \"\"\" self . data_dir : Path = data_dir if isinstance ( data_dir , PosixPath ) else Path ( data_dir ) self . save_data : bool = save_data self . dev_offline : bool = dev_offline update_data_dir \u00b6 update_data_dir ( new_save_dir ) Modify the data storage directory if it needs to be updated. Parameters: new_save_dir ( str | Path ) \u2013 Full path to new desired directory where data will be saved/loaded. Returns: None \u2013 None Source code in yfpy/data.py 68 69 70 71 72 73 74 75 76 77 78 def update_data_dir ( self , new_save_dir : Union [ Path , str ]) -> None : \"\"\"Modify the data storage directory if it needs to be updated. Args: new_save_dir (str | Path): Full path to new desired directory where data will be saved/loaded. Returns: None \"\"\" self . data_dir : Path = new_save_dir if isinstance ( new_save_dir , PosixPath ) else Path ( new_save_dir ) fetch staticmethod \u00b6 fetch ( yf_query , params = None ) Run query to retrieve Yahoo Fantasy Sports data. Parameters: yf_query ( Callable of YahooFantasySportsQuery ) \u2013 Chosen yfpy query method to run. params ( dict of str , default: None ) \u2013 str, optional): Dictionary of parameters to be passed to chosen yfpy query function. Returns: object ( Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]] ) \u2013 Data retrieved by the yfpy query. Source code in yfpy/data.py 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 @staticmethod def fetch ( yf_query : Callable , params : Union [ Dict [ str , str ], None ] = None ) -> Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]]: \"\"\"Run query to retrieve Yahoo Fantasy Sports data. Args: yf_query (Callable of YahooFantasySportsQuery): Chosen yfpy query method to run. params (dict of str: str, optional): Dictionary of parameters to be passed to chosen yfpy query function. Returns: object: Data retrieved by the yfpy query. \"\"\" if params : return yf_query ( ** params ) else : return yf_query () save \u00b6 save ( file_name , yf_query , params = None , new_data_dir = None ) Retrieve and save Yahoo Fantasy Sports data locally. Parameters: file_name ( str ) \u2013 Name of file to which data will be saved. yf_query ( Callable of YahooFantasySportsQuery ) \u2013 Chosen yfpy query method to run. params ( dict of str , default: None ) \u2013 str, optional): Dictionary of parameters to be passed to chosen yfpy query function. new_data_dir ( str | Path , default: None ) \u2013 Full path to new desired directory to which data will be saved. Returns: object ( Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]] ) \u2013 Data retrieved by the yfpy query. Source code in yfpy/data.py 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 def save ( self , file_name : str , yf_query : Callable , params : Union [ Dict [ str , Any ], None ] = None , new_data_dir : Union [ Path , str , None ] = None ) -> Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]]: \"\"\"Retrieve and save Yahoo Fantasy Sports data locally. Args: file_name (str): Name of file to which data will be saved. yf_query (Callable of YahooFantasySportsQuery): Chosen yfpy query method to run. params (dict of str: str, optional): Dictionary of parameters to be passed to chosen yfpy query function. new_data_dir (str | Path, optional): Full path to new desired directory to which data will be saved. Returns: object: Data retrieved by the yfpy query. \"\"\" # change data save directory if new_data_dir : new_data_dir = new_data_dir if isinstance ( new_data_dir , PosixPath ) else Path ( new_data_dir ) logger . debug ( f \"Data directory changed from { self . data_dir } to { new_data_dir } .\" ) self . update_data_dir ( new_data_dir ) # create full directory path if any directories in it do not already exist if not self . data_dir . exists (): self . data_dir . mkdir ( parents = True , exist_ok = True ) # check if parent YahooFantasySportsQuery.all_output_as_json_str = True, unset it for data saving, then reset it all_output_as_json = False # noinspection PyUnresolvedReferences if yf_query . __self__ . all_output_as_json_str : if inspect . ismethod ( yf_query ): # noinspection PyUnresolvedReferences for cls in inspect . getmro ( yf_query . __self__ . __class__ ): if yf_query . __name__ in cls . __dict__ : # noinspection PyUnresolvedReferences yf_query . __self__ . all_output_as_json_str = False all_output_as_json = True # run the actual yfpy query and retrieve the query results data = self . fetch ( yf_query , params ) # save the retrieved data locally saved_data_file_path = self . data_dir / f \" { file_name } .json\" with open ( saved_data_file_path , \"w\" , encoding = \"utf-8\" ) as data_file : if isinstance ( data , list ): # unflatten list of object values to list of single-key dictionaries with object values if top level of # data to be saved is a list unnested_data = [{ snakecase ( el . __class__ . __name__ ): el } for el in data ] else : unnested_data = data jsonify_data_to_file ( unnested_data , data_file ) logger . debug ( f \"Data saved locally to: { saved_data_file_path } \" ) # reset parent YahooFantasySportsQuery all_output_as_json_str = True and re-run query for json string return if all_output_as_json : # noinspection PyUnresolvedReferences yf_query . __self__ . all_output_as_json_str = True # data = self.get(yf_query, params) data = jsonify_data ( data ) return data load \u00b6 load ( file_name , data_type_class = None , new_data_dir = None , all_output_as_json_str = False , ) Load Yahoo Fantasy Sports data already stored locally. Note This method will fail if the save method has not been called previously. Parameters: file_name ( str ) \u2013 Name of file from which data will be loaded. data_type_class ( Type [ YahooFantasyObject ] , default: None ) \u2013 YFPY models.py class for data casting. new_data_dir ( str | Path , default: None ) \u2013 Full path to new desired directory from which data will be loaded. all_output_as_json_str ( bool , default: False ) \u2013 Boolean indicating if the output has been requested as a raw JSON string. Returns: object ( Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]] ) \u2013 Data loaded from the selected JSON file. Source code in yfpy/data.py 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 def load ( self , file_name : str , data_type_class : Type [ YahooFantasyObject ] = None , new_data_dir : Union [ Path , str , None ] = None , all_output_as_json_str : bool = False ) -> Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]]: \"\"\"Load Yahoo Fantasy Sports data already stored locally. Note: This method will fail if the `save` method has not been called previously. Args: file_name (str): Name of file from which data will be loaded. data_type_class (Type[YahooFantasyObject], optional): YFPY models.py class for data casting. new_data_dir (str | Path, optional): Full path to new desired directory from which data will be loaded. all_output_as_json_str (bool): Boolean indicating if the output has been requested as a raw JSON string. Returns: object: Data loaded from the selected JSON file. \"\"\" # change data load directory if new_data_dir : new_data_dir = new_data_dir if isinstance ( new_data_dir , PosixPath ) else Path ( new_data_dir ) self . update_data_dir ( new_data_dir ) # load selected data file saved_data_file_path = self . data_dir / f \" { file_name } .json\" if saved_data_file_path . exists (): with open ( saved_data_file_path , \"r\" , encoding = \"utf-8\" ) as data_file : unpacked = unpack_data ( json . load ( data_file ), YahooFantasyObject ) data = data_type_class ( unpacked ) if data_type_class else unpacked if isinstance ( data , list ): # flatten list of single-key dictionaries with object values to list of object values if top level # of loaded data is a list data_element_key = list ( data [ 0 ] . keys ())[ 0 ] data = [ el [ data_element_key ] for el in data ] logger . debug ( f \"Data loaded locally from: { saved_data_file_path } \" ) else : raise FileNotFoundError ( f \"File { saved_data_file_path } does not exist. Cannot load data locally without \" f \"having previously saved data.\" ) if all_output_as_json_str : return jsonify_data ( data ) else : return data retrieve \u00b6 retrieve ( file_name , yf_query , params = None , data_type_class = None , new_data_dir = None , ) Fetch data from the web or load it locally (combination of the save and load methods). Parameters: file_name ( str ) \u2013 Name of file to/from which data will be saved/loaded. yf_query ( Callable of YahooFantasySportsQuery ) \u2013 Chosen yfpy query method to run. params ( dict of str , default: None ) \u2013 str, optional): Dictionary of parameters to be passed to chosen yfpy query function. data_type_class ( Type [ YahooFantasyObject ] , default: None ) \u2013 YFPY models.py class for data casting. new_data_dir ( str | Path , default: None ) \u2013 Full path to new desired directory to/from which data will be saved/loaded. Returns: object ( Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]] ) \u2013 Data retrieved by the yfpy query OR loaded from the selected JSON file. Source code in yfpy/data.py 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 def retrieve ( self , file_name : str , yf_query : Callable , params : Union [ Dict [ str , str ], None ] = None , data_type_class : Type [ YahooFantasyObject ] = None , new_data_dir : Union [ Path , str , None ] = None ) -> Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]]: \"\"\"Fetch data from the web or load it locally (combination of the save and load methods). Args: file_name (str): Name of file to/from which data will be saved/loaded. yf_query (Callable of YahooFantasySportsQuery): Chosen yfpy query method to run. params (dict of str: str, optional): Dictionary of parameters to be passed to chosen yfpy query function. data_type_class (Type[YahooFantasyObject], optional): YFPY models.py class for data casting. new_data_dir (str | Path, optional): Full path to new desired directory to/from which data will be saved/loaded. Returns: object: Data retrieved by the yfpy query OR loaded from the selected JSON file. \"\"\" if self . dev_offline : return self . load ( file_name , data_type_class , new_data_dir ) else : if self . save_data : return self . save ( file_name , yf_query , params , new_data_dir ) else : return self . fetch ( yf_query , params )","title":"Data"},{"location":"data/#data","text":"YFPY module for retrieving, saving, and loading all Yahoo Fantasy Sports data. This module is designed to allow for easy data management, such that both retrieving and managing Yahoo Fantasy Sports data can be done in one place without the need to manually run the queries and manage data saved to JSON files. Example The Data module can be used as follows:: yahoo_query = YahooFantasySportsQuery ( \"\" , \"\" , game_id = \"\" , yahoo_consumer_key = os . environ . get ( \"YFPY_CONSUMER_KEY\" ), yahoo_consumer_secret = os . environ . get ( \"YFPY_CONSUMER_SECRET\" ), all_output_as_json_str = False , browser_callback = True , offline = False ) data_directory = Path ( __file__ ) . parent / \"output\" data = Data ( data_dir ) data . save ( \"file_name\" , yahoo_query . get_all_yahoo_fantasy_game_keys ) data . load ( \"file_name\" ) Attributes: logger ( Logger ) \u2013 Module level logger for usage and debugging.","title":"Data"},{"location":"data/#yfpy.data.Data","text":"Bases: object YFPY Data object for Yahoo Fantasy Sports data retrieval, saving, and loading data as JSON. Source code in yfpy/data.py 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 227 228 class Data ( object ): \"\"\"YFPY Data object for Yahoo Fantasy Sports data retrieval, saving, and loading data as JSON. \"\"\" YFO = TypeVar ( \"YFO\" , bound = YahooFantasyObject ) def __init__ ( self , data_dir : Union [ Path , str ], save_data : bool = False , dev_offline : bool = False ): \"\"\"Instantiate data object to retrieve, save, and load Yahoo Fantasy Sports data. Args: data_dir (Path | str): Directory path where data will be saved/loaded. save_data (bool, optional): Boolean determining whether data is saved after retrieval from the Yahoo FF API. dev_offline (bool, optional): Boolean for offline development (requires a prior online run with save_data = True). \"\"\" self . data_dir : Path = data_dir if isinstance ( data_dir , PosixPath ) else Path ( data_dir ) self . save_data : bool = save_data self . dev_offline : bool = dev_offline def update_data_dir ( self , new_save_dir : Union [ Path , str ]) -> None : \"\"\"Modify the data storage directory if it needs to be updated. Args: new_save_dir (str | Path): Full path to new desired directory where data will be saved/loaded. Returns: None \"\"\" self . data_dir : Path = new_save_dir if isinstance ( new_save_dir , PosixPath ) else Path ( new_save_dir ) @staticmethod def fetch ( yf_query : Callable , params : Union [ Dict [ str , str ], None ] = None ) -> Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]]: \"\"\"Run query to retrieve Yahoo Fantasy Sports data. Args: yf_query (Callable of YahooFantasySportsQuery): Chosen yfpy query method to run. params (dict of str: str, optional): Dictionary of parameters to be passed to chosen yfpy query function. Returns: object: Data retrieved by the yfpy query. \"\"\" if params : return yf_query ( ** params ) else : return yf_query () def save ( self , file_name : str , yf_query : Callable , params : Union [ Dict [ str , Any ], None ] = None , new_data_dir : Union [ Path , str , None ] = None ) -> Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]]: \"\"\"Retrieve and save Yahoo Fantasy Sports data locally. Args: file_name (str): Name of file to which data will be saved. yf_query (Callable of YahooFantasySportsQuery): Chosen yfpy query method to run. params (dict of str: str, optional): Dictionary of parameters to be passed to chosen yfpy query function. new_data_dir (str | Path, optional): Full path to new desired directory to which data will be saved. Returns: object: Data retrieved by the yfpy query. \"\"\" # change data save directory if new_data_dir : new_data_dir = new_data_dir if isinstance ( new_data_dir , PosixPath ) else Path ( new_data_dir ) logger . debug ( f \"Data directory changed from { self . data_dir } to { new_data_dir } .\" ) self . update_data_dir ( new_data_dir ) # create full directory path if any directories in it do not already exist if not self . data_dir . exists (): self . data_dir . mkdir ( parents = True , exist_ok = True ) # check if parent YahooFantasySportsQuery.all_output_as_json_str = True, unset it for data saving, then reset it all_output_as_json = False # noinspection PyUnresolvedReferences if yf_query . __self__ . all_output_as_json_str : if inspect . ismethod ( yf_query ): # noinspection PyUnresolvedReferences for cls in inspect . getmro ( yf_query . __self__ . __class__ ): if yf_query . __name__ in cls . __dict__ : # noinspection PyUnresolvedReferences yf_query . __self__ . all_output_as_json_str = False all_output_as_json = True # run the actual yfpy query and retrieve the query results data = self . fetch ( yf_query , params ) # save the retrieved data locally saved_data_file_path = self . data_dir / f \" { file_name } .json\" with open ( saved_data_file_path , \"w\" , encoding = \"utf-8\" ) as data_file : if isinstance ( data , list ): # unflatten list of object values to list of single-key dictionaries with object values if top level of # data to be saved is a list unnested_data = [{ snakecase ( el . __class__ . __name__ ): el } for el in data ] else : unnested_data = data jsonify_data_to_file ( unnested_data , data_file ) logger . debug ( f \"Data saved locally to: { saved_data_file_path } \" ) # reset parent YahooFantasySportsQuery all_output_as_json_str = True and re-run query for json string return if all_output_as_json : # noinspection PyUnresolvedReferences yf_query . __self__ . all_output_as_json_str = True # data = self.get(yf_query, params) data = jsonify_data ( data ) return data def load ( self , file_name : str , data_type_class : Type [ YahooFantasyObject ] = None , new_data_dir : Union [ Path , str , None ] = None , all_output_as_json_str : bool = False ) -> Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]]: \"\"\"Load Yahoo Fantasy Sports data already stored locally. Note: This method will fail if the `save` method has not been called previously. Args: file_name (str): Name of file from which data will be loaded. data_type_class (Type[YahooFantasyObject], optional): YFPY models.py class for data casting. new_data_dir (str | Path, optional): Full path to new desired directory from which data will be loaded. all_output_as_json_str (bool): Boolean indicating if the output has been requested as a raw JSON string. Returns: object: Data loaded from the selected JSON file. \"\"\" # change data load directory if new_data_dir : new_data_dir = new_data_dir if isinstance ( new_data_dir , PosixPath ) else Path ( new_data_dir ) self . update_data_dir ( new_data_dir ) # load selected data file saved_data_file_path = self . data_dir / f \" { file_name } .json\" if saved_data_file_path . exists (): with open ( saved_data_file_path , \"r\" , encoding = \"utf-8\" ) as data_file : unpacked = unpack_data ( json . load ( data_file ), YahooFantasyObject ) data = data_type_class ( unpacked ) if data_type_class else unpacked if isinstance ( data , list ): # flatten list of single-key dictionaries with object values to list of object values if top level # of loaded data is a list data_element_key = list ( data [ 0 ] . keys ())[ 0 ] data = [ el [ data_element_key ] for el in data ] logger . debug ( f \"Data loaded locally from: { saved_data_file_path } \" ) else : raise FileNotFoundError ( f \"File { saved_data_file_path } does not exist. Cannot load data locally without \" f \"having previously saved data.\" ) if all_output_as_json_str : return jsonify_data ( data ) else : return data def retrieve ( self , file_name : str , yf_query : Callable , params : Union [ Dict [ str , str ], None ] = None , data_type_class : Type [ YahooFantasyObject ] = None , new_data_dir : Union [ Path , str , None ] = None ) -> Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]]: \"\"\"Fetch data from the web or load it locally (combination of the save and load methods). Args: file_name (str): Name of file to/from which data will be saved/loaded. yf_query (Callable of YahooFantasySportsQuery): Chosen yfpy query method to run. params (dict of str: str, optional): Dictionary of parameters to be passed to chosen yfpy query function. data_type_class (Type[YahooFantasyObject], optional): YFPY models.py class for data casting. new_data_dir (str | Path, optional): Full path to new desired directory to/from which data will be saved/loaded. Returns: object: Data retrieved by the yfpy query OR loaded from the selected JSON file. \"\"\" if self . dev_offline : return self . load ( file_name , data_type_class , new_data_dir ) else : if self . save_data : return self . save ( file_name , yf_query , params , new_data_dir ) else : return self . fetch ( yf_query , params )","title":"Data"},{"location":"data/#yfpy.data.Data.__init__","text":"__init__ ( data_dir , save_data = False , dev_offline = False ) Instantiate data object to retrieve, save, and load Yahoo Fantasy Sports data. Parameters: data_dir ( Path | str ) \u2013 Directory path where data will be saved/loaded. save_data ( bool , default: False ) \u2013 Boolean determining whether data is saved after retrieval from the Yahoo FF API. dev_offline ( bool , default: False ) \u2013 Boolean for offline development (requires a prior online run with save_data = True). Source code in yfpy/data.py 54 55 56 57 58 59 60 61 62 63 64 65 66 def __init__ ( self , data_dir : Union [ Path , str ], save_data : bool = False , dev_offline : bool = False ): \"\"\"Instantiate data object to retrieve, save, and load Yahoo Fantasy Sports data. Args: data_dir (Path | str): Directory path where data will be saved/loaded. save_data (bool, optional): Boolean determining whether data is saved after retrieval from the Yahoo FF API. dev_offline (bool, optional): Boolean for offline development (requires a prior online run with save_data = True). \"\"\" self . data_dir : Path = data_dir if isinstance ( data_dir , PosixPath ) else Path ( data_dir ) self . save_data : bool = save_data self . dev_offline : bool = dev_offline","title":"__init__"},{"location":"data/#yfpy.data.Data.update_data_dir","text":"update_data_dir ( new_save_dir ) Modify the data storage directory if it needs to be updated. Parameters: new_save_dir ( str | Path ) \u2013 Full path to new desired directory where data will be saved/loaded. Returns: None \u2013 None Source code in yfpy/data.py 68 69 70 71 72 73 74 75 76 77 78 def update_data_dir ( self , new_save_dir : Union [ Path , str ]) -> None : \"\"\"Modify the data storage directory if it needs to be updated. Args: new_save_dir (str | Path): Full path to new desired directory where data will be saved/loaded. Returns: None \"\"\" self . data_dir : Path = new_save_dir if isinstance ( new_save_dir , PosixPath ) else Path ( new_save_dir )","title":"update_data_dir"},{"location":"data/#yfpy.data.Data.fetch","text":"fetch ( yf_query , params = None ) Run query to retrieve Yahoo Fantasy Sports data. Parameters: yf_query ( Callable of YahooFantasySportsQuery ) \u2013 Chosen yfpy query method to run. params ( dict of str , default: None ) \u2013 str, optional): Dictionary of parameters to be passed to chosen yfpy query function. Returns: object ( Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]] ) \u2013 Data retrieved by the yfpy query. Source code in yfpy/data.py 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 @staticmethod def fetch ( yf_query : Callable , params : Union [ Dict [ str , str ], None ] = None ) -> Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]]: \"\"\"Run query to retrieve Yahoo Fantasy Sports data. Args: yf_query (Callable of YahooFantasySportsQuery): Chosen yfpy query method to run. params (dict of str: str, optional): Dictionary of parameters to be passed to chosen yfpy query function. Returns: object: Data retrieved by the yfpy query. \"\"\" if params : return yf_query ( ** params ) else : return yf_query ()","title":"fetch"},{"location":"data/#yfpy.data.Data.save","text":"save ( file_name , yf_query , params = None , new_data_dir = None ) Retrieve and save Yahoo Fantasy Sports data locally. Parameters: file_name ( str ) \u2013 Name of file to which data will be saved. yf_query ( Callable of YahooFantasySportsQuery ) \u2013 Chosen yfpy query method to run. params ( dict of str , default: None ) \u2013 str, optional): Dictionary of parameters to be passed to chosen yfpy query function. new_data_dir ( str | Path , default: None ) \u2013 Full path to new desired directory to which data will be saved. Returns: object ( Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]] ) \u2013 Data retrieved by the yfpy query. Source code in yfpy/data.py 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 def save ( self , file_name : str , yf_query : Callable , params : Union [ Dict [ str , Any ], None ] = None , new_data_dir : Union [ Path , str , None ] = None ) -> Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]]: \"\"\"Retrieve and save Yahoo Fantasy Sports data locally. Args: file_name (str): Name of file to which data will be saved. yf_query (Callable of YahooFantasySportsQuery): Chosen yfpy query method to run. params (dict of str: str, optional): Dictionary of parameters to be passed to chosen yfpy query function. new_data_dir (str | Path, optional): Full path to new desired directory to which data will be saved. Returns: object: Data retrieved by the yfpy query. \"\"\" # change data save directory if new_data_dir : new_data_dir = new_data_dir if isinstance ( new_data_dir , PosixPath ) else Path ( new_data_dir ) logger . debug ( f \"Data directory changed from { self . data_dir } to { new_data_dir } .\" ) self . update_data_dir ( new_data_dir ) # create full directory path if any directories in it do not already exist if not self . data_dir . exists (): self . data_dir . mkdir ( parents = True , exist_ok = True ) # check if parent YahooFantasySportsQuery.all_output_as_json_str = True, unset it for data saving, then reset it all_output_as_json = False # noinspection PyUnresolvedReferences if yf_query . __self__ . all_output_as_json_str : if inspect . ismethod ( yf_query ): # noinspection PyUnresolvedReferences for cls in inspect . getmro ( yf_query . __self__ . __class__ ): if yf_query . __name__ in cls . __dict__ : # noinspection PyUnresolvedReferences yf_query . __self__ . all_output_as_json_str = False all_output_as_json = True # run the actual yfpy query and retrieve the query results data = self . fetch ( yf_query , params ) # save the retrieved data locally saved_data_file_path = self . data_dir / f \" { file_name } .json\" with open ( saved_data_file_path , \"w\" , encoding = \"utf-8\" ) as data_file : if isinstance ( data , list ): # unflatten list of object values to list of single-key dictionaries with object values if top level of # data to be saved is a list unnested_data = [{ snakecase ( el . __class__ . __name__ ): el } for el in data ] else : unnested_data = data jsonify_data_to_file ( unnested_data , data_file ) logger . debug ( f \"Data saved locally to: { saved_data_file_path } \" ) # reset parent YahooFantasySportsQuery all_output_as_json_str = True and re-run query for json string return if all_output_as_json : # noinspection PyUnresolvedReferences yf_query . __self__ . all_output_as_json_str = True # data = self.get(yf_query, params) data = jsonify_data ( data ) return data","title":"save"},{"location":"data/#yfpy.data.Data.load","text":"load ( file_name , data_type_class = None , new_data_dir = None , all_output_as_json_str = False , ) Load Yahoo Fantasy Sports data already stored locally. Note This method will fail if the save method has not been called previously. Parameters: file_name ( str ) \u2013 Name of file from which data will be loaded. data_type_class ( Type [ YahooFantasyObject ] , default: None ) \u2013 YFPY models.py class for data casting. new_data_dir ( str | Path , default: None ) \u2013 Full path to new desired directory from which data will be loaded. all_output_as_json_str ( bool , default: False ) \u2013 Boolean indicating if the output has been requested as a raw JSON string. Returns: object ( Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]] ) \u2013 Data loaded from the selected JSON file. Source code in yfpy/data.py 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 def load ( self , file_name : str , data_type_class : Type [ YahooFantasyObject ] = None , new_data_dir : Union [ Path , str , None ] = None , all_output_as_json_str : bool = False ) -> Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]]: \"\"\"Load Yahoo Fantasy Sports data already stored locally. Note: This method will fail if the `save` method has not been called previously. Args: file_name (str): Name of file from which data will be loaded. data_type_class (Type[YahooFantasyObject], optional): YFPY models.py class for data casting. new_data_dir (str | Path, optional): Full path to new desired directory from which data will be loaded. all_output_as_json_str (bool): Boolean indicating if the output has been requested as a raw JSON string. Returns: object: Data loaded from the selected JSON file. \"\"\" # change data load directory if new_data_dir : new_data_dir = new_data_dir if isinstance ( new_data_dir , PosixPath ) else Path ( new_data_dir ) self . update_data_dir ( new_data_dir ) # load selected data file saved_data_file_path = self . data_dir / f \" { file_name } .json\" if saved_data_file_path . exists (): with open ( saved_data_file_path , \"r\" , encoding = \"utf-8\" ) as data_file : unpacked = unpack_data ( json . load ( data_file ), YahooFantasyObject ) data = data_type_class ( unpacked ) if data_type_class else unpacked if isinstance ( data , list ): # flatten list of single-key dictionaries with object values to list of object values if top level # of loaded data is a list data_element_key = list ( data [ 0 ] . keys ())[ 0 ] data = [ el [ data_element_key ] for el in data ] logger . debug ( f \"Data loaded locally from: { saved_data_file_path } \" ) else : raise FileNotFoundError ( f \"File { saved_data_file_path } does not exist. Cannot load data locally without \" f \"having previously saved data.\" ) if all_output_as_json_str : return jsonify_data ( data ) else : return data","title":"load"},{"location":"data/#yfpy.data.Data.retrieve","text":"retrieve ( file_name , yf_query , params = None , data_type_class = None , new_data_dir = None , ) Fetch data from the web or load it locally (combination of the save and load methods). Parameters: file_name ( str ) \u2013 Name of file to/from which data will be saved/loaded. yf_query ( Callable of YahooFantasySportsQuery ) \u2013 Chosen yfpy query method to run. params ( dict of str , default: None ) \u2013 str, optional): Dictionary of parameters to be passed to chosen yfpy query function. data_type_class ( Type [ YahooFantasyObject ] , default: None ) \u2013 YFPY models.py class for data casting. new_data_dir ( str | Path , default: None ) \u2013 Full path to new desired directory to/from which data will be saved/loaded. Returns: object ( Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]] ) \u2013 Data retrieved by the yfpy query OR loaded from the selected JSON file. Source code in yfpy/data.py 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 def retrieve ( self , file_name : str , yf_query : Callable , params : Union [ Dict [ str , str ], None ] = None , data_type_class : Type [ YahooFantasyObject ] = None , new_data_dir : Union [ Path , str , None ] = None ) -> Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]]: \"\"\"Fetch data from the web or load it locally (combination of the save and load methods). Args: file_name (str): Name of file to/from which data will be saved/loaded. yf_query (Callable of YahooFantasySportsQuery): Chosen yfpy query method to run. params (dict of str: str, optional): Dictionary of parameters to be passed to chosen yfpy query function. data_type_class (Type[YahooFantasyObject], optional): YFPY models.py class for data casting. new_data_dir (str | Path, optional): Full path to new desired directory to/from which data will be saved/loaded. Returns: object: Data retrieved by the yfpy query OR loaded from the selected JSON file. \"\"\" if self . dev_offline : return self . load ( file_name , data_type_class , new_data_dir ) else : if self . save_data : return self . save ( file_name , yf_query , params , new_data_dir ) else : return self . fetch ( yf_query , params )","title":"retrieve"},{"location":"exceptions/","text":"Exceptions \u00b6 YFPY module for throwing custom exceptions. Attributes: logger ( Logger ) \u2013 Module level logger for usage and debugging. YahooFantasySportsException \u00b6 Bases: Exception Base YFPY exception class for Yahoo Fantasy Sports API exceptions. Source code in yfpy/exceptions.py 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 class YahooFantasySportsException ( Exception ): \"\"\"Base YFPY exception class for Yahoo Fantasy Sports API exceptions. \"\"\" def __init__ ( self , message : str , payload : str = None , url : str = None ): \"\"\"Instantiate YFPY exception. Args: message (str): Human readable string describing the exception. payload (str, optional): The API exception error payload. url (str, optional): Yahoo Fantasy Sports REST API URL. Attributes: message (str): Human readable string describing the exception. payload (str): The API exception error payload. url (str): Yahoo Fantasy Sports REST API URL. \"\"\" self . message : str = message self . payload : str = payload self . url : str = url def __str__ ( self ): return str ( self . message ) __init__ \u00b6 __init__ ( message , payload = None , url = None ) Instantiate YFPY exception. Parameters: message ( str ) \u2013 Human readable string describing the exception. payload ( str , default: None ) \u2013 The API exception error payload. url ( str , default: None ) \u2013 Yahoo Fantasy Sports REST API URL. Attributes: message ( str ) \u2013 Human readable string describing the exception. payload ( str ) \u2013 The API exception error payload. url ( str ) \u2013 Yahoo Fantasy Sports REST API URL. Source code in yfpy/exceptions.py 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 def __init__ ( self , message : str , payload : str = None , url : str = None ): \"\"\"Instantiate YFPY exception. Args: message (str): Human readable string describing the exception. payload (str, optional): The API exception error payload. url (str, optional): Yahoo Fantasy Sports REST API URL. Attributes: message (str): Human readable string describing the exception. payload (str): The API exception error payload. url (str): Yahoo Fantasy Sports REST API URL. \"\"\" self . message : str = message self . payload : str = payload self . url : str = url YahooFantasySportsDataNotFound \u00b6 Bases: YahooFantasySportsException YFPY exception when no data was retrieved from the Yahoo Fantasy Sports REST API. Source code in yfpy/exceptions.py 41 42 class YahooFantasySportsDataNotFound ( YahooFantasySportsException ): \"\"\"YFPY exception when no data was retrieved from the Yahoo Fantasy Sports REST API.\"\"\"","title":"Exceptions"},{"location":"exceptions/#exceptions","text":"YFPY module for throwing custom exceptions. Attributes: logger ( Logger ) \u2013 Module level logger for usage and debugging.","title":"Exceptions"},{"location":"exceptions/#yfpy.exceptions.YahooFantasySportsException","text":"Bases: Exception Base YFPY exception class for Yahoo Fantasy Sports API exceptions. Source code in yfpy/exceptions.py 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 class YahooFantasySportsException ( Exception ): \"\"\"Base YFPY exception class for Yahoo Fantasy Sports API exceptions. \"\"\" def __init__ ( self , message : str , payload : str = None , url : str = None ): \"\"\"Instantiate YFPY exception. Args: message (str): Human readable string describing the exception. payload (str, optional): The API exception error payload. url (str, optional): Yahoo Fantasy Sports REST API URL. Attributes: message (str): Human readable string describing the exception. payload (str): The API exception error payload. url (str): Yahoo Fantasy Sports REST API URL. \"\"\" self . message : str = message self . payload : str = payload self . url : str = url def __str__ ( self ): return str ( self . message )","title":"YahooFantasySportsException"},{"location":"exceptions/#yfpy.exceptions.YahooFantasySportsException.__init__","text":"__init__ ( message , payload = None , url = None ) Instantiate YFPY exception. Parameters: message ( str ) \u2013 Human readable string describing the exception. payload ( str , default: None ) \u2013 The API exception error payload. url ( str , default: None ) \u2013 Yahoo Fantasy Sports REST API URL. Attributes: message ( str ) \u2013 Human readable string describing the exception. payload ( str ) \u2013 The API exception error payload. url ( str ) \u2013 Yahoo Fantasy Sports REST API URL. Source code in yfpy/exceptions.py 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 def __init__ ( self , message : str , payload : str = None , url : str = None ): \"\"\"Instantiate YFPY exception. Args: message (str): Human readable string describing the exception. payload (str, optional): The API exception error payload. url (str, optional): Yahoo Fantasy Sports REST API URL. Attributes: message (str): Human readable string describing the exception. payload (str): The API exception error payload. url (str): Yahoo Fantasy Sports REST API URL. \"\"\" self . message : str = message self . payload : str = payload self . url : str = url","title":"__init__"},{"location":"exceptions/#yfpy.exceptions.YahooFantasySportsDataNotFound","text":"Bases: YahooFantasySportsException YFPY exception when no data was retrieved from the Yahoo Fantasy Sports REST API. Source code in yfpy/exceptions.py 41 42 class YahooFantasySportsDataNotFound ( YahooFantasySportsException ): \"\"\"YFPY exception when no data was retrieved from the Yahoo Fantasy Sports REST API.\"\"\"","title":"YahooFantasySportsDataNotFound"},{"location":"logger/","text":"Logging \u00b6 YFPY module for configuring and formatting the custom logger. get_logger \u00b6 get_logger ( name , level = INFO ) Get custom YFPY logger object. Parameters: name ( str ) \u2013 The module name for the logger. level ( int , default: INFO ) \u2013 The log level for the logger. Default level set to INFO. Returns: Logger ( Logger ) \u2013 A Python Logger object with custom configuration and formatting. Source code in yfpy/logger.py 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 def get_logger ( name : str , level : int = INFO ) -> Logger : \"\"\"Get custom YFPY logger object. Args: name (str): The module name for the logger. level (int): The log level for the logger. Default level set to INFO. Returns: Logger: A Python Logger object with custom configuration and formatting. \"\"\" logger = getLogger ( name ) if len ( logger . handlers ) > 0 : logger . handlers = [] if level : logger . setLevel ( level ) sh = StreamHandler () if level : sh . setLevel ( level ) formatter = Formatter ( fmt = \" %(asctime)s . %(msecs)03d - %(levelname)s - %(filename)s - %(name)s : %(lineno)d - %(message)s \" , datefmt = \"%Y-%m- %d %H:%M:%S\" ) sh . setFormatter ( formatter ) logger . addHandler ( sh ) return logger","title":"Logging"},{"location":"logger/#logging","text":"YFPY module for configuring and formatting the custom logger.","title":"Logging"},{"location":"logger/#yfpy.logger.get_logger","text":"get_logger ( name , level = INFO ) Get custom YFPY logger object. Parameters: name ( str ) \u2013 The module name for the logger. level ( int , default: INFO ) \u2013 The log level for the logger. Default level set to INFO. Returns: Logger ( Logger ) \u2013 A Python Logger object with custom configuration and formatting. Source code in yfpy/logger.py 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 def get_logger ( name : str , level : int = INFO ) -> Logger : \"\"\"Get custom YFPY logger object. Args: name (str): The module name for the logger. level (int): The log level for the logger. Default level set to INFO. Returns: Logger: A Python Logger object with custom configuration and formatting. \"\"\" logger = getLogger ( name ) if len ( logger . handlers ) > 0 : logger . handlers = [] if level : logger . setLevel ( level ) sh = StreamHandler () if level : sh . setLevel ( level ) formatter = Formatter ( fmt = \" %(asctime)s . %(msecs)03d - %(levelname)s - %(filename)s - %(name)s : %(lineno)d - %(message)s \" , datefmt = \"%Y-%m- %d %H:%M:%S\" ) sh . setFormatter ( formatter ) logger . addHandler ( sh ) return logger","title":"get_logger"},{"location":"models/","text":"Models \u00b6 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 ) \u2013 Module level logger for usage and debugging. YahooFantasyObject \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate a Yahoo Fantasy Object. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: extracted_data ( dict ) \u2013 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__ \u00b6 __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__ \u00b6 __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__ \u00b6 __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 \u00b6 subclass_dict () Derive snake case dictionary keys from custom object type camel case class names. Returns: dict ( Dict ) \u2013 Dictionary with snake case strings of all subclasses of YahooFantasyObject as keys and subclasses as Dict \u2013 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 \u00b6 clean_data_dict () Recursive method to un-type custom class type objects for serialization. Returns: dict ( Dict ) \u2013 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 \u00b6 serialized () Pack up all object content into nested dictionaries for JSON serialization. Returns: dict ( Dict ) \u2013 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 \u00b6 to_json () Serialize the class object to JSON. Returns: str ( str ) \u2013 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 \u00b6 from_json ( json_data ) Deserialize JSON to a class object. Returns: object ( object ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the User child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: games ( list [ Game ] ) \u2013 The Yahoo Fantasy games in which the user participates/has participated. guid ( str ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the Game child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: code ( str ) \u2013 The Yahoo Fantasy game code. contest_group_id ( int ) \u2013 The contest group ID of the Yahoo Fantasy game/contest. current_week ( int ) \u2013 The current (or last if complete) week of the Yahoo Fantasy game/contest. editorial_season ( int ) \u2013 The year in which the Yahoo Fantasy game/contest starts. game_id ( int ) \u2013 The Yahoo Fantasy game ID. game_key ( str ) \u2013 The Yahoo Fantasy game key. game_weeks ( list [ GameWeek ] ) \u2013 A list of YFPY GameWeek instances. has_schedule ( int ) \u2013 Numeric boolean (0 or 1) representing if the Yahoo Fantasy contest has a schedule. is_contest_over ( int ) \u2013 Numeric boolean (0 or 1) representing if the Yahoo Fantasy contest is complete. is_contest_reg_active ( int ) \u2013 Numeric boolean (0 or 1) representing if the Yahoo Fantasy contest is active. is_game_over ( int ) \u2013 Numeric boolean (0 or 1) representing if the Yahoo Fantasy game is complete. is_live_draft_lobby_active ( int ) \u2013 Numeric boolean (0 or 1) representing if the draft lobby is active. is_offseason ( int ) \u2013 Numeric boolean (0 or 1) representing if it is the offseason for the respective sport. is_registration_over ( int ) \u2013 Numeric boolean (0 or 1) representing registration for the fantasy game is over. leagues ( list [ League ] ) \u2013 A list of YFPY League instances. name ( str ) \u2013 The name of the Yahoo Fantasy game. picks_status ( str ) \u2013 The status of the Yahoo Fantasy game/contest picks when applicable. players ( list [ Player ] ) \u2013 A list of YFPY Player instances. position_types ( list [ PositionType ] ) \u2013 A list of YFPY PositionType instances. roster_positions ( list [ RosterPosition ] ) \u2013 A list of YFPY RosterPosition instances. scenario_generator ( int ) \u2013 Numeric boolean (0 or 1) representing if the Yahoo Fantasy game has a scenario generator. season ( int ) \u2013 The Yahoo Fantasy game year. stat_categories ( StatCategories ) \u2013 A YFPY StatCategories instance. teams ( list [ Team ] ) \u2013 A list of YFPY Team instances. type ( str ) \u2013 The type of the Yahoo Fantasy game. url ( str ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the GameWeek child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: display_name ( str ) \u2013 The display name of the Yahoo Fantasy game week. end ( str ) \u2013 The end date of the Yahoo Fantasy game week. start ( str ) \u2013 The start date of the Yahoo Fantasy game week. week ( int ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the PositionType child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: type ( str ) \u2013 The type of the player position (\"offense\", \"defense\", etc.). display_name ( str ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the League child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: allow_add_to_dl_extra_pos ( int ) \u2013 Numeric boolean (0 or 1) representing if the leagues allows adding extra positions to the DL (currently uncertain what this is). current_week ( int ) \u2013 The current week number. draft_results ( list [ DraftResult ] ) \u2013 A list of YFPY DraftResult instances. draft_status ( str ) \u2013 The status of the draft (\"postdraft\", etc.). display_name ( str ) \u2013 The display name of the league. edit_key ( int ) \u2013 The Yahoo edit key for the league. end_date ( str ) \u2013 A date string representing the end date of the league (format: \"YYYY-MM-DD\"). end_week ( int ) \u2013 The number of the last week of the league. entry_fee ( str ) \u2013 The entry fee for Yahoo paid leagues (USD). felo_tier ( str ) \u2013 The league fantasy ELO level (Bronze, Silver, Gold, Platinum, Diamond). game_code ( str ) \u2013 The Yahoo game code (\"nfl\", \"nhl\", \"nba\", \"mlb\"). iris_group_chat_id ( str | null ) \u2013 The unique IRIS group chat ID for the league. is_cash_league ( int ) \u2013 Numeric boolean (0 or 1) representing if the league is a Yahoo paid league. is_finished ( int ) \u2013 Numeric boolean (0 or 1) representing if the league season has completed. is_plus_league ( int ) \u2013 Numeric boolean (0 or 1) representing if the league has paid for Yahoo Fantasy Plus. is_pro_league ( str ) \u2013 Numeric boolean (0 or 1) representing if the league is a Yahoo Pro league. league_id ( str ) \u2013 The unique Yahoo league ID. league_key ( str ) \u2013 The Yahoo league key. league_type ( str ) \u2013 The type of the league (\"private\", \"public\"). league_update_timestamp ( int ) \u2013 A timestamp representing the last time the league was updated. logo_url ( str ) \u2013 The direct URL of the league logo photo. name ( str ) \u2013 The name of the league. num_teams ( str ) \u2013 The number of teams in the league. password ( str | null ) \u2013 The password required to join the league (if applicable). payment_deadline ( str ) \u2013 A date string representing the deadline by which all league dues payments must be made (format: \"YYYY-MM-DD\"). players ( list [ Player ] ) \u2013 A list of YFPY Player instances. renew ( str | null ) \u2013 A string indicating the previous Yahoo game code and previous Yahoo league ID (Ex.: \"371_811308\") (if applicable). renewed ( str | null ) \u2013 A string indicating the next Yahoo game code and next Yahoo league ID (Ex.: \"390_303233\") (if applicable). scoreboard ( Scoreboard ) \u2013 A YFPY Scoreboard instance. matchups ( list [ Matchup ] ) \u2013 A list of YFPY Matchup instances. scoring_type ( str ) \u2013 The scoring type of the league (\"head\" for head-to-head, etc.). season ( int ) \u2013 The season year of the league. settings ( Settings ) \u2013 A YFPY Settings instance. short_invitation_url ( str ) \u2013 The sharable short URL sent by invite allowing players to join the league. standings ( Standings ) \u2013 A YFPY Standings instance. start_date ( str ) \u2013 A date string representing the start date of the league (format: \"YYYY-MM-DD\"). start_week ( int ) \u2013 The number of the first week of the league. teams ( list [ Team ] ) \u2013 A list of YFPY Team instances. teams_ordered_by_standings ( list [ Team ] ) \u2013 A list of YFPY Team instances ordered by their ranks in the league standings. transactions ( list [ Transaction ] ) \u2013 A list of YFPY Transaction instances. url ( str ) \u2013 The direct URL of the league. weekly_deadline ( str | null ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the Team child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: can_edit_current_week ( int ) \u2013 (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 ) \u2013 (for Tourney Pick'em) The selected champion for the contest. champion_status ( str ) \u2013 (for Tourney Pick'em) The final status of the selected champion for the contest. clinched_playoffs ( int ) \u2013 Numeric boolean (0 or 1) representing if the team has clinched a playoff berth. division_id ( int ) \u2013 The unique ID number of the division containing the team (if applicable). done_week ( str ) \u2013 (might be for Tourney Pick'em or Survival Football) ATTRIBUTE MEANING UNKNOWN. draft_grade ( str ) \u2013 The letter grade assigned to the draft completed by the team (\"A+\", \"A\", ..., \"F-\"). draft_position ( int ) \u2013 The draft order/position of the team. draft_recap_url ( str ) \u2013 The direct URL of the draft recap for the team. draft_results ( list [ DraftResult ] ) \u2013 A list of YFPY DraftResult instances. elimination_week ( int ) \u2013 (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 ) \u2013 (for Tourney Pick'em) The email address of the user competing in the contest. faab_balance ( int ) \u2013 The available balance of FAAB (Free Agent Acquisition Budget) (if applicable). has_draft_grade ( int ) \u2013 Numeric boolean (0 or 1) representing if the team has a draft grade available. is_in_contest ( int ) \u2013 (for Survival Football) Numeric boolean (0 or 1) representing if the user is in a contest. is_owned_by_current_login ( int ) \u2013 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 ) \u2013 (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 ) \u2013 Value designating the type of scoring used by the league (\"head\" for head-to-head, etc.). logo_type ( str ) \u2013 (for Tourney Pick'em) The team logo type (\"avatar\", etc.) of the user competing in the contest. manager ( Manager ) \u2013 (for Survival Football) A YFPY Manager instance for the user competing in the contest. managers ( list [ Manager ] | dict [ str , Manager ] ) \u2013 A list or dict (depending on source data) of YFPY Manager instances. matchups ( list [ Matchup ] ) \u2013 A list of YFPY Matchup instances. name ( str ) \u2013 The team name. number_of_moves ( int ) \u2013 The number of moves made by the team (adds/drops/trades/etc.). number_of_trades ( int ) \u2013 The number of trades made by the team. roster ( Roster ) \u2013 A YFPY Roster instance. players ( list [ Player ] ) \u2013 A list of YFPY Player instances. roster_adds ( RosterAdds ) \u2013 A YFPY RosterAdds instance. roster_adds_value ( int ) \u2013 The number of roster adds made by the team. team_id ( int ) \u2013 The unique team ID in the league. team_key ( str ) \u2013 The Yahoo team key. team_logo ( str ) \u2013 (for Tourney Pick'em) The direct URL to the team logo of the user competing in the contest. team_logos ( list [ TeamLogo ] ) \u2013 A list of YFPY TeamLogo instances. team_paid ( int ) \u2013 Numeric boolean (0 or 1) representing if the team has paid for Yahoo Fantasy Plus. team_points ( TeamPoints ) \u2013 A YFPY TeamPoints instance. points ( float ) \u2013 The total points scored by the team. team_projected_points ( TeamProjectedPoints ) \u2013 A YFPY TeamProjectedPoints instance. projected_points ( float ) \u2013 The total projected points for the team. team_standings ( TeamStandings ) \u2013 A YFPY TeamStandings instance. wins ( int ) \u2013 The number of wins by the team. losses ( int ) \u2013 The number of losses by the team. ties ( int ) \u2013 The number of ties by the team. percentage ( float ) \u2013 The win percentage of the team. playoff_seed ( int ) \u2013 The playoff seed of the team. points_against ( float ) \u2013 The total team points against. points_for ( float ) \u2013 The total team points for. rank ( int ) \u2013 The rank of the team in the league standings. status ( str ) \u2013 (for Survival Football) The status of user competing in the contest (\"dead\", etc.). streak_type ( str ) \u2013 The active team win/loss/tie streak. streak_length ( int ) \u2013 The length of the streak. total_strikes ( int ) \u2013 (for Survival Football) The total number of strikes (incorrect selections) made by the user competing in the contest. url ( str ) \u2013 The direct URL to the team. user_display_name ( str ) \u2013 (for Tourney Pick'em) The display name for the user competing in the contest. user_profile_image ( str ) \u2013 (for Tourney Pick'em) The direct URL to the profile image of the user competing in the contest. waiver_priority ( int ) \u2013 The waiver priority of the team. win_probability ( float ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the DraftResult child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: cost ( int ) \u2013 The player cost (for auction drafts). pick ( int ) \u2013 The draft pick number. round ( int ) \u2013 The draft round. team_key ( str ) \u2013 The Yahoo team key of the team that made the draft pick. player_key ( str ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the Standings child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: teams ( list [ Team ] ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the Transaction child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: players ( list [ Player ] ) \u2013 A list of YFPY Player instances. status ( str ) \u2013 The transaction status (\"successful\", etc.). timestamp ( int ) \u2013 The timestamp of when the transaction occurred. tradee_team_key ( str ) \u2013 The Yahoo team key for the team receiving the player (if applicable). tradee_team_name ( str ) \u2013 The team name of the team receiving the player (if applicable). trader_team_key ( str ) \u2013 The Yahoo team key for the team sending the player (if applicable). trader_team_name ( str ) \u2013 The team name for the team sending the player (if applicable). transaction_id ( int ) \u2013 The unique transaction ID number. transaction_key ( str ) \u2013 The Yahoo transaction key (Ex.: \"406.l.413954.tr.555\"). type ( str ) \u2013 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 \u00b6 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 .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. \"\"\" 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__ \u00b6 __init__ ( extracted_data ) Instantiate the Pick child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: destination_team_key ( str ) \u2013 Team key in the format .l. .t. of the team receiving the pick in the transaction. destination_team_name ( str ) \u2013 Team name of the team receiving the pick in the transaction. original_team_key ( str ) \u2013 Team key in the format .l. .t. of the team to which the pick in the transaction originally belonged. original_team_name ( str ) \u2013 Team name of the team to which the pick in the transaction originally belonged. round ( int ) \u2013 The draft round of the pick in the transaction. source_team_key ( str ) \u2013 Team key in the format .l. .t. of the team sending the pick in the transaction. source_team_name ( str ) \u2013 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 .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. \"\"\" 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the Manager child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: email ( str ) \u2013 The email address of the manager. emails ( list [ str ] ) \u2013 (for Survival Football) List of email addresses for the manager competing in the contest. fantasy_profile_url ( str ) \u2013 (for Survival Football) The direct URL for the profile of the manager competing in the contest. felo_score ( int ) \u2013 The manager fantasy ELO rating. felo_tier ( str ) \u2013 The manager fantasy ELO level (Bronze, Silver, Gold, Platinum, Diamond). guid ( str ) \u2013 The unique Yahoo GUID of the user account associated with manager. image_url ( str ) \u2013 The direct URL of the manager profile image. is_comanager ( int ) \u2013 Numeric boolean (0 or 1) representing if the manager is a co-manager. is_commissioner ( int ) \u2013 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 ) \u2013 Numeric boolean (0 or 1) representing if the manager is the current user authenticated with the Yahoo Fantasy Sports REST API. manager_id ( int ) \u2013 The unique manager ID in the league. nickname ( str ) \u2013 The display nickname of the manager. profile_image_url ( str ) \u2013 (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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the Roster child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: coverage_type ( str ) \u2013 The timeframe for the selected roster (\"week\", \"date\", \"season\", etc.). week ( int ) \u2013 The week number. is_editable ( int ) \u2013 Numeric boolean (0 or 1) representing if the roster is editable. is_prescoring ( int ) \u2013 Numeric boolean (0 or 1) representing if the roster is in a prescoring state. players ( list [ Player ] ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the RosterAdds child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: coverage_type ( str ) \u2013 The timeframe for the selected roster (\"week\", \"date\", \"season\", etc.). coverage_value ( int ) \u2013 The value of the coverage type (week number, for instance). value ( int ) \u2013 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 ) TeamLogo \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the TeamLogo child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: size ( str ) \u2013 The size of the team logo photo (\"small\", \"large\", etc.) url ( str ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the TeamPoints child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: coverage_type ( str ) \u2013 The timeframe for the selected team points (\"week\", \"date\", \"season\", etc.). season ( int ) \u2013 The season year. total ( float ) \u2013 The total team points for the coverage timeframe. week ( int ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the TeamProjectedPoints child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: coverage_type ( str ) \u2013 The timeframe for the selected team projected points (\"week\", \"date\", \"season\", etc.). total ( float ) \u2013 The total team projected points for the coverage timeframe. week ( int ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the TeamStandings child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: divisional_outcome_totals ( DivisionalOutcomeTotals ) \u2013 A list of YFPY DivisionalOutcomeTotals instances. outcome_totals ( OutcomeTotals ) \u2013 A YFPY OutcomeTotals instance. playoff_seed ( int ) \u2013 The playoff seed position for the team. points_against ( float ) \u2013 The total team points against. points_for ( float ) \u2013 The total team points for. rank ( int ) \u2013 The rank of the team in the league standings. streak ( Streak ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the DivisionOutcomeTotals child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: losses ( int ) \u2013 The number of losses by the team within the division. ties ( int ) \u2013 The number of ties by the team within the division. wins ( int ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the OutcomeTotals child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: losses ( int ) \u2013 The number of losses by the team. percentage ( float ) \u2013 The win percentage of the team. ties ( int ) \u2013 The number of ties by the team. wins ( int ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the Streak child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: type ( str ) \u2013 The streak type (\"W\" for win, \"L\" for loss, \"T\" for tie). value ( int ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the Scoreboard child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: matchups ( list [ Matchup ] ) \u2013 A list of YFPY Matchup instances representing the matchups for the week. week ( int ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the Settings child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: cant_cut_list ( int ) \u2013 Numeric boolean (0 or 1) representing if the league uses the Yahoo \"can't cut list\". divisions ( list [ Division ] ) \u2013 A list of YFPY Division instances for leagues with divisions. draft_pick_time ( int ) \u2013 The number of seconds allowed to make each draft pick. draft_time ( int ) \u2013 A timestamp representing when the draft will start. draft_together ( int ) \u2013 Numeric boolean (0 or 1) representing if the league uses Yahoo Fantasy Draft Together live video chat during online drafts. draft_type ( str ) \u2013 The type of draft (\"live\", \"offline\", etc.) has_multiweek_championship ( int ) \u2013 Numeric boolean (0 or 1) representing if the league has a multi-week championship matchup. has_playoff_consolation_games ( bool ) \u2013 Numeric boolean (0 or 1) representing if the league has a consolation playoff bracket. is_auction_draft ( int ) \u2013 Numeric boolean (0 or 1) representing if the league uses an auction draft. league_premium_features ( List ) \u2013 List of features enables as part of subscription to Yahoo Fantasy Plus or Yahoo Fantasy Commissioner Plus. max_teams ( int ) \u2013 The maximum number of teams allowed in the league. num_playoff_consolation_teams ( int ) \u2013 The number of teams that make the consolation playoff bracket. num_playoff_teams ( int ) \u2013 The number of teams that make the playoffs. persistent_url ( str ) \u2013 Custom URL configured for the league that remains the same every season. pickem_enabled ( int ) \u2013 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 ) \u2013 Value designating what player pool is allowed for the league (\"ALL\", etc.). playoff_start_week ( int ) \u2013 The week number on which the playoffs start. post_draft_players ( str ) \u2013 Value designating what happens to players after the draft (\"W\" for waivers, etc.). roster_positions ( list [ RosterPosition ] ) \u2013 A list of YFPY RosterPosition instances. scoring_type ( str ) \u2013 Value designating what type of scoring the league uses (\"head\" for head-to-head, etc.). sendbird_channel_url ( str ) \u2013 The in-app Sendbird channel ID. stat_categories ( StatCategories ) \u2013 A YFPY StatCategories instance. stat_modifiers ( StatModifiers ) \u2013 A YFPY StatModifiers instance. trade_end_date ( str ) \u2013 A date string representing when trading is no longer allowed (format: \"YYYY-MM-DD\"). trade_ratify_type ( str ) \u2013 Value designating how trades are ratified (\"commish\" for commissioner, etc.). trade_reject_time ( int ) \u2013 The number of days during which a trade can be rejected. uses_faab ( int ) \u2013 Numeric boolean (0 or 1) representing if the league uses FAAB (Free Agent Acquisition Budget). uses_fractional_points ( int ) \u2013 Numeric boolean (0 or 1) representing if the league allows fractional scoring. uses_lock_eliminated_teams ( int ) \u2013 Numeric boolean (0 or 1) representing if the league locks teams eliminated from the playoffs. uses_median_score ( int ) \u2013 (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 ) \u2013 Numeric boolean (0 or 1) representing if the league allows negative scoring. uses_playoffs ( int ) \u2013 Numeric boolean (0 or 1) representing if the league has playoffs. uses_playoff_reseeding ( int ) \u2013 Numeric boolean (0 or 1) representing if the league reseeds the playoffs once the fantasy regular season is complete. waiver_rule ( str ) \u2013 Value designating when players go to waivers (\"gametime\", etc.). waiver_time ( int ) \u2013 The number of days that players remain on waivers. waiver_type ( str ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the Division child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: division_id ( int ) \u2013 The unique division ID number in the league. name ( str ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the RosterPosition child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: abbreviation ( str ) \u2013 The abbreviated position string. count ( int ) \u2013 The number of roster slots available for this position. display_name ( str ) \u2013 The unabbreviated position string. is_bench ( int ) \u2013 Numeric boolean (0 or 1) representing if the roster position is the bench position. is_starting_position ( int ) \u2013 Numeric boolean (0 or 1) representing if the roster position is in the starting lineup and scores points. position ( str ) \u2013 The abbreviated position string. position_type ( str ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the StatCategories child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: groups ( list [ Group ] ) \u2013 A list of YFPY Group instances representing the stat categories groups. stats ( list [ Stat ] ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the Group child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: group_abbr ( str ) \u2013 The abbreviated display name of the stat categories group. group_display_name ( str ) \u2013 The display name of the stat categories group. group_name ( str ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the StatModifiers child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: stats ( list [ Stat ] ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the Stat child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: abbr ( str ) \u2013 The abbreviated display name of the stat. bonuses ( list [ Bonus ] ) \u2013 A list of YFPY Bonus instances available for this stat category. display_name ( str ) \u2013 The display name of the stat. enabled ( int ) \u2013 Numeric boolean (0 or 1) representing if this stat is enabled for league scoring. group ( str ) \u2013 The stat category (\"misc\", \"yds_allow\", \"return\", \"receiving\", \"rushing\", \"passing\", etc.) is_excluded_from_display ( int ) \u2013 Numeric boolean (0 or 1) representing if this stat is not displayed. is_only_display_stat ( int ) \u2013 Numeric boolean (0 or 1) representing if this stat is only for display. name ( str ) \u2013 The full name of the stat. position_type ( str ) \u2013 The player position type eligible for the stat. position_types ( list[PositionType ) \u2013 A list of YFPY PositionType instances. sort_order ( int ) \u2013 Numeric boolean (0 or 1) representing if the stat is sorted highest to lowest (1) or lowest to highest (0). stat_id ( int ) \u2013 The unique stat ID number in the league. stat_position_types ( list [ PositionType ] ) \u2013 A list of YFPY PositionType instances. value ( float ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the StatPositionType child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: is_only_display_stat ( int ) \u2013 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 ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the Bonus child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: points ( float ) \u2013 The points awarded when the bonus is won. target ( int ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the Matchup child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: is_consolation ( int ) \u2013 Numeric boolean (0 or 1) representing if the matchup is in a consolation bracket. is_matchup_recap_available ( int ) \u2013 Numeric boolean (0 or 1) representing if the matchup recap is available. is_playoffs ( int ) \u2013 Numeric boolean (0 or 1) representing if the matchup is in the playoffs bracket. is_tied ( int ) \u2013 Numeric boolean (0 or 1) representing if the matchup result is tied. matchup_grades ( list [ MatchupGrade ] ) \u2013 A list of YFPY MatchupGrade instances. matchup_recap_title ( str ) \u2013 The title of the matchup recap. matchup_recap_url ( str ) \u2013 The direct URL of the matchup recap. status ( str ) \u2013 The status of the matchup (\"postevent\", etc.). teams ( list [ Team ] ) \u2013 A list of YFPY Team instances for teams in the matchup. week ( int ) \u2013 The week number of the matchup. week_end ( str ) \u2013 A date string representing the end of the matchup week (format: \"YYYY-MM-DD\"). week_start ( str ) \u2013 A date string representing the start of the matchup week (format: \"YYYY-MM-DD\"). winner_team_key ( str ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the MatchupGrade child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: grade ( str ) \u2013 The letter grade assigned to the matchup performance (\"A+\", \"A\", ..., \"F-\"). team_key ( str ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the Player child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: bye_weeks ( ByeWeeks ) \u2013 A YFPY ByeWeeks instance. bye ( int ) \u2013 The week number that the player is on bye. display_position ( str ) \u2013 The display string for the player position. draft_analysis ( DraftAnalysis ) \u2013 A YFPY DraftAnalysis instance. average_draft_pick ( float ) \u2013 The average pick at which the player was drafted. average_draft_round ( float ) \u2013 The average round in which the player was drafted. average_draft_cost ( float ) \u2013 The average price paid for the player to be drafted. percent_drafted ( float ) \u2013 The overall percentage the player was drafted. editorial_player_key ( str ) \u2013 The Yahoo player key using the game key. editorial_team_abbr ( str ) \u2013 The abbreviation of the professional team name for which the player plays. editorial_team_full_name ( str ) \u2013 The name of the professional team for which the player plays. editorial_team_key ( str ) \u2013 The Yahoo team key of the professional team for which the player plays using the game key. editorial_team_url ( str ) \u2013 The direct URL of the professional team for which the player plays on Yahoo Sports. eligible_positions ( list [ str ] ) \u2013 A list of positions for which the player is eligible. eligible_positions_to_add ( list [ str ] ) \u2013 A list of positions for which the player can have eligibility added. has_player_notes ( int ) \u2013 Numeric boolean (0 or 1) representing if the player has any notes. has_recent_player_notes ( int ) \u2013 Numeric boolean (0 or 1) representing if the player has any recent notes. headshot ( Headshot ) \u2013 A YFPY Headshot instance. headshot_size ( str ) \u2013 The player headshot photo size (\"small\", \"large\", etc.) headshot_url ( str ) \u2013 The direct URL of the player headshot photo. image_url ( str ) \u2013 The direct URL of the player headshot photo. injury_note ( str ) \u2013 The physical part of the player that is injured if the player has an injury. is_editable ( int ) \u2013 Numeric boolean (0 or 1) representing if the player is editable. is_keeper ( int ) \u2013 Numeric boolean (0 or 1) representing if the player is a keeper. is_undroppable ( int ) \u2013 Numeric boolean (0 or 1) representing if the player is undroppable. name ( Name ) \u2013 A YFPY Name instance. first_name ( str ) \u2013 The first name of the player. last_name ( str ) \u2013 The last name of the player. full_name ( str ) \u2013 The full name of the player. ownership ( Ownership ) \u2013 A YFPY Ownership instance. percent_owned ( PercentOwned ) \u2013 A YFPY PercentOwned instanced. percent_owned_value ( float ) \u2013 The percentage value the player is/was owned in the coverage timeframe. player_id ( int ) \u2013 The unique player ID. player_key ( str ) \u2013 The Yahoo player key. player_notes_last_timestamp ( int ) \u2013 A timestamp of the most recent players notes. player_points ( PlayerPoints ) \u2013 A YFPY PlayerPoints instance. player_points_value ( float ) \u2013 The total points for the player within the coverage timeframe. player_stats ( PlayerStats ) \u2013 A YFPY PlayerStats instance. stats ( list [ Stat ] ) \u2013 A list of YFPY Stat instances. position_type ( str ) \u2013 The position type of the player (\"offense\", \"defense\", etc.). primary_position ( str ) \u2013 The primary position of the player. selected_position ( SelectedPosition ) \u2013 A YFPY SelectedPosition instance. selected_position_value ( str ) \u2013 The selected position of the player. status ( str ) \u2013 The status abbreviation of the player (\"IR\", \"PUP\", \"O\", \"Q\", etc.). status_full ( str ) \u2013 The unabbreviated status of the player (\"Questionable\", etc.). transaction_data ( TransactionData ) \u2013 A YFPY TransactionData instance. uniform_number ( int ) \u2013 The uniform number of the player. url ( str ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the ByeWeeks child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: week ( int ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the DraftAnalysis child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: average_pick ( float ) \u2013 The average pick at which the player was drafted. average_round ( float ) \u2013 The average round in which the player was drafted. average_cost ( float ) \u2013 The average price paid for the player to be drafted. percent_drafted ( float ) \u2013 The overall percentage the player was drafted. preseason_average_cost ( float ) \u2013 The average price paid for the player to be drafted in the preseason. preseason_average_pick ( float ) \u2013 The average pick at which the player was drafted in the preseason. preseason_average_round ( float ) \u2013 The average round in which the player was drafted in the preseason. preseason_percent_drafted ( float ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the Headshot child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: size ( str ) \u2013 The size of the headshot photo (\"small\", \"large\", etc.) url ( str ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the Name child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: ascii_first ( str ) \u2013 The ASCII encoded string of the first name of the player. ascii_last ( str ) \u2013 The ASCII encoded string of the last name of the player. first ( str ) \u2013 The first name of the player. full ( str ) \u2013 The full name of the player. last ( str ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the Ownership child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: display_date ( int ) \u2013 The week number the player went on waivers (when applicable). ownership_type ( str ) \u2013 The current location of the player in the league (\"team\", \"waivers\", etc.). owner_team_key ( str ) \u2013 The Yahoo team key for the team that owns the player. owner_team_name ( str ) \u2013 The team name for the team that owns the player. teams ( list [ Team ] ) \u2013 A list of YFPY Team instances. waiver_date ( str ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the PercentOwned child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: coverage_type ( str ) \u2013 The timeframe for the selected player ownership (\"week\", \"date\", \"season\", etc.). week ( int ) \u2013 The week number (when applicable). value ( int ) \u2013 The percentage value the player is/was owned in the coverage timeframe. delta ( float ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the PlayerAdvancedStats child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: coverage_type ( str ) \u2013 The timeframe for the selected player advanced stats (\"week\", \"date\", \"season\", etc.). season ( int ) \u2013 The season year (when applicable). stats ( list [ Stat ] ) \u2013 A list of advanced YFPY Stat instances for the player. week ( int ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the PlayerPoints child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: coverage_type ( str ) \u2013 The timeframe for the selected player points (\"week\", \"date\", \"season\", etc.). season ( int ) \u2013 The season year (when applicable). total ( float ) \u2013 The total points for the player within the coverage timeframe. week ( int ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the PlayerStats child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: coverage_type ( str ) \u2013 The timeframe for the selected player stats (\"week\", \"date\", \"season\", etc.). date ( str ) \u2013 The YYYY-MM-DD formatted date string (when applicable). season ( int ) \u2013 The season year (when applicable). stats ( list [ Stat ] ) \u2013 A list of YFPY Stat instances for the player. week ( int ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the SelectedPosition child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: coverage_type ( str ) \u2013 The timeframe for the selected position (\"week\", \"date\", \"season\", etc.). date ( str ) \u2013 The YYYY-MM-DD formatted date string (when applicable). is_flex ( int ) \u2013 Numeric boolean (0 or 1) representing if the selected player is in a flex roster slot. position ( str ) \u2013 The selected position of the player. week ( int ) \u2013 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 \u00b6 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__ \u00b6 __init__ ( extracted_data ) Instantiate the TransactionData child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: destination_team_key ( str ) \u2013 The Yahoo team key for the receiving team. destination_team_name ( str ) \u2013 The name of the receiving team. destination_type ( str ) \u2013 The destination of the player (waivers, free agency, another team, etc.). source_team_key ( str ) \u2013 The Yahoo team key of the sending team. source_team_name ( str ) \u2013 The name of the sending team. source_type ( str ) \u2013 The origin of the player (waivers, free agency, another team, etc.). type ( str ) \u2013 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\" , \"\" )","title":"Models"},{"location":"models/#models","text":"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 ) \u2013 Module level logger for usage and debugging.","title":"Models"},{"location":"models/#yfpy.models.YahooFantasyObject","text":"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 )","title":"YahooFantasyObject"},{"location":"models/#yfpy.models.YahooFantasyObject.__init__","text":"__init__ ( extracted_data ) Instantiate a Yahoo Fantasy Object. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: extracted_data ( dict ) \u2013 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 ())","title":"__init__"},{"location":"models/#yfpy.models.YahooFantasyObject.__str__","text":"__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 () } )\"","title":"__str__"},{"location":"models/#yfpy.models.YahooFantasyObject.__repr__","text":"__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 () } )\"","title":"__repr__"},{"location":"models/#yfpy.models.YahooFantasyObject.__getattribute__","text":"__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","title":"__getattribute__"},{"location":"models/#yfpy.models.YahooFantasyObject.subclass_dict","text":"subclass_dict () Derive snake case dictionary keys from custom object type camel case class names. Returns: dict ( Dict ) \u2013 Dictionary with snake case strings of all subclasses of YahooFantasyObject as keys and subclasses as Dict \u2013 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__ ()}","title":"subclass_dict"},{"location":"models/#yfpy.models.YahooFantasyObject.clean_data_dict","text":"clean_data_dict () Recursive method to un-type custom class type objects for serialization. Returns: dict ( Dict ) \u2013 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","title":"clean_data_dict"},{"location":"models/#yfpy.models.YahooFantasyObject.serialized","text":"serialized () Pack up all object content into nested dictionaries for JSON serialization. Returns: dict ( Dict ) \u2013 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","title":"serialized"},{"location":"models/#yfpy.models.YahooFantasyObject.to_json","text":"to_json () Serialize the class object to JSON. Returns: str ( str ) \u2013 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 ())","title":"to_json"},{"location":"models/#yfpy.models.YahooFantasyObject.from_json","text":"from_json ( json_data ) Deserialize JSON to a class object. Returns: object ( object ) \u2013 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 )","title":"from_json"},{"location":"models/#yfpy.models.User","text":"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\" , \"\" )","title":"User"},{"location":"models/#yfpy.models.User.__init__","text":"__init__ ( extracted_data ) Instantiate the User child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: games ( list [ Game ] ) \u2013 The Yahoo Fantasy games in which the user participates/has participated. guid ( str ) \u2013 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\" , \"\" )","title":"__init__"},{"location":"models/#yfpy.models.Game","text":"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\" , \"\" )","title":"Game"},{"location":"models/#yfpy.models.Game.__init__","text":"__init__ ( extracted_data ) Instantiate the Game child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: code ( str ) \u2013 The Yahoo Fantasy game code. contest_group_id ( int ) \u2013 The contest group ID of the Yahoo Fantasy game/contest. current_week ( int ) \u2013 The current (or last if complete) week of the Yahoo Fantasy game/contest. editorial_season ( int ) \u2013 The year in which the Yahoo Fantasy game/contest starts. game_id ( int ) \u2013 The Yahoo Fantasy game ID. game_key ( str ) \u2013 The Yahoo Fantasy game key. game_weeks ( list [ GameWeek ] ) \u2013 A list of YFPY GameWeek instances. has_schedule ( int ) \u2013 Numeric boolean (0 or 1) representing if the Yahoo Fantasy contest has a schedule. is_contest_over ( int ) \u2013 Numeric boolean (0 or 1) representing if the Yahoo Fantasy contest is complete. is_contest_reg_active ( int ) \u2013 Numeric boolean (0 or 1) representing if the Yahoo Fantasy contest is active. is_game_over ( int ) \u2013 Numeric boolean (0 or 1) representing if the Yahoo Fantasy game is complete. is_live_draft_lobby_active ( int ) \u2013 Numeric boolean (0 or 1) representing if the draft lobby is active. is_offseason ( int ) \u2013 Numeric boolean (0 or 1) representing if it is the offseason for the respective sport. is_registration_over ( int ) \u2013 Numeric boolean (0 or 1) representing registration for the fantasy game is over. leagues ( list [ League ] ) \u2013 A list of YFPY League instances. name ( str ) \u2013 The name of the Yahoo Fantasy game. picks_status ( str ) \u2013 The status of the Yahoo Fantasy game/contest picks when applicable. players ( list [ Player ] ) \u2013 A list of YFPY Player instances. position_types ( list [ PositionType ] ) \u2013 A list of YFPY PositionType instances. roster_positions ( list [ RosterPosition ] ) \u2013 A list of YFPY RosterPosition instances. scenario_generator ( int ) \u2013 Numeric boolean (0 or 1) representing if the Yahoo Fantasy game has a scenario generator. season ( int ) \u2013 The Yahoo Fantasy game year. stat_categories ( StatCategories ) \u2013 A YFPY StatCategories instance. teams ( list [ Team ] ) \u2013 A list of YFPY Team instances. type ( str ) \u2013 The type of the Yahoo Fantasy game. url ( str ) \u2013 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\" , \"\" )","title":"__init__"},{"location":"models/#yfpy.models.GameWeek","text":"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 )","title":"GameWeek"},{"location":"models/#yfpy.models.GameWeek.__init__","text":"__init__ ( extracted_data ) Instantiate the GameWeek child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: display_name ( str ) \u2013 The display name of the Yahoo Fantasy game week. end ( str ) \u2013 The end date of the Yahoo Fantasy game week. start ( str ) \u2013 The start date of the Yahoo Fantasy game week. week ( int ) \u2013 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 )","title":"__init__"},{"location":"models/#yfpy.models.PositionType","text":"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\" , \"\" )","title":"PositionType"},{"location":"models/#yfpy.models.PositionType.__init__","text":"__init__ ( extracted_data ) Instantiate the PositionType child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: type ( str ) \u2013 The type of the player position (\"offense\", \"defense\", etc.). display_name ( str ) \u2013 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\" , \"\" )","title":"__init__"},{"location":"models/#yfpy.models.League","text":"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\" , \"\" )","title":"League"},{"location":"models/#yfpy.models.League.__init__","text":"__init__ ( extracted_data ) Instantiate the League child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: allow_add_to_dl_extra_pos ( int ) \u2013 Numeric boolean (0 or 1) representing if the leagues allows adding extra positions to the DL (currently uncertain what this is). current_week ( int ) \u2013 The current week number. draft_results ( list [ DraftResult ] ) \u2013 A list of YFPY DraftResult instances. draft_status ( str ) \u2013 The status of the draft (\"postdraft\", etc.). display_name ( str ) \u2013 The display name of the league. edit_key ( int ) \u2013 The Yahoo edit key for the league. end_date ( str ) \u2013 A date string representing the end date of the league (format: \"YYYY-MM-DD\"). end_week ( int ) \u2013 The number of the last week of the league. entry_fee ( str ) \u2013 The entry fee for Yahoo paid leagues (USD). felo_tier ( str ) \u2013 The league fantasy ELO level (Bronze, Silver, Gold, Platinum, Diamond). game_code ( str ) \u2013 The Yahoo game code (\"nfl\", \"nhl\", \"nba\", \"mlb\"). iris_group_chat_id ( str | null ) \u2013 The unique IRIS group chat ID for the league. is_cash_league ( int ) \u2013 Numeric boolean (0 or 1) representing if the league is a Yahoo paid league. is_finished ( int ) \u2013 Numeric boolean (0 or 1) representing if the league season has completed. is_plus_league ( int ) \u2013 Numeric boolean (0 or 1) representing if the league has paid for Yahoo Fantasy Plus. is_pro_league ( str ) \u2013 Numeric boolean (0 or 1) representing if the league is a Yahoo Pro league. league_id ( str ) \u2013 The unique Yahoo league ID. league_key ( str ) \u2013 The Yahoo league key. league_type ( str ) \u2013 The type of the league (\"private\", \"public\"). league_update_timestamp ( int ) \u2013 A timestamp representing the last time the league was updated. logo_url ( str ) \u2013 The direct URL of the league logo photo. name ( str ) \u2013 The name of the league. num_teams ( str ) \u2013 The number of teams in the league. password ( str | null ) \u2013 The password required to join the league (if applicable). payment_deadline ( str ) \u2013 A date string representing the deadline by which all league dues payments must be made (format: \"YYYY-MM-DD\"). players ( list [ Player ] ) \u2013 A list of YFPY Player instances. renew ( str | null ) \u2013 A string indicating the previous Yahoo game code and previous Yahoo league ID (Ex.: \"371_811308\") (if applicable). renewed ( str | null ) \u2013 A string indicating the next Yahoo game code and next Yahoo league ID (Ex.: \"390_303233\") (if applicable). scoreboard ( Scoreboard ) \u2013 A YFPY Scoreboard instance. matchups ( list [ Matchup ] ) \u2013 A list of YFPY Matchup instances. scoring_type ( str ) \u2013 The scoring type of the league (\"head\" for head-to-head, etc.). season ( int ) \u2013 The season year of the league. settings ( Settings ) \u2013 A YFPY Settings instance. short_invitation_url ( str ) \u2013 The sharable short URL sent by invite allowing players to join the league. standings ( Standings ) \u2013 A YFPY Standings instance. start_date ( str ) \u2013 A date string representing the start date of the league (format: \"YYYY-MM-DD\"). start_week ( int ) \u2013 The number of the first week of the league. teams ( list [ Team ] ) \u2013 A list of YFPY Team instances. teams_ordered_by_standings ( list [ Team ] ) \u2013 A list of YFPY Team instances ordered by their ranks in the league standings. transactions ( list [ Transaction ] ) \u2013 A list of YFPY Transaction instances. url ( str ) \u2013 The direct URL of the league. weekly_deadline ( str | null ) \u2013 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\" , \"\" )","title":"__init__"},{"location":"models/#yfpy.models.Team","text":"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 )","title":"Team"},{"location":"models/#yfpy.models.Team.__init__","text":"__init__ ( extracted_data ) Instantiate the Team child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: can_edit_current_week ( int ) \u2013 (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 ) \u2013 (for Tourney Pick'em) The selected champion for the contest. champion_status ( str ) \u2013 (for Tourney Pick'em) The final status of the selected champion for the contest. clinched_playoffs ( int ) \u2013 Numeric boolean (0 or 1) representing if the team has clinched a playoff berth. division_id ( int ) \u2013 The unique ID number of the division containing the team (if applicable). done_week ( str ) \u2013 (might be for Tourney Pick'em or Survival Football) ATTRIBUTE MEANING UNKNOWN. draft_grade ( str ) \u2013 The letter grade assigned to the draft completed by the team (\"A+\", \"A\", ..., \"F-\"). draft_position ( int ) \u2013 The draft order/position of the team. draft_recap_url ( str ) \u2013 The direct URL of the draft recap for the team. draft_results ( list [ DraftResult ] ) \u2013 A list of YFPY DraftResult instances. elimination_week ( int ) \u2013 (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 ) \u2013 (for Tourney Pick'em) The email address of the user competing in the contest. faab_balance ( int ) \u2013 The available balance of FAAB (Free Agent Acquisition Budget) (if applicable). has_draft_grade ( int ) \u2013 Numeric boolean (0 or 1) representing if the team has a draft grade available. is_in_contest ( int ) \u2013 (for Survival Football) Numeric boolean (0 or 1) representing if the user is in a contest. is_owned_by_current_login ( int ) \u2013 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 ) \u2013 (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 ) \u2013 Value designating the type of scoring used by the league (\"head\" for head-to-head, etc.). logo_type ( str ) \u2013 (for Tourney Pick'em) The team logo type (\"avatar\", etc.) of the user competing in the contest. manager ( Manager ) \u2013 (for Survival Football) A YFPY Manager instance for the user competing in the contest. managers ( list [ Manager ] | dict [ str , Manager ] ) \u2013 A list or dict (depending on source data) of YFPY Manager instances. matchups ( list [ Matchup ] ) \u2013 A list of YFPY Matchup instances. name ( str ) \u2013 The team name. number_of_moves ( int ) \u2013 The number of moves made by the team (adds/drops/trades/etc.). number_of_trades ( int ) \u2013 The number of trades made by the team. roster ( Roster ) \u2013 A YFPY Roster instance. players ( list [ Player ] ) \u2013 A list of YFPY Player instances. roster_adds ( RosterAdds ) \u2013 A YFPY RosterAdds instance. roster_adds_value ( int ) \u2013 The number of roster adds made by the team. team_id ( int ) \u2013 The unique team ID in the league. team_key ( str ) \u2013 The Yahoo team key. team_logo ( str ) \u2013 (for Tourney Pick'em) The direct URL to the team logo of the user competing in the contest. team_logos ( list [ TeamLogo ] ) \u2013 A list of YFPY TeamLogo instances. team_paid ( int ) \u2013 Numeric boolean (0 or 1) representing if the team has paid for Yahoo Fantasy Plus. team_points ( TeamPoints ) \u2013 A YFPY TeamPoints instance. points ( float ) \u2013 The total points scored by the team. team_projected_points ( TeamProjectedPoints ) \u2013 A YFPY TeamProjectedPoints instance. projected_points ( float ) \u2013 The total projected points for the team. team_standings ( TeamStandings ) \u2013 A YFPY TeamStandings instance. wins ( int ) \u2013 The number of wins by the team. losses ( int ) \u2013 The number of losses by the team. ties ( int ) \u2013 The number of ties by the team. percentage ( float ) \u2013 The win percentage of the team. playoff_seed ( int ) \u2013 The playoff seed of the team. points_against ( float ) \u2013 The total team points against. points_for ( float ) \u2013 The total team points for. rank ( int ) \u2013 The rank of the team in the league standings. status ( str ) \u2013 (for Survival Football) The status of user competing in the contest (\"dead\", etc.). streak_type ( str ) \u2013 The active team win/loss/tie streak. streak_length ( int ) \u2013 The length of the streak. total_strikes ( int ) \u2013 (for Survival Football) The total number of strikes (incorrect selections) made by the user competing in the contest. url ( str ) \u2013 The direct URL to the team. user_display_name ( str ) \u2013 (for Tourney Pick'em) The display name for the user competing in the contest. user_profile_image ( str ) \u2013 (for Tourney Pick'em) The direct URL to the profile image of the user competing in the contest. waiver_priority ( int ) \u2013 The waiver priority of the team. win_probability ( float ) \u2013 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 )","title":"__init__"},{"location":"models/#yfpy.models.DraftResult","text":"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\" , \"\" )","title":"DraftResult"},{"location":"models/#yfpy.models.DraftResult.__init__","text":"__init__ ( extracted_data ) Instantiate the DraftResult child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: cost ( int ) \u2013 The player cost (for auction drafts). pick ( int ) \u2013 The draft pick number. round ( int ) \u2013 The draft round. team_key ( str ) \u2013 The Yahoo team key of the team that made the draft pick. player_key ( str ) \u2013 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\" , \"\" )","title":"__init__"},{"location":"models/#yfpy.models.Standings","text":"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\" , [])","title":"Standings"},{"location":"models/#yfpy.models.Standings.__init__","text":"__init__ ( extracted_data ) Instantiate the Standings child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: teams ( list [ Team ] ) \u2013 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\" , [])","title":"__init__"},{"location":"models/#yfpy.models.Transaction","text":"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\" , \"\" )","title":"Transaction"},{"location":"models/#yfpy.models.Transaction.__init__","text":"__init__ ( extracted_data ) Instantiate the Transaction child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: players ( list [ Player ] ) \u2013 A list of YFPY Player instances. status ( str ) \u2013 The transaction status (\"successful\", etc.). timestamp ( int ) \u2013 The timestamp of when the transaction occurred. tradee_team_key ( str ) \u2013 The Yahoo team key for the team receiving the player (if applicable). tradee_team_name ( str ) \u2013 The team name of the team receiving the player (if applicable). trader_team_key ( str ) \u2013 The Yahoo team key for the team sending the player (if applicable). trader_team_name ( str ) \u2013 The team name for the team sending the player (if applicable). transaction_id ( int ) \u2013 The unique transaction ID number. transaction_key ( str ) \u2013 The Yahoo transaction key (Ex.: \"406.l.413954.tr.555\"). type ( str ) \u2013 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\" , \"\" )","title":"__init__"},{"location":"models/#yfpy.models.Pick","text":"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 .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. \"\"\" 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\" , \"\" )","title":"Pick"},{"location":"models/#yfpy.models.Pick.__init__","text":"__init__ ( extracted_data ) Instantiate the Pick child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: destination_team_key ( str ) \u2013 Team key in the format .l. .t. of the team receiving the pick in the transaction. destination_team_name ( str ) \u2013 Team name of the team receiving the pick in the transaction. original_team_key ( str ) \u2013 Team key in the format .l. .t. of the team to which the pick in the transaction originally belonged. original_team_name ( str ) \u2013 Team name of the team to which the pick in the transaction originally belonged. round ( int ) \u2013 The draft round of the pick in the transaction. source_team_key ( str ) \u2013 Team key in the format .l. .t. of the team sending the pick in the transaction. source_team_name ( str ) \u2013 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 .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. \"\"\" 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\" , \"\" )","title":"__init__"},{"location":"models/#yfpy.models.Manager","text":"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\" , \"\" )","title":"Manager"},{"location":"models/#yfpy.models.Manager.__init__","text":"__init__ ( extracted_data ) Instantiate the Manager child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: email ( str ) \u2013 The email address of the manager. emails ( list [ str ] ) \u2013 (for Survival Football) List of email addresses for the manager competing in the contest. fantasy_profile_url ( str ) \u2013 (for Survival Football) The direct URL for the profile of the manager competing in the contest. felo_score ( int ) \u2013 The manager fantasy ELO rating. felo_tier ( str ) \u2013 The manager fantasy ELO level (Bronze, Silver, Gold, Platinum, Diamond). guid ( str ) \u2013 The unique Yahoo GUID of the user account associated with manager. image_url ( str ) \u2013 The direct URL of the manager profile image. is_comanager ( int ) \u2013 Numeric boolean (0 or 1) representing if the manager is a co-manager. is_commissioner ( int ) \u2013 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 ) \u2013 Numeric boolean (0 or 1) representing if the manager is the current user authenticated with the Yahoo Fantasy Sports REST API. manager_id ( int ) \u2013 The unique manager ID in the league. nickname ( str ) \u2013 The display nickname of the manager. profile_image_url ( str ) \u2013 (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\" , \"\" )","title":"__init__"},{"location":"models/#yfpy.models.Roster","text":"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\" , [])","title":"Roster"},{"location":"models/#yfpy.models.Roster.__init__","text":"__init__ ( extracted_data ) Instantiate the Roster child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: coverage_type ( str ) \u2013 The timeframe for the selected roster (\"week\", \"date\", \"season\", etc.). week ( int ) \u2013 The week number. is_editable ( int ) \u2013 Numeric boolean (0 or 1) representing if the roster is editable. is_prescoring ( int ) \u2013 Numeric boolean (0 or 1) representing if the roster is in a prescoring state. players ( list [ Player ] ) \u2013 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\" , [])","title":"__init__"},{"location":"models/#yfpy.models.RosterAdds","text":"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 )","title":"RosterAdds"},{"location":"models/#yfpy.models.RosterAdds.__init__","text":"__init__ ( extracted_data ) Instantiate the RosterAdds child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: coverage_type ( str ) \u2013 The timeframe for the selected roster (\"week\", \"date\", \"season\", etc.). coverage_value ( int ) \u2013 The value of the coverage type (week number, for instance). value ( int ) \u2013 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 )","title":"__init__"},{"location":"models/#yfpy.models.TeamLogo","text":"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\" , \"\" )","title":"TeamLogo"},{"location":"models/#yfpy.models.TeamLogo.__init__","text":"__init__ ( extracted_data ) Instantiate the TeamLogo child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: size ( str ) \u2013 The size of the team logo photo (\"small\", \"large\", etc.) url ( str ) \u2013 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\" , \"\" )","title":"__init__"},{"location":"models/#yfpy.models.TeamPoints","text":"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 )","title":"TeamPoints"},{"location":"models/#yfpy.models.TeamPoints.__init__","text":"__init__ ( extracted_data ) Instantiate the TeamPoints child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: coverage_type ( str ) \u2013 The timeframe for the selected team points (\"week\", \"date\", \"season\", etc.). season ( int ) \u2013 The season year. total ( float ) \u2013 The total team points for the coverage timeframe. week ( int ) \u2013 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 )","title":"__init__"},{"location":"models/#yfpy.models.TeamProjectedPoints","text":"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 )","title":"TeamProjectedPoints"},{"location":"models/#yfpy.models.TeamProjectedPoints.__init__","text":"__init__ ( extracted_data ) Instantiate the TeamProjectedPoints child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: coverage_type ( str ) \u2013 The timeframe for the selected team projected points (\"week\", \"date\", \"season\", etc.). total ( float ) \u2013 The total team projected points for the coverage timeframe. week ( int ) \u2013 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 )","title":"__init__"},{"location":"models/#yfpy.models.TeamStandings","text":"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 ({}))","title":"TeamStandings"},{"location":"models/#yfpy.models.TeamStandings.__init__","text":"__init__ ( extracted_data ) Instantiate the TeamStandings child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: divisional_outcome_totals ( DivisionalOutcomeTotals ) \u2013 A list of YFPY DivisionalOutcomeTotals instances. outcome_totals ( OutcomeTotals ) \u2013 A YFPY OutcomeTotals instance. playoff_seed ( int ) \u2013 The playoff seed position for the team. points_against ( float ) \u2013 The total team points against. points_for ( float ) \u2013 The total team points for. rank ( int ) \u2013 The rank of the team in the league standings. streak ( Streak ) \u2013 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 ({}))","title":"__init__"},{"location":"models/#yfpy.models.DivisionalOutcomeTotals","text":"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 )","title":"DivisionalOutcomeTotals"},{"location":"models/#yfpy.models.DivisionalOutcomeTotals.__init__","text":"__init__ ( extracted_data ) Instantiate the DivisionOutcomeTotals child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: losses ( int ) \u2013 The number of losses by the team within the division. ties ( int ) \u2013 The number of ties by the team within the division. wins ( int ) \u2013 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 )","title":"__init__"},{"location":"models/#yfpy.models.OutcomeTotals","text":"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 )","title":"OutcomeTotals"},{"location":"models/#yfpy.models.OutcomeTotals.__init__","text":"__init__ ( extracted_data ) Instantiate the OutcomeTotals child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: losses ( int ) \u2013 The number of losses by the team. percentage ( float ) \u2013 The win percentage of the team. ties ( int ) \u2013 The number of ties by the team. wins ( int ) \u2013 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 )","title":"__init__"},{"location":"models/#yfpy.models.Streak","text":"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 )","title":"Streak"},{"location":"models/#yfpy.models.Streak.__init__","text":"__init__ ( extracted_data ) Instantiate the Streak child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: type ( str ) \u2013 The streak type (\"W\" for win, \"L\" for loss, \"T\" for tie). value ( int ) \u2013 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 )","title":"__init__"},{"location":"models/#yfpy.models.Scoreboard","text":"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 )","title":"Scoreboard"},{"location":"models/#yfpy.models.Scoreboard.__init__","text":"__init__ ( extracted_data ) Instantiate the Scoreboard child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: matchups ( list [ Matchup ] ) \u2013 A list of YFPY Matchup instances representing the matchups for the week. week ( int ) \u2013 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 )","title":"__init__"},{"location":"models/#yfpy.models.Settings","text":"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\" , \"\" )","title":"Settings"},{"location":"models/#yfpy.models.Settings.__init__","text":"__init__ ( extracted_data ) Instantiate the Settings child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: cant_cut_list ( int ) \u2013 Numeric boolean (0 or 1) representing if the league uses the Yahoo \"can't cut list\". divisions ( list [ Division ] ) \u2013 A list of YFPY Division instances for leagues with divisions. draft_pick_time ( int ) \u2013 The number of seconds allowed to make each draft pick. draft_time ( int ) \u2013 A timestamp representing when the draft will start. draft_together ( int ) \u2013 Numeric boolean (0 or 1) representing if the league uses Yahoo Fantasy Draft Together live video chat during online drafts. draft_type ( str ) \u2013 The type of draft (\"live\", \"offline\", etc.) has_multiweek_championship ( int ) \u2013 Numeric boolean (0 or 1) representing if the league has a multi-week championship matchup. has_playoff_consolation_games ( bool ) \u2013 Numeric boolean (0 or 1) representing if the league has a consolation playoff bracket. is_auction_draft ( int ) \u2013 Numeric boolean (0 or 1) representing if the league uses an auction draft. league_premium_features ( List ) \u2013 List of features enables as part of subscription to Yahoo Fantasy Plus or Yahoo Fantasy Commissioner Plus. max_teams ( int ) \u2013 The maximum number of teams allowed in the league. num_playoff_consolation_teams ( int ) \u2013 The number of teams that make the consolation playoff bracket. num_playoff_teams ( int ) \u2013 The number of teams that make the playoffs. persistent_url ( str ) \u2013 Custom URL configured for the league that remains the same every season. pickem_enabled ( int ) \u2013 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 ) \u2013 Value designating what player pool is allowed for the league (\"ALL\", etc.). playoff_start_week ( int ) \u2013 The week number on which the playoffs start. post_draft_players ( str ) \u2013 Value designating what happens to players after the draft (\"W\" for waivers, etc.). roster_positions ( list [ RosterPosition ] ) \u2013 A list of YFPY RosterPosition instances. scoring_type ( str ) \u2013 Value designating what type of scoring the league uses (\"head\" for head-to-head, etc.). sendbird_channel_url ( str ) \u2013 The in-app Sendbird channel ID. stat_categories ( StatCategories ) \u2013 A YFPY StatCategories instance. stat_modifiers ( StatModifiers ) \u2013 A YFPY StatModifiers instance. trade_end_date ( str ) \u2013 A date string representing when trading is no longer allowed (format: \"YYYY-MM-DD\"). trade_ratify_type ( str ) \u2013 Value designating how trades are ratified (\"commish\" for commissioner, etc.). trade_reject_time ( int ) \u2013 The number of days during which a trade can be rejected. uses_faab ( int ) \u2013 Numeric boolean (0 or 1) representing if the league uses FAAB (Free Agent Acquisition Budget). uses_fractional_points ( int ) \u2013 Numeric boolean (0 or 1) representing if the league allows fractional scoring. uses_lock_eliminated_teams ( int ) \u2013 Numeric boolean (0 or 1) representing if the league locks teams eliminated from the playoffs. uses_median_score ( int ) \u2013 (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 ) \u2013 Numeric boolean (0 or 1) representing if the league allows negative scoring. uses_playoffs ( int ) \u2013 Numeric boolean (0 or 1) representing if the league has playoffs. uses_playoff_reseeding ( int ) \u2013 Numeric boolean (0 or 1) representing if the league reseeds the playoffs once the fantasy regular season is complete. waiver_rule ( str ) \u2013 Value designating when players go to waivers (\"gametime\", etc.). waiver_time ( int ) \u2013 The number of days that players remain on waivers. waiver_type ( str ) \u2013 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\" , \"\" )","title":"__init__"},{"location":"models/#yfpy.models.Division","text":"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\" , \"\" )","title":"Division"},{"location":"models/#yfpy.models.Division.__init__","text":"__init__ ( extracted_data ) Instantiate the Division child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: division_id ( int ) \u2013 The unique division ID number in the league. name ( str ) \u2013 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\" , \"\" )","title":"__init__"},{"location":"models/#yfpy.models.RosterPosition","text":"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\" , \"\" )","title":"RosterPosition"},{"location":"models/#yfpy.models.RosterPosition.__init__","text":"__init__ ( extracted_data ) Instantiate the RosterPosition child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: abbreviation ( str ) \u2013 The abbreviated position string. count ( int ) \u2013 The number of roster slots available for this position. display_name ( str ) \u2013 The unabbreviated position string. is_bench ( int ) \u2013 Numeric boolean (0 or 1) representing if the roster position is the bench position. is_starting_position ( int ) \u2013 Numeric boolean (0 or 1) representing if the roster position is in the starting lineup and scores points. position ( str ) \u2013 The abbreviated position string. position_type ( str ) \u2013 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\" , \"\" )","title":"__init__"},{"location":"models/#yfpy.models.StatCategories","text":"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\" , [])","title":"StatCategories"},{"location":"models/#yfpy.models.StatCategories.__init__","text":"__init__ ( extracted_data ) Instantiate the StatCategories child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: groups ( list [ Group ] ) \u2013 A list of YFPY Group instances representing the stat categories groups. stats ( list [ Stat ] ) \u2013 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\" , [])","title":"__init__"},{"location":"models/#yfpy.models.Group","text":"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\" , \"\" )","title":"Group"},{"location":"models/#yfpy.models.Group.__init__","text":"__init__ ( extracted_data ) Instantiate the Group child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: group_abbr ( str ) \u2013 The abbreviated display name of the stat categories group. group_display_name ( str ) \u2013 The display name of the stat categories group. group_name ( str ) \u2013 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\" , \"\" )","title":"__init__"},{"location":"models/#yfpy.models.StatModifiers","text":"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\" , [])","title":"StatModifiers"},{"location":"models/#yfpy.models.StatModifiers.__init__","text":"__init__ ( extracted_data ) Instantiate the StatModifiers child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: stats ( list [ Stat ] ) \u2013 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\" , [])","title":"__init__"},{"location":"models/#yfpy.models.Stat","text":"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 )","title":"Stat"},{"location":"models/#yfpy.models.Stat.__init__","text":"__init__ ( extracted_data ) Instantiate the Stat child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: abbr ( str ) \u2013 The abbreviated display name of the stat. bonuses ( list [ Bonus ] ) \u2013 A list of YFPY Bonus instances available for this stat category. display_name ( str ) \u2013 The display name of the stat. enabled ( int ) \u2013 Numeric boolean (0 or 1) representing if this stat is enabled for league scoring. group ( str ) \u2013 The stat category (\"misc\", \"yds_allow\", \"return\", \"receiving\", \"rushing\", \"passing\", etc.) is_excluded_from_display ( int ) \u2013 Numeric boolean (0 or 1) representing if this stat is not displayed. is_only_display_stat ( int ) \u2013 Numeric boolean (0 or 1) representing if this stat is only for display. name ( str ) \u2013 The full name of the stat. position_type ( str ) \u2013 The player position type eligible for the stat. position_types ( list[PositionType ) \u2013 A list of YFPY PositionType instances. sort_order ( int ) \u2013 Numeric boolean (0 or 1) representing if the stat is sorted highest to lowest (1) or lowest to highest (0). stat_id ( int ) \u2013 The unique stat ID number in the league. stat_position_types ( list [ PositionType ] ) \u2013 A list of YFPY PositionType instances. value ( float ) \u2013 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 )","title":"__init__"},{"location":"models/#yfpy.models.StatPositionType","text":"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\" , \"\" )","title":"StatPositionType"},{"location":"models/#yfpy.models.StatPositionType.__init__","text":"__init__ ( extracted_data ) Instantiate the StatPositionType child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: is_only_display_stat ( int ) \u2013 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 ) \u2013 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\" , \"\" )","title":"__init__"},{"location":"models/#yfpy.models.Bonus","text":"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 )","title":"Bonus"},{"location":"models/#yfpy.models.Bonus.__init__","text":"__init__ ( extracted_data ) Instantiate the Bonus child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: points ( float ) \u2013 The points awarded when the bonus is won. target ( int ) \u2013 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 )","title":"__init__"},{"location":"models/#yfpy.models.Matchup","text":"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\" , \"\" )","title":"Matchup"},{"location":"models/#yfpy.models.Matchup.__init__","text":"__init__ ( extracted_data ) Instantiate the Matchup child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: is_consolation ( int ) \u2013 Numeric boolean (0 or 1) representing if the matchup is in a consolation bracket. is_matchup_recap_available ( int ) \u2013 Numeric boolean (0 or 1) representing if the matchup recap is available. is_playoffs ( int ) \u2013 Numeric boolean (0 or 1) representing if the matchup is in the playoffs bracket. is_tied ( int ) \u2013 Numeric boolean (0 or 1) representing if the matchup result is tied. matchup_grades ( list [ MatchupGrade ] ) \u2013 A list of YFPY MatchupGrade instances. matchup_recap_title ( str ) \u2013 The title of the matchup recap. matchup_recap_url ( str ) \u2013 The direct URL of the matchup recap. status ( str ) \u2013 The status of the matchup (\"postevent\", etc.). teams ( list [ Team ] ) \u2013 A list of YFPY Team instances for teams in the matchup. week ( int ) \u2013 The week number of the matchup. week_end ( str ) \u2013 A date string representing the end of the matchup week (format: \"YYYY-MM-DD\"). week_start ( str ) \u2013 A date string representing the start of the matchup week (format: \"YYYY-MM-DD\"). winner_team_key ( str ) \u2013 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\" , \"\" )","title":"__init__"},{"location":"models/#yfpy.models.MatchupGrade","text":"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\" , \"\" )","title":"MatchupGrade"},{"location":"models/#yfpy.models.MatchupGrade.__init__","text":"__init__ ( extracted_data ) Instantiate the MatchupGrade child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: grade ( str ) \u2013 The letter grade assigned to the matchup performance (\"A+\", \"A\", ..., \"F-\"). team_key ( str ) \u2013 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\" , \"\" )","title":"__init__"},{"location":"models/#yfpy.models.Player","text":"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\" , \"\" )","title":"Player"},{"location":"models/#yfpy.models.Player.__init__","text":"__init__ ( extracted_data ) Instantiate the Player child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: bye_weeks ( ByeWeeks ) \u2013 A YFPY ByeWeeks instance. bye ( int ) \u2013 The week number that the player is on bye. display_position ( str ) \u2013 The display string for the player position. draft_analysis ( DraftAnalysis ) \u2013 A YFPY DraftAnalysis instance. average_draft_pick ( float ) \u2013 The average pick at which the player was drafted. average_draft_round ( float ) \u2013 The average round in which the player was drafted. average_draft_cost ( float ) \u2013 The average price paid for the player to be drafted. percent_drafted ( float ) \u2013 The overall percentage the player was drafted. editorial_player_key ( str ) \u2013 The Yahoo player key using the game key. editorial_team_abbr ( str ) \u2013 The abbreviation of the professional team name for which the player plays. editorial_team_full_name ( str ) \u2013 The name of the professional team for which the player plays. editorial_team_key ( str ) \u2013 The Yahoo team key of the professional team for which the player plays using the game key. editorial_team_url ( str ) \u2013 The direct URL of the professional team for which the player plays on Yahoo Sports. eligible_positions ( list [ str ] ) \u2013 A list of positions for which the player is eligible. eligible_positions_to_add ( list [ str ] ) \u2013 A list of positions for which the player can have eligibility added. has_player_notes ( int ) \u2013 Numeric boolean (0 or 1) representing if the player has any notes. has_recent_player_notes ( int ) \u2013 Numeric boolean (0 or 1) representing if the player has any recent notes. headshot ( Headshot ) \u2013 A YFPY Headshot instance. headshot_size ( str ) \u2013 The player headshot photo size (\"small\", \"large\", etc.) headshot_url ( str ) \u2013 The direct URL of the player headshot photo. image_url ( str ) \u2013 The direct URL of the player headshot photo. injury_note ( str ) \u2013 The physical part of the player that is injured if the player has an injury. is_editable ( int ) \u2013 Numeric boolean (0 or 1) representing if the player is editable. is_keeper ( int ) \u2013 Numeric boolean (0 or 1) representing if the player is a keeper. is_undroppable ( int ) \u2013 Numeric boolean (0 or 1) representing if the player is undroppable. name ( Name ) \u2013 A YFPY Name instance. first_name ( str ) \u2013 The first name of the player. last_name ( str ) \u2013 The last name of the player. full_name ( str ) \u2013 The full name of the player. ownership ( Ownership ) \u2013 A YFPY Ownership instance. percent_owned ( PercentOwned ) \u2013 A YFPY PercentOwned instanced. percent_owned_value ( float ) \u2013 The percentage value the player is/was owned in the coverage timeframe. player_id ( int ) \u2013 The unique player ID. player_key ( str ) \u2013 The Yahoo player key. player_notes_last_timestamp ( int ) \u2013 A timestamp of the most recent players notes. player_points ( PlayerPoints ) \u2013 A YFPY PlayerPoints instance. player_points_value ( float ) \u2013 The total points for the player within the coverage timeframe. player_stats ( PlayerStats ) \u2013 A YFPY PlayerStats instance. stats ( list [ Stat ] ) \u2013 A list of YFPY Stat instances. position_type ( str ) \u2013 The position type of the player (\"offense\", \"defense\", etc.). primary_position ( str ) \u2013 The primary position of the player. selected_position ( SelectedPosition ) \u2013 A YFPY SelectedPosition instance. selected_position_value ( str ) \u2013 The selected position of the player. status ( str ) \u2013 The status abbreviation of the player (\"IR\", \"PUP\", \"O\", \"Q\", etc.). status_full ( str ) \u2013 The unabbreviated status of the player (\"Questionable\", etc.). transaction_data ( TransactionData ) \u2013 A YFPY TransactionData instance. uniform_number ( int ) \u2013 The uniform number of the player. url ( str ) \u2013 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\" , \"\" )","title":"__init__"},{"location":"models/#yfpy.models.ByeWeeks","text":"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 )","title":"ByeWeeks"},{"location":"models/#yfpy.models.ByeWeeks.__init__","text":"__init__ ( extracted_data ) Instantiate the ByeWeeks child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: week ( int ) \u2013 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 )","title":"__init__"},{"location":"models/#yfpy.models.DraftAnalysis","text":"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 )","title":"DraftAnalysis"},{"location":"models/#yfpy.models.DraftAnalysis.__init__","text":"__init__ ( extracted_data ) Instantiate the DraftAnalysis child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: average_pick ( float ) \u2013 The average pick at which the player was drafted. average_round ( float ) \u2013 The average round in which the player was drafted. average_cost ( float ) \u2013 The average price paid for the player to be drafted. percent_drafted ( float ) \u2013 The overall percentage the player was drafted. preseason_average_cost ( float ) \u2013 The average price paid for the player to be drafted in the preseason. preseason_average_pick ( float ) \u2013 The average pick at which the player was drafted in the preseason. preseason_average_round ( float ) \u2013 The average round in which the player was drafted in the preseason. preseason_percent_drafted ( float ) \u2013 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 )","title":"__init__"},{"location":"models/#yfpy.models.Headshot","text":"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\" , \"\" )","title":"Headshot"},{"location":"models/#yfpy.models.Headshot.__init__","text":"__init__ ( extracted_data ) Instantiate the Headshot child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: size ( str ) \u2013 The size of the headshot photo (\"small\", \"large\", etc.) url ( str ) \u2013 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\" , \"\" )","title":"__init__"},{"location":"models/#yfpy.models.Name","text":"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\" , \"\" )","title":"Name"},{"location":"models/#yfpy.models.Name.__init__","text":"__init__ ( extracted_data ) Instantiate the Name child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: ascii_first ( str ) \u2013 The ASCII encoded string of the first name of the player. ascii_last ( str ) \u2013 The ASCII encoded string of the last name of the player. first ( str ) \u2013 The first name of the player. full ( str ) \u2013 The full name of the player. last ( str ) \u2013 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\" , \"\" )","title":"__init__"},{"location":"models/#yfpy.models.Ownership","text":"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\" , \"\" )","title":"Ownership"},{"location":"models/#yfpy.models.Ownership.__init__","text":"__init__ ( extracted_data ) Instantiate the Ownership child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: display_date ( int ) \u2013 The week number the player went on waivers (when applicable). ownership_type ( str ) \u2013 The current location of the player in the league (\"team\", \"waivers\", etc.). owner_team_key ( str ) \u2013 The Yahoo team key for the team that owns the player. owner_team_name ( str ) \u2013 The team name for the team that owns the player. teams ( list [ Team ] ) \u2013 A list of YFPY Team instances. waiver_date ( str ) \u2013 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\" , \"\" )","title":"__init__"},{"location":"models/#yfpy.models.PercentOwned","text":"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 )","title":"PercentOwned"},{"location":"models/#yfpy.models.PercentOwned.__init__","text":"__init__ ( extracted_data ) Instantiate the PercentOwned child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: coverage_type ( str ) \u2013 The timeframe for the selected player ownership (\"week\", \"date\", \"season\", etc.). week ( int ) \u2013 The week number (when applicable). value ( int ) \u2013 The percentage value the player is/was owned in the coverage timeframe. delta ( float ) \u2013 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 )","title":"__init__"},{"location":"models/#yfpy.models.PlayerAdvancedStats","text":"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 )","title":"PlayerAdvancedStats"},{"location":"models/#yfpy.models.PlayerAdvancedStats.__init__","text":"__init__ ( extracted_data ) Instantiate the PlayerAdvancedStats child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: coverage_type ( str ) \u2013 The timeframe for the selected player advanced stats (\"week\", \"date\", \"season\", etc.). season ( int ) \u2013 The season year (when applicable). stats ( list [ Stat ] ) \u2013 A list of advanced YFPY Stat instances for the player. week ( int ) \u2013 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 )","title":"__init__"},{"location":"models/#yfpy.models.PlayerPoints","text":"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 )","title":"PlayerPoints"},{"location":"models/#yfpy.models.PlayerPoints.__init__","text":"__init__ ( extracted_data ) Instantiate the PlayerPoints child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: coverage_type ( str ) \u2013 The timeframe for the selected player points (\"week\", \"date\", \"season\", etc.). season ( int ) \u2013 The season year (when applicable). total ( float ) \u2013 The total points for the player within the coverage timeframe. week ( int ) \u2013 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 )","title":"__init__"},{"location":"models/#yfpy.models.PlayerStats","text":"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 )","title":"PlayerStats"},{"location":"models/#yfpy.models.PlayerStats.__init__","text":"__init__ ( extracted_data ) Instantiate the PlayerStats child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: coverage_type ( str ) \u2013 The timeframe for the selected player stats (\"week\", \"date\", \"season\", etc.). date ( str ) \u2013 The YYYY-MM-DD formatted date string (when applicable). season ( int ) \u2013 The season year (when applicable). stats ( list [ Stat ] ) \u2013 A list of YFPY Stat instances for the player. week ( int ) \u2013 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 )","title":"__init__"},{"location":"models/#yfpy.models.SelectedPosition","text":"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 )","title":"SelectedPosition"},{"location":"models/#yfpy.models.SelectedPosition.__init__","text":"__init__ ( extracted_data ) Instantiate the SelectedPosition child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: coverage_type ( str ) \u2013 The timeframe for the selected position (\"week\", \"date\", \"season\", etc.). date ( str ) \u2013 The YYYY-MM-DD formatted date string (when applicable). is_flex ( int ) \u2013 Numeric boolean (0 or 1) representing if the selected player is in a flex roster slot. position ( str ) \u2013 The selected position of the player. week ( int ) \u2013 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 )","title":"__init__"},{"location":"models/#yfpy.models.TransactionData","text":"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\" , \"\" )","title":"TransactionData"},{"location":"models/#yfpy.models.TransactionData.__init__","text":"__init__ ( extracted_data ) Instantiate the TransactionData child class of YahooFantasyObject. Parameters: extracted_data ( dict ) \u2013 Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API. Attributes: destination_team_key ( str ) \u2013 The Yahoo team key for the receiving team. destination_team_name ( str ) \u2013 The name of the receiving team. destination_type ( str ) \u2013 The destination of the player (waivers, free agency, another team, etc.). source_team_key ( str ) \u2013 The Yahoo team key of the sending team. source_team_name ( str ) \u2013 The name of the sending team. source_type ( str ) \u2013 The origin of the player (waivers, free agency, another team, etc.). type ( str ) \u2013 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\" , \"\" )","title":"__init__"},{"location":"query/","text":"Query \u00b6 YFPY module for making Yahoo Fantasy Sports REST API queries. This module provides all available Yahoo Fantasy Sports API queries as callable methods on the YahooFantasySportsQuery class. Attributes: logger ( Logger ) \u2013 Module level logger for usage and debugging. YahooFantasySportsQuery \u00b6 Bases: object Yahoo Fantasy Sports REST API query CLASS to retrieve all types of fantasy sports data. Source code in yfpy/query.py 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 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 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 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 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 470 471 472 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 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 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 695 696 697 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 728 729 730 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 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 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 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 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 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 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 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 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 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 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 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 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 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 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 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 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 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 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 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 class YahooFantasySportsQuery ( object ): \"\"\"Yahoo Fantasy Sports REST API query CLASS to retrieve all types of fantasy sports data. \"\"\" YFO = TypeVar ( \"YFO\" , bound = YahooFantasyObject ) runtime_environment_is_docker = os . environ . get ( \"RUNTIME_ENVIRONMENT\" , None ) == \"docker\" def __init__ ( self , league_id : str , game_code : str , game_id : Optional [ int ] = None , yahoo_consumer_key : Optional [ str ] = None , yahoo_consumer_secret : Optional [ str ] = None , yahoo_access_token_json : Optional [ Union [ str , Dict ]] = None , env_var_fallback : bool = True , env_file_location : Optional [ Path ] = None , save_token_data_to_env_file : Optional [ bool ] = False , all_output_as_json_str : bool = False , browser_callback : bool = not runtime_environment_is_docker , retries : int = 3 , backoff : int = 0 , offline : bool = False ): \"\"\"Instantiate a YahooQueryObject for running queries against the Yahoo fantasy REST API. Args: league_id (str): League ID of selected Yahoo Fantasy league. game_code (str): Game code of selected Yahoo Fantasy game corresponding to a specific sport (refers to the current season if used as the value for game_key), where \"nfl\" is for fantasy football, \"nhl\" is for fantasy hockey, \"mlb\" is for fantasy baseball, and \"nba\" is for fantasy basketball. game_id (:obj:`int`, optional): Game ID of selected Yahoo fantasy game corresponding to a specific year, and defaulting to the game ID for the current year. yahoo_consumer_key (:obj:`str`, optional): User defined Yahoo developer app consumer key (must be provided in conjunction with yahoo_consumer_secret). yahoo_consumer_secret (:obj:`str`, optional): User defined Yahoo developer app consumer secret (must be provided in conjunction with yahoo_consumer_key). yahoo_access_token_json (str | dict, optional): User defined JSON (string or dict) containing refreshable access token generated by the yahoo-oauth library to avoid having to reauthenticate on every access to the Yahoo Fantasy Sports API (overrides yahoo_consumer_key/yahoo_consumer_secret and all Yahoo access token environment variables). env_var_fallback (:obj:`bool`, optional): Fall back to values retrieved from environment variables for any missing arguments or access token fields (defaults to True). env_file_location (:obj:`Path`, optional): Path to directory where existing .env file is located or new .env file should be generated when provided in conjunction with save_access_token_data_to_env_file=True (defaults to None). save_token_data_to_env_file (:obj:`bool`, optional): Boolean to save Yahoo access token data to local .env file (must be provided in conjunction with env_file_location) (defaults to False) all_output_as_json_str (:obj:`bool`, optional): Option to automatically convert all query output to JSON strings. browser_callback (:obj:`bool`, optional): Enable or disable (enabled by default) whether the yahoo-oauth library automatically opens a browser window to authenticate (if disabled, it will output the callback URL). retries (:obj:`int`, optional): Number of times to retry a query if it fails (defaults to 3). backoff (:obj:`int`, optional): Multiplier that incrementally increases the wait time before retrying a failed query request. offline (:obj:`bool`, optional): Boolean to run in offline mode (Only works if all needed Yahoo Fantasy data has been previously saved locally using the Data module in data.py). Attributes: _env_var_fallback (bool): Fall back to values retrieved from environment variables for any missing arguments or access token fields. _yahoo_access_token_dict (dict[str, Any]): Dictionary containing refreshable access token data generated by the yahoo-oauth library to avoid having to reauthenticate on every access to the Yahoo Fantasy Sports API. _yahoo_consumer_key (str): User defined Yahoo developer app consumer key. _yahoo_consumer_secret (str): User defined Yahoo developer app consumer secret. _browser_callback (bool): Enable or disable (enabled by default) whether the yahoo-oauth library automatically opens a browser window to authenticate (if disabled, it will output the callback URL). _retries (int): Number of times to retry a query if it fails (defaults to 3). _backoff (int): Multiplier that incrementally increases the wait time before retrying a failed query request. _fantasy_content_data_field (str): The initial JSON field in which all Yahoo Fantasy Sports API responses store the data output of the submitted query. league_id (str): League ID of selected Yahoo Fantasy league. game_code (str): Game code of selected Yahoo Fantasy game corresponding to a specific sport (refers to the current season if used as the value for game_key), where \"nfl\" is for fantasy football, \"nhl\" is for fantasy hockey, \"mlb\" is for fantasy baseball, and \"nba\" is for fantasy basketball. game_id (int): Game ID of selected Yahoo fantasy game corresponding to a specific year, and defaulting to the game ID for the current year. league_key (str): The Yahoo Fantasy Sports league key formatted as .l.. executed_queries (list[dict[str, Any]]): List of completed queries and their responses. all_output_as_json_str (bool): Option to automatically convert all query output to JSON strings. offline (bool): Boolean to run in offline mode (Only works if all needed Yahoo Fantasy data has been previously saved locally using the Data module in data.py). \"\"\" self . _env_var_fallback = env_var_fallback # load provided .env file if it exists to read any additional environment variables stored there if self . _env_var_fallback and env_file_location : env_file_path = env_file_location / \".env\" if env_file_path . is_file (): load_dotenv ( env_file_path ) self . _yahoo_access_token_dict : Dict [ str , Any ] = self . _get_dict_from_access_token_json ( yahoo_access_token_json ) # warn user that providing Yahoo access token JSON or populating a YAHOO_ACCESS_TOKEN_JSON environment variable # will override any values provided in the yahoo_consumer_key and yahoo_consumer_secret parameters if self . _yahoo_access_token_dict and ( yahoo_consumer_key or yahoo_consumer_secret ): logger . warning ( \"Providing a yahoo_access_token_json argument or setting env_var_fallback to True and having a \" \"YAHOO_ACCESS_TOKEN_JSON will override any values provided for yahoo_consumer_key or \" \"yahoo_consumer_secret.\" ) # retrieve the Yahoo consumer key and Yahoo consumer secret from the access token dict and fall back to the # provided parameters if no dict exists self . _yahoo_consumer_key = self . _yahoo_access_token_dict . get ( \"consumer_key\" , yahoo_consumer_key ) self . _yahoo_consumer_secret = self . _yahoo_access_token_dict . get ( \"consumer_secret\" , yahoo_consumer_secret ) # catch when a Yahoo consumer key was not provided if not self . _yahoo_consumer_key : # check for YAHOO_CONSUMER_KEY environment variable value if env_var_fallback is True if self . _env_var_fallback : if yahoo_consumer_key_env_var := os . environ . get ( \"YAHOO_CONSUMER_KEY\" ): self . _yahoo_consumer_key = yahoo_consumer_key_env_var if not self . _yahoo_consumer_key : logger . error ( \"Missing required Yahoo consumer key (no yahoo_consumer_key argument provided to \" \"YahooFantasySportsQuery, no consumer_key value provided in yahoo_access_token_json, or no \" \"YAHOO_CONSUMER_KEY environment variable value found).\" ) sys . exit ( 1 ) # catch when a Yahoo consumer secret was not provided if not self . _yahoo_consumer_secret : # check for YAHOO_CONSUMER_SECRET environment variable value if env_var_fallback is True if self . _env_var_fallback : if yahoo_consumer_secret_env_var := os . environ . get ( \"YAHOO_CONSUMER_SECRET\" ): self . _yahoo_consumer_secret = yahoo_consumer_secret_env_var if not self . _yahoo_consumer_secret : logger . error ( \"Missing required Yahoo consumer secret (no yahoo_consumer_secret argument provided to \" \"YahooFantasySportsQuery, no consumer_secret value provided in yahoo_access_token_json, or no \" \"YAHOO_CONSUMER_SECRET environment variable value found).\" ) sys . exit ( 1 ) # explicitly check for truthy/falsy value self . _browser_callback : bool = True if browser_callback is True else False self . _retries : int = retries self . _backoff : int = backoff self . _fantasy_content_data_field : str = \"fantasy_content\" self . league_id : str = league_id self . game_code : str = ( game_code if game_code in yahoo_fantasy_sports_game_codes else retrieve_game_code_from_user () ) self . game_id : int = game_id self . league_key : str = None self . executed_queries : List [ Dict [ str , Any ]] = [] # explicitly check for truthy/falsy value self . all_output_as_json_str : bool = True if all_output_as_json_str is True else False # explicitly check for truthy/falsy value self . offline : bool = True if offline is True else False if not self . offline : self . _authenticate () if save_token_data_to_env_file : self . save_access_token_data_to_env_file ( env_file_location ) def _get_dict_from_access_token_json ( self , yahoo_access_token_json : Union [ str , Dict ]) -> Dict [ str , Any ]: \"\"\"Creates a dictionary of Yahoo access token fields extracted from provided JSON (or a provided dictionary). Args: yahoo_access_token_json (str | dict): A valid JSON string or Python dictionary containing Yahoo access token fields and values. Returns: dict[str, Any]: A dictionary of key/value pairs containing the required values to authenticate using a Yahoo access token. \"\"\" yahoo_access_token_dict : Dict [ str , Any ] = {} # check if there is no provided token JSON and attempt to retrieve them from the YAHOO_ACCESS_TOKEN_JSON # environment variable if fallback to environment variables is True if not yahoo_access_token_json and self . _env_var_fallback : yahoo_access_token_json = os . environ . get ( \"YAHOO_ACCESS_TOKEN_JSON\" ) if yahoo_access_token_json : # parse Yahoo access token JSON as needed if isinstance ( yahoo_access_token_json , str ): try : yahoo_access_token_dict = json . loads ( yahoo_access_token_json ) except JSONDecodeError as e : logger . error ( f \"Invalid JSON provided in yahoo_access_token_json: \\n { e } \" ) sys . exit ( 1 ) elif isinstance ( yahoo_access_token_json , dict ): yahoo_access_token_dict = yahoo_access_token_json else : logger . error ( f \"Invalid object type provided in yahoo_access_token_json or YAHOO_ACCESS_TOKEN_JSON environment \" f \"variable: { type ( yahoo_access_token_json ) } \" ) sys . exit ( 1 ) # check if any fields required by a Yahoo access token are missing yahoo_access_token_required_fields = { \"access_token\" , \"consumer_key\" , \"consumer_secret\" , \"guid\" , \"refresh_token\" , \"token_time\" , \"token_type\" } if not set ( yahoo_access_token_dict . keys ()) . issuperset ( yahoo_access_token_required_fields ): logger . error ( f \"Missing required fields in yahoo_access_token_json: \" f \" { yahoo_access_token_required_fields . difference ( yahoo_access_token_dict . keys ()) } \" ) sys . exit ( 1 ) return yahoo_access_token_dict def _authenticate ( self ) -> None : \"\"\"Authenticate with the Yahoo Fantasy Sports REST API using OAuth2. Returns: None \"\"\" logger . debug ( \"Authenticating with Yahoo.\" ) # provide Yahoo access token fields if available or search for them in environment variables if env_var_fallback # is True, and then complete OAuth2 3-legged handshake by either refreshing existing OAuth2 refresh token or # requesting account access and returning a verification code to input to the command line prompt self . oauth = OAuth2 ( self . _yahoo_consumer_key , self . _yahoo_consumer_secret , access_token = self . _yahoo_access_token_dict . get ( \"access_token\" , os . environ . get ( \"YAHOO_ACCESS_TOKEN\" , None ) if self . _env_var_fallback else None ), guid = self . _yahoo_access_token_dict . get ( \"guid\" , os . environ . get ( \"YAHOO_GUID\" , None ) if self . _env_var_fallback else None ), refresh_token = self . _yahoo_access_token_dict . get ( \"refresh_token\" , os . environ . get ( \"YAHOO_REFRESH_TOKEN\" , None ) if self . _env_var_fallback else None ), token_time = self . _yahoo_access_token_dict . get ( \"token_time\" , float ( os . environ . get ( \"YAHOO_TOKEN_TIME\" , 0.0 )) if self . _env_var_fallback else 0.0 ), token_type = self . _yahoo_access_token_dict . get ( \"token_type\" , os . environ . get ( \"YAHOO_TOKEN_TYPE\" , None ) if self . _env_var_fallback else None ), browser_callback = self . _browser_callback , store_file = False ) if not self . oauth . token_is_valid (): self . oauth . refresh_access_token () self . _yahoo_access_token_dict . update ( { \"access_token\" : self . oauth . access_token , \"consumer_key\" : self . oauth . consumer_key , \"consumer_secret\" : self . oauth . consumer_secret , \"guid\" : self . oauth . guid , \"refresh_token\" : self . oauth . refresh_token , \"token_time\" : self . oauth . token_time , \"token_type\" : self . oauth . token_type , } ) @staticmethod def _retrieve_env_file_contents ( env_file_path : Path ) -> Dict [ str , str ]: \"\"\"Creates a dictionary of key/value pairs representing each line of a .env file (stores environment variables). Args: env_file_path (Path): The path to the directory where the target .env file is located. Returns: dict[str, str]: A dictionary of key/value pairs representing each line of a .env file. \"\"\" env_file_content = OrderedDict () if env_file_path . is_file (): with open ( env_file_path , \"r\" ) as env_file : for line_num , env_file_line in enumerate ( env_file , start = 1 ): if env_file_line . startswith ( \" \\n \" ): # track blank lines in .env file using their line number env_file_content [ f \"blank_ { line_num } \" ] = \" \\n \" elif env_file_line . startswith ( \"#\" ): # track comments in .env file using their line number env_file_content [ f \"comment_ { line_num } \" ] = env_file_line . strip () else : # extract and normalize environment variables from .env file env_var_name , env_var_value = env_file_line . split ( \"=\" , 1 ) env_file_content [ env_var_name . lower ()] = env_var_value . strip () return env_file_content def save_access_token_data_to_env_file ( self , env_file_location : Path , env_file_name : str = \".env\" , save_json_to_var_only : bool = False ) -> None : \"\"\"Saves the fields and values of a Yahoo access token into a .env file. Args: env_file_location (:obj:`Path`, optional): Path to directory where existing .env file is located or new .env file should be generated. env_file_name (:obj:`str`, optional): The name of the target .env file (defaults to \".env\"). save_json_to_var_only (:obj:`bool`, optional): Boolean to determine whether or not to write a JSON string of Yahoo access token fields to a YAHOO_ACCESS_TOKEN_JSON environment variable in the target .env file instead of writing Yahoo access token fields to separate environment variables in the target .env file. (defaults to False). Returns: None \"\"\" if env_file_location : env_file_path = env_file_location / env_file_name else : logger . warning ( \"Missing argument env_file_location. Yahoo access token will NOT be saved to .env file.\" ) # exit method without saving Yahoo access token data when no env_file_location argument is provided return env_file_content = self . _retrieve_env_file_contents ( env_file_path ) if save_json_to_var_only : # generate a JSON string with escaped double quotes using nested json.dumps() and write it to a # YAHOO_ACCESS_TOKEN_JSON environment variable if save_json_to_var_only is set to True instead of writing # Yahoo access token fields to separate environment variables in target .env file env_file_content [ \"yahoo_access_token_json\" ] = json . dumps ( json . dumps ( self . _yahoo_access_token_dict )) else : # replace values of any matching environment variables in .env file with values from Yahoo access token # fields or add new environment variables to .env file if any fields are missing for k , v in self . _yahoo_access_token_dict . items (): env_file_content [ f \"yahoo_ { k } \" ] = v # write contents to .env file (overwrites contents if file exists or creates a new file if not) with open ( env_file_path , \"w\" ) as env_file : for k , v in env_file_content . items (): if k . startswith ( \"blank\" ): env_file . write ( v ) elif k . startswith ( \"comment\" ): env_file . write ( f \" { v } \\n \" ) else : env_file . write ( f \" { k . upper () } = { v } \\n \" ) def get_response ( self , url : str ) -> Response : \"\"\"Retrieve Yahoo Fantasy Sports data from the REST API. Args: url (str): REST API request URL string. Returns: Response: API response from Yahoo Fantasy Sports API request. \"\"\" logger . debug ( f \"Making request to URL: { url } \" ) response : Response = self . oauth . session . get ( url , params = { \"format\" : \"json\" }) status_code = response . status_code # when you exceed Yahoo's allowed data request limits, they throw a request status code of 999 if status_code == 999 : raise HTTPError ( \"Yahoo data unavailable due to rate limiting. Please try again later.\" ) if status_code == 401 : self . _authenticate () response_json = {} try : response_json = response . json () logger . debug ( f \"Response (JSON): { response_json } \" ) except JSONDecodeError : response . raise_for_status () try : if ( status_code // 100 ) != 2 : # handle if the yahoo query returns an error if response_json . get ( \"error\" ): response_error_msg = response_json . get ( \"error\" ) . get ( \"description\" ) error_msg = f \"Attempt to retrieve data at URL { response . url } failed with error: \" \\ f \" \\\" { response_error_msg } \\\" \" logger . error ( error_msg ) raise YahooFantasySportsDataNotFound ( error_msg , url = response . url ) response . raise_for_status () except HTTPError as e : # retry with incremental back-off if self . _retries > 0 : self . _retries -= 1 self . _backoff += 1 logger . warning ( f \"Request for URL { url } failed with status code { response . status_code } . \" f \"Retrying { self . _retries } more time { 's' if self . _retries > 1 else '' } ...\" ) time . sleep ( 0.3 * self . _backoff ) response = self . get_response ( url ) else : # log error and terminate query if status code is not 200 after 3 retries logger . error ( f \"Request failed with status code: { response . status_code } - { e } \" ) response . raise_for_status () raw_response_data = response_json . get ( self . _fantasy_content_data_field ) # extract data from \"fantasy_content\" field if it exists if raw_response_data : logger . debug ( f \"Data fetched with query URL: { response . url } \" ) logger . debug ( f \"Response (Yahoo fantasy data extracted from: \" f \" \\\" { self . _fantasy_content_data_field } \\\" ): { raw_response_data } \" ) else : error_msg = f \"No data found at URL { response . url } when attempting extraction from field: \" \\ f \" \\\" { self . _fantasy_content_data_field } \\\" \" logger . error ( error_msg ) raise YahooFantasySportsDataNotFound ( error_msg , url = response . url ) return response # noinspection GrazieInspection def query ( self , url : str , data_key_list : Union [ List [ str ], List [ List [ str ]]], data_type_class : Type = None , sort_function : Callable = None ) -> ( Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]]): \"\"\"Base query class to retrieve requested data from the Yahoo fantasy sports REST API. Args: url (str): REST API request URL string. data_key_list (list[str] | list[list[str]]): List of keys used to extract the specific data desired by the given query (supports strings and lists of strings). Supports lists containing only key strings such as [\"game\", \"stat_categories\"], and also supports lists containing key strings followed by lists of key strings such as [\"team\", [\"team_points\", \"team_projected_points\"]]. data_type_class (:obj:`Type`, optional): Highest level data model type (if one exists for the retrieved data). sort_function (Callable of sort function, optional)): Optional lambda function to return sorted query results. Returns: object: Model class instance from yfpy/models.py, dictionary, or list (depending on query), with unpacked and parsed response data. \"\"\" if not self . offline : response = self . get_response ( url ) raw_response_data = response . json () . get ( self . _fantasy_content_data_field ) # print(json.dumps(raw_response_data, indent=2)) # iterate through list of data keys and drill down to final desired data field for i in range ( len ( data_key_list )): if isinstance ( raw_response_data , list ): if isinstance ( data_key_list [ i ], list ): reformatted = reformat_json_list ( raw_response_data ) raw_response_data = [ { data_key_list [ i ][ 0 ]: reformatted [ data_key_list [ i ][ 0 ]]}, { data_key_list [ i ][ 1 ]: reformatted [ data_key_list [ i ][ 1 ]]} ] else : raw_response_data = reformat_json_list ( raw_response_data )[ data_key_list [ i ]] else : if isinstance ( data_key_list [ i ], list ): raw_response_data = [ { data_key_list [ i ][ 0 ]: raw_response_data [ data_key_list [ i ][ 0 ]]}, { data_key_list [ i ][ 1 ]: raw_response_data [ data_key_list [ i ][ 1 ]]} ] else : raw_response_data = raw_response_data . get ( data_key_list [ i ]) if raw_response_data : logger . debug ( f \"Response (Yahoo fantasy data extracted from: { data_key_list } ): { raw_response_data } \" ) else : error_msg = f \"No data found when attempting extraction from fields: { data_key_list } \" logger . error ( error_msg ) raise YahooFantasySportsDataNotFound ( error_msg , payload = data_key_list , url = response . url ) # unpack, parse, and assign data types to all retrieved data content unpacked = unpack_data ( raw_response_data , YahooFantasyObject ) logger . debug ( f \"Unpacked and parsed JSON (Yahoo fantasy data wth parent type: { data_type_class } ): \\n { unpacked } \" ) self . executed_queries . append ({ \"url\" : response . url , \"response_status_code\" : response . status_code , \"response\" : response }) # cast the highest level of data to type corresponding to query (if type exists) query_data = data_type_class ( unpacked ) if data_type_class else unpacked # sort data when applicable if sort_function and not isinstance ( query_data , dict ): query_data = sorted ( query_data , key = sort_function ) # flatten lists of single-key dicts of objects into lists of those objects if isinstance ( query_data , list ): last_data_key = data_key_list [ - 1 ] if last_data_key . endswith ( \"s\" ): query_data = [ el [ last_data_key [: - 1 ]] for el in query_data ] if self . all_output_as_json_str : return jsonify_data ( query_data ) else : return query_data else : logger . error ( \"Cannot run Yahoo query while using offline mode! Please try again with offline=False.\" ) def get_all_yahoo_fantasy_game_keys ( self ) -> List [ Game ]: \"\"\"Retrieve all Yahoo Fantasy Sports game keys by ID (from year of inception to present), sorted by season/year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_all_yahoo_fantasy_game_keys() [ Game({ \"code\": \"nfl\", \"game_id\": \"50\", \"game_key\": \"50\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"1999\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/1999\" }), ..., Game({...}) ] Returns: list[Game]: List of YFPY Game instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/games;game_codes= { self . game_code } \" , [ \"games\" ], sort_function = lambda x : x . get ( \"game\" ) . season ) # noinspection PyUnresolvedReferences def get_game_key_by_season ( self , season : int ) -> str : \"\"\"Retrieve specific game key by season. Args: season (int): User defined season/year for which to retrieve the Yahoo Fantasy Sports game. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_key_by_season(2021) 338 Returns: str: The game key for a Yahoo Fantasy Sports game specified by season. \"\"\" all_output_as_json = False if self . all_output_as_json_str : self . all_output_as_json_str = False all_output_as_json = True game_key = self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/games;game_codes= { self . game_code } ;seasons= { season } \" , [ \"games\" ] ) . get ( \"game\" ) . game_key if all_output_as_json : self . all_output_as_json_str = True return game_key def get_current_game_info ( self ) -> Game : \"\"\"Retrieve game info for current fantasy season. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_current_game_info() Game({ \"code\": \"nfl\", \"game_id\": \"390\", \"game_key\": \"390\", \"game_weeks\": [ { \"game_week\": { \"display_name\": \"1\", \"end\": \"2019-09-09\", \"start\": \"2019-09-05\", \"week\": \"1\" } }, ... ], \"is_game_over\": 0, \"is_live_draft_lobby_active\": 1, \"is_offseason\": 0, \"is_registration_over\": 0, \"name\": \"Football\", \"position_types\": [ { \"position_type\": { \"type\": \"O\", \"display_name\": \"Offense\" } }, ... ], \"roster_positions\": [ { \"roster_position\": { \"position\": \"QB\", \"position_type\": \"O\" } }, ... ], \"season\": \"2019\", \"stat_categories\": { \"stats\": [ { \"stat\": { \"display_name\": \"GP\", \"name\": \"Games Played\", \"sort_order\": \"1\", \"stat_id\": 0 } }, ... }, \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/f1\" }) Returns: Game: YFPY Game instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { self . game_code } ;\" f \"out=metadata,players,game_weeks,stat_categories,position_types,roster_positions\" , [ \"game\" ], Game ) def get_current_game_metadata ( self ) -> Game : \"\"\"Retrieve game metadata for current fantasy season. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_current_game_metadata() Game({ \"code\": \"nfl\", \"game_id\": \"390\", \"game_key\": \"390\", \"is_game_over\": 0, \"is_live_draft_lobby_active\": 1, \"is_offseason\": 0, \"is_registration_over\": 0, \"name\": \"Football\", \"season\": \"2019\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/f1\" }) Returns: Game: YFPY Game instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { self . game_code } /metadata\" , [ \"game\" ], Game ) def get_game_info_by_game_id ( self , game_id : int ) -> Game : \"\"\"Retrieve game info for specific game by ID. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_info_by_game_id(390) Game({ \"code\": \"nfl\", \"game_id\": \"390\", \"game_key\": \"390\", \"game_weeks\": [ { \"game_week\": { \"display_name\": \"1\", \"end\": \"2019-09-09\", \"start\": \"2019-09-05\", \"week\": \"1\" } }, ... ], \"is_game_over\": 0, \"is_live_draft_lobby_active\": 1, \"is_offseason\": 0, \"is_registration_over\": 0, \"name\": \"Football\", \"position_types\": [ { \"position_type\": { \"type\": \"O\", \"display_name\": \"Offense\" } }, ... ], \"roster_positions\": [ { \"roster_position\": { \"position\": \"QB\", \"position_type\": \"O\" } }, ... ], \"season\": \"2019\", \"stat_categories\": { \"stats\": [ { \"stat\": { \"display_name\": \"GP\", \"name\": \"Games Played\", \"sort_order\": \"1\", \"stat_id\": 0 } }, ... }, \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/f1\" }) Returns: Game: YFPY Game instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } ;\" f \"out=metadata,players,game_weeks,stat_categories,position_types,roster_positions\" , [ \"game\" ], Game ) def get_game_metadata_by_game_id ( self , game_id : int ) -> Game : \"\"\"Retrieve game metadata for specific game by ID. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_metadata_by_game_id(331) Game({ \"code\": \"nfl\", \"game_id\": \"331\", \"game_key\": \"331\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"2014\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014\" }) Returns: Game: YFPY Game instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } /metadata\" , [ \"game\" ], Game ) def get_game_weeks_by_game_id ( self , game_id : int ) -> List [ GameWeek ]: \"\"\"Retrieve all valid weeks of a specific game by ID. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_weeks_by_game_id(331) [ GameWeek({ \"display_name\": \"1\", \"end\": \"2014-09-08\", \"start\": \"2014-09-04\", \"week\": \"1\" }), ..., GameWeek({ \"display_name\": \"17\", \"end\": \"2014-12-28\", \"start\": \"2014-12-23\", \"week\": \"17\" }) ] Returns: list[GameWeek]: List of YFPY GameWeek instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } /game_weeks\" , [ \"game\" , \"game_weeks\" ] ) def get_game_stat_categories_by_game_id ( self , game_id : int ) -> StatCategories : \"\"\"Retrieve all valid stat categories of a specific game by ID. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_stat_categories_by_game_id(331) StatCategories({ \"stats\": [ { \"stat\": { \"display_name\": \"GP\", \"name\": \"Games Played\", \"sort_order\": \"1\", \"stat_id\": 0 } }, ..., { \"stat\": { \"display_name\": \"Rush 1st Downs\", \"name\": \"Rushing 1st Downs\", \"sort_order\": \"1\", \"stat_id\": 81 } } ] }) Returns: StatCategories: YFPY StatCategories instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } /stat_categories\" , [ \"game\" , \"stat_categories\" ], StatCategories ) def get_game_position_types_by_game_id ( self , game_id : int ) -> List [ PositionType ]: \"\"\"Retrieve all valid position types for specific game by ID sorted alphabetically by type. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_position_types_by_game_id(331) [ PositionType({ \"type\": \"O\", \"display_name\": \"Offense\" }), ..., PositionType({ \"type\": \"K\", \"display_name\": \"Kickers\" }) ] Returns: list[PositionType]: List of YFPY PositionType instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } /position_types\" , [ \"game\" , \"position_types\" ], sort_function = lambda x : x . get ( \"position_type\" ) . type ) def get_game_roster_positions_by_game_id ( self , game_id : int ) -> List [ RosterPosition ]: \"\"\"Retrieve all valid roster positions for specific game by ID sorted alphabetically by position. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_roster_positions_by_game_id(331) [ {RosterPosition({ \"position\": \"BN\" }), ..., RosterPosition({ \"position\": \"WR\", \"position_type\": \"O\" }) ] Returns: list[RosterPosition]: List of YFPY RosterPosition instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } /roster_positions\" , [ \"game\" , \"roster_positions\" ], sort_function = lambda x : x . get ( \"roster_position\" ) . position ) def get_league_key ( self , season : int = None ) -> str : \"\"\"Retrieve league key for selected league. Args: season (int): User defined season/year for which to retrieve the Yahoo Fantasy Sports league key. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_key(2021) 331.l.729259 Returns: str: League key string for selected league. \"\"\" if not self . league_key : if season : return f \" { self . get_game_key_by_season ( season ) } .l. { self . league_id } \" elif self . game_id : return f \" { self . get_game_metadata_by_game_id ( self . game_id ) . game_key } .l. { self . league_id } \" else : logger . warning ( \"No game id or season/year provided, defaulting to current fantasy season.\" ) return f \" { self . get_current_game_metadata () . game_key } .l. { self . league_id } \" else : return self . league_key def get_current_user ( self ) -> User : \"\"\"Retrieve metadata for current logged-in user. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_current_user() User({ \"guid\": \"USER_GUID_STRING\" }) Returns: User: YFPY User instance. \"\"\" return self . query ( \"https://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/\" , [ \"users\" , \"0\" , \"user\" ], User ) def get_user_games ( self ) -> List [ Game ]: \"\"\"Retrieve game history for current logged-in user sorted by season/year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_user_games() [ Game({ \"code\": \"nfl\", \"game_id\": \"359\", \"game_key\": \"359\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"2016\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2016\" }) ..., Game({...}) ] Returns: list[Game]: List of YFPY Game instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/games;codes= { self . game_code } /\" , [ \"users\" , \"0\" , \"user\" , \"games\" ], sort_function = lambda x : x . get ( \"game\" ) . season ) def get_user_leagues_by_game_key ( self , game_key : Union [ int , str ]) -> List [ League ]: \"\"\"Retrieve league history for current logged-in user for specific game by game IDs/keys sorted by season/year. Args: game_key (int | str): The game_id (int) or game_key (str) for a specific Yahoo Fantasy game. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_user_leagues_by_game_key(331) [ League({ \"allow_add_to_dl_extra_pos\": 0, \"current_week\": \"16\", \"draft_status\": \"postdraft\", \"edit_key\": \"16\", \"end_date\": \"2018-12-24\", \"end_week\": \"16\", \"game_code\": \"nfl\", \"iris_group_chat_id\": \"\", \"is_cash_league\": \"0\", \"is_finished\": 1, \"is_pro_league\": \"0\", \"league_id\": \"169896\", \"league_key\": \"380.l.169896\", \"league_type\": \"private\", \"league_update_timestamp\": \"1546498723\", \"logo_url\": \"\", \"name\": \"League Name\", \"num_teams\": 12, \"password\": null, \"renew\": \"371_52364\", \"renewed\": \"390_78725\", \"scoring_type\": \"head\", \"season\": \"2018\", \"short_invitation_url\": \"\", \"start_date\": \"2018-09-06\", \"start_week\": \"1\", \"url\": \"\", \"weekly_deadline\": null }), ..., League({...}) ] Returns: list[League]: List of YFPY League instances. \"\"\" leagues = self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/games;game_keys= { game_key } /leagues/\" , [ \"users\" , \"0\" , \"user\" , \"games\" , \"0\" , \"game\" , \"leagues\" ], sort_function = lambda x : x . get ( \"league\" ) . season ) return leagues if isinstance ( leagues , list ) else [ leagues . get ( \"league\" )] def get_user_teams ( self ) -> List [ Game ]: \"\"\"Retrieve teams for all leagues for current logged-in user for current game sorted by season/year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_user_teams() [ Game({ \"code\": \"nfl\", \"game_id\": \"359\", \"game_key\": \"359\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"2016\", \"teams\": [ { \"team\": { \"draft_grade\": \"A\", \"draft_position\": 9, \"draft_recap_url\": \"\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": [ { \"manager\": { \"email\": \"\", \"guid\": \"\", \"image_url\": \"\", \"is_comanager\": \"1\", \"manager_id\": \"14\", \"nickname\": \"\" } } ], \"name\": \"Legion\", \"number_of_moves\": \"48\", \"number_of_trades\": \"2\", \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"1\", \"team_key\": \"359.l.5521.t.1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"\" } }, \"url\": \"\", \"waiver_priority\": 11 } } ], \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2016\" }) ..., Game({...}) ] Returns: list[Game]: List of YFPY Game instances with \"teams\" attribute containing list of YFPY Team instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/games;codes= { self . game_code } /teams/\" , [ \"users\" , \"0\" , \"user\" , \"games\" ], sort_function = lambda x : x . get ( \"game\" ) . season ) def get_league_info ( self ) -> League : \"\"\"Retrieve info for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_info() League({ \"allow_add_to_dl_extra_pos\": 0, \"current_week\": \"16\", \"draft_status\": \"postdraft\", \"edit_key\": \"16\", \"end_date\": \"2014-12-22\", \"end_week\": \"16\", \"game_code\": \"nfl\", \"iris_group_chat_id\": null, \"is_cash_league\": \"0\", \"is_finished\": 1, \"is_pro_league\": \"1\", \"league_id\": \"729259\", \"league_key\": \"331.l.729259\", \"league_type\": \"public\", \"league_update_timestamp\": \"1420099793\", \"logo_url\": \"https://s.yimg.com/cv/api/default/20180206/default-league-logo@2x.png\", \"name\": \"Yahoo Public 729259\", \"num_teams\": 10, \"renew\": null, \"renewed\": null, \"scoreboard\": { \"week\": \"16\", \"matchups\": [ ... ] }, \"scoring_type\": \"head\", \"season\": \"2014\", \"settings\": { ... }, \"standings\": { \"teams\": [ ..., ... ], ... }, \"start_date\": \"2014-09-04\", \"start_week\": \"1\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259\", \"weekly_deadline\": null }) Returns: League: YFPY League instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } ;\" f \"out=metadata,settings,standings,scoreboard,teams,players,draftresults,transactions\" , [ \"league\" ], League ) def get_league_metadata ( self ) -> League : \"\"\"Retrieve metadata for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_metadata() League({ \"allow_add_to_dl_extra_pos\": 0, \"current_week\": \"16\", \"draft_status\": \"postdraft\", \"edit_key\": \"16\", \"end_date\": \"2014-12-22\", \"end_week\": \"16\", \"game_code\": \"nfl\", \"iris_group_chat_id\": null, \"is_cash_league\": \"0\", \"is_finished\": 1, \"is_pro_league\": \"1\", \"league_id\": \"729259\", \"league_key\": \"331.l.729259\", \"league_type\": \"public\", \"league_update_timestamp\": \"1420099793\", \"logo_url\": \"https://s.yimg.com/cv/api/default/20180206/default-league-logo@2x.png\", \"name\": \"Yahoo Public 729259\", \"num_teams\": 10, \"renew\": null, \"renewed\": null, \"scoring_type\": \"head\", \"season\": \"2014\", \"start_date\": \"2014-09-04\", \"start_week\": \"1\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259\", \"weekly_deadline\": null }) Returns: League: YFPY League instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /metadata\" , [ \"league\" ], League ) def get_league_settings ( self ) -> Settings : \"\"\"Retrieve settings (rules) for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_settings() Settings({ \"cant_cut_list\": \"yahoo\", \"draft_time\": \"1408410000\", \"draft_type\": \"live\", \"has_multiweek_championship\": 0, \"has_playoff_consolation_games\": true, \"is_auction_draft\": \"0\", \"max_teams\": \"10\", \"num_playoff_consolation_teams\": 4, \"num_playoff_teams\": \"4\", \"pickem_enabled\": \"1\", \"player_pool\": \"ALL\", \"playoff_start_week\": \"15\", \"post_draft_players\": \"W\", \"roster_positions\": [ { \"roster_position\": { \"count\": 1, \"position\": \"QB\", \"position_type\": \"O\" } }, ... ], \"scoring_type\": \"head\", \"stat_categories\": { \"stats\": [ { \"stat\": { \"display_name\": \"Pass Yds\", \"enabled\": \"1\", \"name\": \"Passing Yards\", \"position_type\": \"O\", \"sort_order\": \"1\", \"stat_id\": 4, \"stat_position_types\": { \"stat_position_type\": { \"position_type\": \"O\" } } } }, ... ] }, \"stat_modifiers\": { \"stats\": [ { \"stat\": { \"stat_id\": 4, \"value\": \"0.04\" } }, ... ] }, \"trade_end_date\": \"2014-11-14\", \"trade_ratify_type\": \"yahoo\", \"trade_reject_time\": \"2\", \"uses_faab\": \"0\", \"uses_fractional_points\": \"1\", \"uses_lock_eliminated_teams\": 1, \"uses_negative_points\": \"1\", \"uses_playoff\": \"1\", \"uses_playoff_reseeding\": 0, \"waiver_rule\": \"gametime\", \"waiver_time\": \"2\", \"waiver_type\": \"R\" }) Returns: Settings: YFPY Settings instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /settings\" , [ \"league\" , \"settings\" ], Settings ) def get_league_standings ( self ) -> Standings : \"\"\"Retrieve standings for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_standings() Standings({ \"teams\": [ { \"team\": { \"clinched_playoffs\": 1, \"draft_grade\": \"C+\", \"draft_position\": 7, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/8/draftrecap\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"PMTCFWSK5U5LI4SKWREUR56B5A\", \"manager_id\": \"8\", \"nickname\": \"--hidden--\" } }, \"name\": \"clam dam\", \"number_of_moves\": \"27\", \"number_of_trades\": 0, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"8\", \"team_key\": \"331.l.729259.t.8\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://s.yimg.com/cv/apiv2/default/nfl/nfl_1.png\" } }, \"team_points\": { \"coverage_type\": \"season\", \"season\": \"2014\", \"total\": \"1507.06\" }, \"team_standings\": { \"outcome_totals\": { \"losses\": 2, \"percentage\": 0.857, \"ties\": 0, \"wins\": 12 }, \"playoff_seed\": \"1\", \"points_against\": 1263.78, \"points_for\": 1507.06, \"rank\": 1, \"streak\": { \"type\": \"win\", \"value\": \"2\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/8\", \"waiver_priority\": 10 } }, ... ] }) Returns: Standings: YFPY Standings instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /standings\" , [ \"league\" , \"standings\" ], Standings ) def get_league_teams ( self ) -> List [ Team ]: \"\"\"Retrieve teams for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_teams() [ Team({ \"clinched_playoffs\": 1, \"draft_grade\": \"B\", \"draft_position\": 4, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1/draftrecap\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"BMACD7S5UXV7JIQX4PGGUVQJAU\", \"manager_id\": \"1\", \"nickname\": \"--hidden--\" } }, \"name\": \"Hellacious Hill 12\", \"number_of_moves\": \"71\", \"number_of_trades\": 0, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"1\", \"team_key\": \"331.l.729259.t.1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1441/24935131299_a8242dab70_192sq.jpg?ct=fantasy\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1\", \"waiver_priority\": 9 }), ..., Team({...}) ] Returns: list[Team]: List of YFPY Team instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /teams\" , [ \"league\" , \"teams\" ] ) def get_league_players ( self , player_count_limit : int = None , player_count_start : int = 0 , is_retry : bool = False ) -> List [ Player ]: \"\"\"Retrieve valid players for chosen league. Args: player_count_limit (int): Maximum number of players to retreive. player_count_start (int): Index from which to retrieve all subsequent players. is_retry (bool): Boolean to indicate whether the method is being retried during error handling. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_players(50, 25) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"K\", \"editorial_player_key\": \"nfl.p.3727\", \"editorial_team_abbr\": \"Ind\", \"editorial_team_full_name\": \"Indianapolis Colts\", \"editorial_team_key\": \"nfl.t.11\", \"eligible_positions\": { \"position\": \"K\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/OpHvpCHjl_PQvkeQUgsjsA--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt 3PTQ2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08152019/3727.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Adam\", \"ascii_last\": \"Vinatieri\", \"first\": \"Adam\", \"full\": \"Adam Vinatieri\", \"last\": \"Vinatieri\" }, \"player_id\": \"3727\", \"player_key\": \"331.p.3727\", \"player_notes_last_timestamp\": 1568758320, \"position_type\": \"K\", \"primary_position\": \"K\", \"uniform_number\": \"4\" }), ..., Player({...}) ] Returns: list[Player]: List of YFPY Player instances. \"\"\" league_player_count = player_count_start all_players_retrieved = False league_player_data = [] league_player_retrieval_limit = 25 while not all_players_retrieved : try : league_player_query_data = self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"start= { league_player_count } ;count= { league_player_retrieval_limit if not is_retry else 1 } \" , [ \"league\" , \"players\" ] ) league_players = ( league_player_query_data if isinstance ( league_player_query_data , list ) else [ league_player_query_data ]) league_player_count_from_query = len ( league_players ) if player_count_limit : if ( league_player_count + league_player_count_from_query ) < player_count_limit : league_player_count += league_player_count_from_query league_player_data . extend ( league_players ) else : for ndx in range ( player_count_limit - league_player_count ): league_player_data . append ( league_players [ ndx ]) league_player_count += ( player_count_limit - league_player_count ) all_players_retrieved = True else : league_player_count += league_player_count_from_query league_player_data . extend ( league_players ) except YahooFantasySportsDataNotFound as yfpy_err : if not is_retry : payload = yfpy_err . payload if payload : logger . debug ( \"No more league player data available.\" ) all_players_retrieved = True else : logger . warning ( f \"Error retrieving player batch: \" f \" { league_player_count } - { league_player_count + league_player_retrieval_limit - 1 } . \" f \"Attempting to retrieve individual players from batch.\" ) player_retrieval_successes = [] player_retrieval_failures = [] for i in range ( 25 ): try : player_data = self . get_league_players ( player_count_limit = league_player_count + 1 , player_count_start = league_player_count , is_retry = True ) player_retrieval_successes . extend ( player_data ) except YahooFantasySportsDataNotFound as nested_yfpy_err : player_retrieval_failures . append ( { \"failed_player_retrieval_index\" : league_player_count , \"failed_player_retrieval_url\" : nested_yfpy_err . url , \"failed_player_retrieval_message\" : nested_yfpy_err . message } ) league_player_count += 1 league_player_data . extend ( player_retrieval_successes ) logger . warning ( f \"Players retrieval failures: \\n { prettify_data ( player_retrieval_failures ) } \" ) else : raise yfpy_err logger . debug ( f \"League player count: { league_player_count } \" ) return league_player_data def get_league_draft_results ( self ) -> List [ DraftResult ]: \"\"\"Retrieve draft results for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_draft_results() [ DraftResult({ \"pick\": 1, \"round\": 1, \"team_key\": \"331.l.729259.t.4\", \"player_key\": \"331.p.9317\" }), ..., DraftResult({...}) ] Returns: list[DraftResult]: List of YFPY DraftResult instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /draftresults\" , [ \"league\" , \"draft_results\" ] ) def get_league_transactions ( self ) -> List [ Transaction ]: \"\"\"Retrieve transactions for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_transactions() [ Transaction({ \"players\": [ { \"player\": { \"display_position\": \"RB\", \"editorial_team_abbr\": \"NO\", \"name\": { \"ascii_first\": \"Kerwynn\", \"ascii_last\": \"Williams\", \"first\": \"Kerwynn\", \"full\": \"Kerwynn Williams\", \"last\": \"Williams\" }, \"player_id\": \"26853\", \"player_key\": \"331.p.26853\", \"position_type\": \"O\", \"transaction_data\": { \"destination_team_key\": \"331.l.729259.t.1\", \"destination_team_name\": \"Hellacious Hill 12\", \"destination_type\": \"team\", \"source_type\": \"freeagents\", \"type\": \"add\" } } } ], \"status\": \"successful\", \"timestamp\": \"1419188151\", \"transaction_id\": \"282\", \"transaction_key\": \"331.l.729259.tr.282\", \"type\": \"add/drop\" }), ..., Transaction({...}) ] Returns: list[Transaction]: List of YFPY Transaction instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /transactions\" , [ \"league\" , \"transactions\" ] ) def get_league_scoreboard_by_week ( self , chosen_week : int ) -> Scoreboard : \"\"\"Retrieve scoreboard for chosen league by week. Args: chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_scoreboard_by_week(1) Scoreboard({ \"week\": \"1\", \"matchups\": [ { \"matchup\": { \"is_consolation\": \"0\", \"is_matchup_recap_available\": 1, \"is_playoffs\": \"0\", \"is_tied\": 0, \"matchup_grades\": [ { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.1\" } }, { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.2\" } } ], \"matchup_recap_title\": \"Wax On Wax Off Gets Victory Against Hellacious Hill 12\", \"matchup_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/recap? week=1&mid1=1&mid2=2\", \"status\": \"postevent\", \"teams\": [ { \"team\": { } }, { \"team\": { } } ], \"week\": \"1\", \"week_end\": \"2014-09-08\", \"week_start\": \"2014-09-04\", \"winner_team_key\": \"331.l.729259.t.2\" } }, ... ] }) Returns: Scoreboard: YFPY Scoreboard instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /scoreboard;\" f \"week= { chosen_week } \" , [ \"league\" , \"scoreboard\" ], Scoreboard ) def get_league_matchups_by_week ( self , chosen_week : int ) -> List [ Matchup ]: \"\"\"Retrieve matchups for chosen league by week. Args: chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_matchups_by_week(1) [ Matchup({ \"is_consolation\": \"0\", \"is_matchup_recap_available\": 1, \"is_playoffs\": \"0\", \"is_tied\": 0, \"matchup_grades\": [ { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.1\" } }, { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.2\" } } ], \"matchup_recap_title\": \"Wax On Wax Off Gets Victory Against Hellacious Hill 12\", \"matchup_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/recap? week=1&mid1=1&mid2=2\", \"status\": \"postevent\", \"teams\": [ { \"team\": { } }, { \"team\": { } } ], \"week\": \"1\", \"week_end\": \"2014-09-08\", \"week_start\": \"2014-09-04\", \"winner_team_key\": \"331.l.729259.t.2\" }), ..., Matchup({...}) ] Returns: list[Matchup]: List of YFPY Matchup instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /scoreboard;\" f \"week= { chosen_week } \" , [ \"league\" , \"scoreboard\" , \"0\" , \"matchups\" ] ) def get_team_info ( self , team_id : Union [ str , int ]) -> Team : \"\"\"Retrieve info of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_info(1) Team({ \"clinched_playoffs\": 1, \"draft_grade\": \"B\", \"draft_position\": 4, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1/draftrecap\", \"draft_results\": [ ... ], \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"BMACD7S5UXV7JIQX4PGGUVQJAU\", \"manager_id\": \"1\", \"nickname\": \"--hidden--\" } }, \"matchups\": [ ... ], \"name\": \"Hellacious Hill 12\", \"number_of_moves\": \"71\", \"number_of_trades\": 0, \"roster\": { ... }, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"1\", \"team_key\": \"331.l.729259.t.1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1441/24935131299_a8242dab70_192sq.jpg?ct=fantasy\" } }, \"team_points\": { \"coverage_type\": \"season\", \"season\": \"2014\", \"total\": \"1409.24\" }, \"team_standings\": { \"outcome_totals\": { \"losses\": 5, \"percentage\": 0.643, \"ties\": 0, \"wins\": 9 }, \"playoff_seed\": \"2\", \"points_against\": 1266.6599999999999, \"points_for\": 1409.24, \"rank\": 2, \"streak\": { \"type\": \"win\", \"value\": \"1\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1\", \"waiver_priority\": 9 }) Returns: Team: YFPY Team instance. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } ;\" f \"out=metadata,stats,standings,roster,draftresults,matchups\" , [ \"team\" ], Team ) def get_team_metadata ( self , team_id : Union [ str , int ]) -> Team : \"\"\"Retrieve metadata of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_metadata(1) Team({ \"team_key\": \"331.l.729259.t.1\", \"team_id\": \"1\", \"name\": \"Hellacious Hill 12\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1441/24935131299_a8242dab70_192sq.jpg?ct=fantasy\" } }, \"waiver_priority\": 9, \"number_of_moves\": \"71\", \"number_of_trades\": 0, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"clinched_playoffs\": 1, \"league_scoring_type\": \"head\", \"draft_position\": 4, \"has_draft_grade\": 1, \"draft_grade\": \"B\", \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1/draftrecap\", \"managers\": { \"manager\": { \"guid\": \"BMACD7S5UXV7JIQX4PGGUVQJAU\", \"manager_id\": \"1\", \"nickname\": \"--hidden--\" } } }) Returns: Team: YFPY Team instance. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /metadata\" , [ \"team\" ], Team ) def get_team_stats ( self , team_id : Union [ str , int ]) -> TeamPoints : \"\"\"Retrieve stats of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_stats(1) TeamPoints({ \"coverage_type\": \"season\", \"season\": \"2014\", \"total\": \"1409.24\" }) Returns: TeamPoints: YFPY TeamPoints instance. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /stats\" , [ \"team\" , \"team_points\" ], TeamPoints ) def get_team_stats_by_week ( self , team_id : Union [ str , int ], chosen_week : Union [ int , str ] = \"current\" ) -> Dict [ str , Union [ TeamPoints , TeamProjectedPoints ]]: \"\"\"Retrieve stats of specific team by team_id and by week for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_stats_by_week(1, 1) { \"team_points\": TeamPoints({ \"coverage_type\": \"week\", \"total\": \"95.06\", \"week\": \"1\" }), \"team_projected_points\": TeamProjectedPoints({ \"coverage_type\": \"week\", \"total\": \"78.85\", \"week\": \"1\" }) } Returns: dict[str, TeamPoints | TeamProjectedPoints]: Dictionary containing keys \"team_points\" and \"team_projected_points\" with respective values YFPY TeamPoints and YFPY TeamProjectedPoints instances. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /stats;type=week;week= { chosen_week } \" , [ \"team\" , [ \"team_points\" , \"team_projected_points\" ]] ) def get_team_standings ( self , team_id : Union [ str , int ]) -> TeamStandings : \"\"\"Retrieve standings of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_standings(1) TeamStandings({ \"rank\": 2, \"playoff_seed\": \"2\", \"outcome_totals\": { \"losses\": 5, \"percentage\": 0.643, \"ties\": 0, \"wins\": 9 }, \"streak\": { \"type\": \"win\", \"value\": \"1\" }, \"points_for\": \"1409.24\", \"points_against\": 1266.6599999999999 }) Returns: TeamStandings: YFPY TeamStandings instance. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /standings\" , [ \"team\" , \"team_standings\" ], TeamStandings ) def get_team_roster_by_week ( self , team_id : Union [ str , int ], chosen_week : Union [ int , str ] = \"current\" ) -> Roster : \"\"\"Retrieve roster of specific team by team_id and by week for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_roster_by_week(1, 1) Roster({ \"coverage_type\": \"week\", \"week\": \"1\", \"is_editable\": 0, \"players\": [ { \"player\": { \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt 3PTQ2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"1\" }, \"uniform_number\": \"12\" } }, ... ] }) Returns: Roster: YFPY Roster instance. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /roster;week= { chosen_week } \" , [ \"team\" , \"roster\" ], Roster ) def get_team_roster_player_info_by_week ( self , team_id : Union [ str , int ], chosen_week : Union [ int , str ] = \"current\" ) -> List [ Player ]: \"\"\"Retrieve roster with ALL player info of specific team by team_id and by week for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_roster_player_info_by_week(1, 1) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"draft_analysis\": { \"average_pick\": \"65.9\", \"average_round\": \"7.6\", \"average_cost\": \"5.0\", \"percent_drafted\": \"1.00\" }, \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/ https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"ownership\": { \"ownership_type\": \"team\", \"owner_team_key\": \"331.l.729259.t.1\", \"owner_team_name\": \"Hellacious Hill 12\" }, \"percent_owned\": { \"coverage_type\": \"week\", \"week\": \"17\", \"value\": 99, \"delta\": \"0\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"player_points\": { \"coverage_type\": \"week\", \"week\": \"1\", \"total\": 10.26 }, \"player_stats\": { \"coverage_type\": \"week\", \"week\": \"1\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"249\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"1\" }, \"uniform_number\": \"12\" }), ..., Player({...}) ] Returns: list[Player]: List of YFPY Player instances containing attributes \"draft_analysis\", \"ownership\", \"percent_owned\", and \"player_stats\". \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /roster;week= { chosen_week } /players;\" f \"out=metadata,stats,ownership,percent_owned,draft_analysis\" , [ \"team\" , \"roster\" , \"0\" , \"players\" ] ) def get_team_roster_player_info_by_date ( self , team_id : Union [ str , int ], chosen_date : str = None ) -> List [ Player ]: \"\"\"Retrieve roster with ALL player info of specific team by team_id and by date for chosen league. Note: This applies to MLB, NBA, and NHL leagues, but does NOT apply to NFL leagues. This query will FAIL if you pass it an INVALID date string! Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_date (str): Selected date for which to retrieve data. REQUIRED FORMAT: YYYY-MM-DD (Ex. 2011-05-01) Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nhl\") >>> query.get_team_roster_player_info_by_date(1, \"2011-05-01\") [ Player({ \"display_position\": \"C\", \"draft_analysis\": { \"average_pick\": 33.2, \"average_round\": 3.5, \"average_cost\": 39.2, \"percent_drafted\": 1.0 }, \"editorial_player_key\": \"nhl.p.3981\", \"editorial_team_abbr\": \"Chi\", \"editorial_team_full_name\": \"Chicago Blackhawks\", \"editorial_team_key\": \"nhl.t.4\", \"eligible_positions\": [ \"C\", \"F\" ], \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/tz.KOMoEiBDch6AJAGaUtg--~C/ YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/ https://s.yimg.com/xe/i/us/sp/v/nhl_cutout/players_l/11032021/3981.png\" }, \"is_editable\": 0, \"is_undroppable\": 0, \"name\": { \"ascii_first\": \"Jonathan\", \"ascii_last\": \"Toews\", \"first\": \"Jonathan\", \"full\": \"Jonathan Toews\", \"last\": \"Toews\" }, \"ownership\": { \"ownership_type\": \"team\", \"owner_team_key\": \"303.l.69624.t.2\", \"owner_team_name\": \"The Bateleurs\" }, \"percent_owned\": { \"coverage_type\": \"week\", \"week\": 25, \"value\": 98, \"delta\": -1.0 }, \"player_id\": 3981, \"player_key\": \"303.p.3981\", \"player_notes_last_timestamp\": 1651606838, \"player_stats\": { \"coverage_type\": \"date\", \"stats\": [ { \"stat\": { \"stat_id\": 1, \"value\": 1.0 } }, ... ] }, \"position_type\": \"P\", \"primary_position\": \"C\", \"selected_position\": { \"coverage_type\": \"date\", \"is_flex\": 0, \"position\": \"C\" }, \"uniform_number\": 19 }), ..., Player({...}) ] Returns: list[Player]: List of YFPY Player instances containing attributes \"draft_analysis\", \"ownership\", \"percent_owned\", and \"player_stats\". \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /\" f \"roster { ';date=' + str ( chosen_date ) if chosen_date else '' } /players;\" f \"out=metadata,stats,ownership,percent_owned,draft_analysis\" , [ \"team\" , \"roster\" , \"0\" , \"players\" ] ) def get_team_roster_player_stats ( self , team_id : Union [ str , int ]) -> List [ Player ]: \"\"\"Retrieve roster with ALL player info for the season of specific team by team_id and for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_roster_player_stats(1) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"draft_analysis\": { \"average_pick\": \"65.9\", \"average_round\": \"7.6\", \"average_cost\": \"5.0\", \"percent_drafted\": \"1.00\" }, \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"player_points\": { \"coverage_type\": \"season\", \"total\": 287.06 }, \"player_stats\": { \"coverage_type\": \"season\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"4109\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"16\" }, \"uniform_number\": \"12\" }), ..., Player({...}) ] Returns: list[Player]: List of YFPY Player instances containing attributes \"draft_analysis\", \"ownership\", \"percent_owned\", and \"player_stats\". \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /roster/players/stats;type=season\" , [ \"team\" , \"roster\" , \"0\" , \"players\" ] ) def get_team_roster_player_stats_by_week ( self , team_id : Union [ str , int ], chosen_week : Union [ int , str ] = \"current\" ) -> List [ Player ]: \"\"\"Retrieve roster with player stats of specific team by team_id and by week for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_roster_player_stats_by_week(1, 1) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt 3PTQ2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"player_points\": { \"coverage_type\": \"week\", \"week\": \"1\", \"total\": 10.26 }, \"player_stats\": { \"coverage_type\": \"week\", \"week\": \"1\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"249\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"1\" }, \"uniform_number\": \"12\" }), ..., Player({...}) ] Returns: list[Player]: List of YFPY Player instances containing attribute \"player_stats\". \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /roster;week= { chosen_week } /players/stats\" , [ \"team\" , \"roster\" , \"0\" , \"players\" ] ) def get_team_draft_results ( self , team_id : Union [ str , int ]) -> List [ DraftResult ]: \"\"\"Retrieve draft results of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_draft_results(1) [ DraftResult({ \"pick\": 4, \"round\": 1, \"team_key\": \"331.l.729259.t.1\", \"player_key\": \"331.p.8256\" }), ..., DraftResults({...}) ] Returns: list[DraftResult]: List of YFPY DraftResult instances. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /draftresults\" , [ \"team\" , \"draft_results\" ] ) def get_team_matchups ( self , team_id : Union [ str , int ]) -> List [ Matchup ]: \"\"\"Retrieve matchups of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_matchups(1) [ Matchup({ (see get_league_matchups_by_week docstring for matchup data example) }) ] Returns: list[Matchup]: List of YFPY Matchup instances. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /matchups\" , [ \"team\" , \"matchups\" ] ) def get_player_stats_for_season ( self , player_key : str , limit_to_league_stats : bool = True ) -> Player : \"\"\"Retrieve stats of specific player by player_key for the entire season for chosen league. Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). limit_to_league_stats (bool): Boolean (default: True) to limit the retrieved player stats to those for the selected league. When set to False, query retrieves all player stats for the game (NFL, NHL, NBA, MLB). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_player_stats_for_season(\"331.p.7200\") Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"player_points\": { \"coverage_type\": \"season\", \"total\": 359.14 }, \"player_stats\": { \"coverage_type\": \"season\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"4381\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player: YFPY Player instance. \"\"\" if limit_to_league_stats : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /stats\" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player ) else : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/players;\" f \"player_keys= { player_key } /stats\" , [ \"players\" , \"0\" , \"player\" ], Player ) def get_player_stats_by_week ( self , player_key : str , chosen_week : Union [ int , str ] = \"current\" , limit_to_league_stats : bool = True ) -> Player : \"\"\"Retrieve stats of specific player by player_key and by week for chosen league. Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). chosen_week (int): Selected week for which to retrieve data. limit_to_league_stats (bool): Boolean (default: True) to limit the retrieved player stats to those for the selected league. When set to False, query retrieves all player stats for the game (NFL, NHL, NBA, MLB). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_player_stats_by_week(\"331.p.7200\", 1) Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"player_points\": { \"coverage_type\": \"week\", \"week\": \"1\", \"total\": 10.56 }, \"player_stats\": { \"coverage_type\": \"week\", \"week\": \"1\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"189\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player: YFPY Player instance containing attribute \"player_stats\". \"\"\" if limit_to_league_stats : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /stats;type=week;week= { chosen_week } \" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player ) else : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/players;\" f \"player_keys= { player_key } /stats;type=week;week= { chosen_week } \" , [ \"players\" , \"0\" , \"player\" ], Player ) def get_player_stats_by_date ( self , player_key : str , chosen_date : str = None , limit_to_league_stats : bool = True ) -> Player : \"\"\"Retrieve player stats by player_key and by date for chosen league. Note: This applies to MLB, NBA, and NHL leagues, but does NOT apply to NFL leagues. This query will FAIL if you pass it an INVALID date string! Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). chosen_date (str): Selected date for which to retrieve data. REQUIRED FORMAT: YYYY-MM-DD (Ex. 2011-05-01) limit_to_league_stats (bool): Boolean (default: True) to limit the retrieved player stats to those for the selected league. When set to False, query retrieves all player stats for the game (NFL, NHL, NBA, MLB). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nhl\") >>> query.get_player_stats_by_date(\"nhl.p.4588\", \"2011-05-01\") Player({ \"display_position\": \"G\", \"editorial_player_key\": \"nhl.p.4588\", \"editorial_team_abbr\": \"Was\", \"editorial_team_full_name\": \"Washington Capitals\", \"editorial_team_key\": \"nhl.t.23\", \"eligible_positions\": { \"position\": \"G\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/CzntDh_d59voTqU6fhQy3g--~C/YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2 NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/https://s.yimg.com/ xe/i/us/sp/v/nhl_cutout/players_l/10182019/4588.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Braden\", \"ascii_last\": \"Holtby\", \"first\": \"Braden\", \"full\": \"Braden Holtby\", \"last\": \"Holtby\" }, \"player_id\": \"4588\", \"player_key\": \"303.p.4588\", \"player_notes_last_timestamp\": 1574133600, \"player_stats\": { \"coverage_type\": \"date\", \"stats\": [ { \"stat\": { \"stat_id\": \"19\", \"value\": \"1\" } }, { \"stat\": { \"stat_id\": \"22\", \"value\": \"1\" } }, { \"stat\": { \"stat_id\": \"23\", \"value\": \"1.00\" } }, { \"stat\": { \"stat_id\": \"25\", \"value\": \"29\" } }, { \"stat\": { \"stat_id\": \"24\", \"value\": \"30\" } }, { \"stat\": { \"stat_id\": \"26\", \"value\": \".967\" } }, { \"stat\": { \"stat_id\": \"27\", \"value\": \"0\" } } ] }, \"position_type\": \"G\", \"primary_position\": \"G\", \"uniform_number\": \"70\" }) Returns: Player: YFPY Player instnace containing attribute \"player_stats\". \"\"\" if limit_to_league_stats : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /stats;type=date;date= { chosen_date } \" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player ) else : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/players;\" f \"player_keys= { player_key } /stats;type=date;date= { chosen_date } \" , [ \"players\" , \"0\" , \"player\" ], Player ) def get_player_ownership ( self , player_key : str ) -> Player : \"\"\"Retrieve ownership of specific player by player_key for chosen league. Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_player_ownership(\"331.p.7200\") Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"ownership\": { \"ownership_type\": \"team\", \"owner_team_key\": \"331.l.729259.t.4\", \"owner_team_name\": \"hold my D\", \"teams\": { \"team\": { \"clinched_playoffs\": 1, \"draft_grade\": \"B-\", \"draft_position\": 1, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/4/draftrecap\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"5KLNXUYW5RP22UMRKUXHBCIITI\", \"manager_id\": \"4\", \"nickname\": \"--hidden--\" } }, \"name\": \"hold my D\", \"number_of_moves\": \"27\", \"number_of_trades\": \"1\", \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"4\", \"team_key\": \"331.l.729259.t.4\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1589/24677593583_68859308dd_192sq.jpg?ct=fantasy\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/4\", \"waiver_priority\": 7 } } }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player: YFPY Player instance containing attribute \"ownership\". \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /ownership\" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player ) def get_player_percent_owned_by_week ( self , player_key : str , chosen_week : Union [ int , str ] = \"current\" ) -> Player : \"\"\"Retrieve percent-owned of specific player by player_key and by week for chosen league. Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_player_percent_owned_by_week(\"331.p.7200\", 1) Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/ https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"percent_owned\": { \"coverage_type\": \"week\", \"week\": \"1\", \"value\": 100, \"delta\": \"0\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player: YFPY Player instance containing attribute \"percent_owned\". \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /percent_owned;type=week;week= { chosen_week } \" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player ) def get_player_draft_analysis ( self , player_key : str ) -> Player : \"\"\"Retrieve draft analysis of specific player by player_key for chosen league. Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_player_draft_analysis(\"331.p.7200\") Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"draft_analysis\": { \"average_pick\": \"19.9\", \"average_round\": \"2.8\", \"average_cost\": \"38.5\", \"percent_drafted\": \"1.00\" }, \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player: YFPY Player instance containing attribute \"draft_analysis\". \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /draft_analysis\" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player ) __init__ \u00b6 __init__ ( league_id , game_code , game_id = None , yahoo_consumer_key = None , yahoo_consumer_secret = None , yahoo_access_token_json = None , env_var_fallback = True , env_file_location = None , save_token_data_to_env_file = False , all_output_as_json_str = False , browser_callback = not runtime_environment_is_docker , retries = 3 , backoff = 0 , offline = False , ) Instantiate a YahooQueryObject for running queries against the Yahoo fantasy REST API. Parameters: league_id ( str ) \u2013 League ID of selected Yahoo Fantasy league. game_code ( str ) \u2013 Game code of selected Yahoo Fantasy game corresponding to a specific sport (refers to the current season if used as the value for game_key), where \"nfl\" is for fantasy football, \"nhl\" is for fantasy hockey, \"mlb\" is for fantasy baseball, and \"nba\" is for fantasy basketball. game_id \u2013 obj: int , optional): Game ID of selected Yahoo fantasy game corresponding to a specific year, and defaulting to the game ID for the current year. yahoo_consumer_key \u2013 obj: str , optional): User defined Yahoo developer app consumer key (must be provided in conjunction with yahoo_consumer_secret). yahoo_consumer_secret \u2013 obj: str , optional): User defined Yahoo developer app consumer secret (must be provided in conjunction with yahoo_consumer_key). yahoo_access_token_json ( str | dict , default: None ) \u2013 User defined JSON (string or dict) containing refreshable access token generated by the yahoo-oauth library to avoid having to reauthenticate on every access to the Yahoo Fantasy Sports API (overrides yahoo_consumer_key/yahoo_consumer_secret and all Yahoo access token environment variables). env_var_fallback \u2013 obj: bool , optional): Fall back to values retrieved from environment variables for any missing arguments or access token fields (defaults to True). env_file_location \u2013 obj: Path , optional): Path to directory where existing .env file is located or new .env file should be generated when provided in conjunction with save_access_token_data_to_env_file=True (defaults to None). save_token_data_to_env_file \u2013 obj: bool , optional): Boolean to save Yahoo access token data to local .env file (must be provided in conjunction with env_file_location) (defaults to False) all_output_as_json_str \u2013 obj: bool , optional): Option to automatically convert all query output to JSON strings. browser_callback \u2013 obj: bool , optional): Enable or disable (enabled by default) whether the yahoo-oauth library automatically opens a browser window to authenticate (if disabled, it will output the callback URL). retries \u2013 obj: int , optional): Number of times to retry a query if it fails (defaults to 3). backoff \u2013 obj: int , optional): Multiplier that incrementally increases the wait time before retrying a failed query request. offline \u2013 obj: bool , optional): Boolean to run in offline mode (Only works if all needed Yahoo Fantasy data has been previously saved locally using the Data module in data.py). Attributes: _env_var_fallback ( bool ) \u2013 Fall back to values retrieved from environment variables for any missing arguments or access token fields. _yahoo_access_token_dict ( dict [ str , Any ] ) \u2013 Dictionary containing refreshable access token data generated by the yahoo-oauth library to avoid having to reauthenticate on every access to the Yahoo Fantasy Sports API. _yahoo_consumer_key ( str ) \u2013 User defined Yahoo developer app consumer key. _yahoo_consumer_secret ( str ) \u2013 User defined Yahoo developer app consumer secret. _browser_callback ( bool ) \u2013 Enable or disable (enabled by default) whether the yahoo-oauth library automatically opens a browser window to authenticate (if disabled, it will output the callback URL). _retries ( int ) \u2013 Number of times to retry a query if it fails (defaults to 3). _backoff ( int ) \u2013 Multiplier that incrementally increases the wait time before retrying a failed query request. _fantasy_content_data_field ( str ) \u2013 The initial JSON field in which all Yahoo Fantasy Sports API responses store the data output of the submitted query. league_id ( str ) \u2013 League ID of selected Yahoo Fantasy league. game_code ( str ) \u2013 Game code of selected Yahoo Fantasy game corresponding to a specific sport (refers to the current season if used as the value for game_key), where \"nfl\" is for fantasy football, \"nhl\" is for fantasy hockey, \"mlb\" is for fantasy baseball, and \"nba\" is for fantasy basketball. game_id ( int ) \u2013 Game ID of selected Yahoo fantasy game corresponding to a specific year, and defaulting to the game ID for the current year. league_key ( str ) \u2013 The Yahoo Fantasy Sports league key formatted as .l. . executed_queries ( list [ dict [ str , Any ]] ) \u2013 List of completed queries and their responses. all_output_as_json_str ( bool ) \u2013 Option to automatically convert all query output to JSON strings. offline ( bool ) \u2013 Boolean to run in offline mode (Only works if all needed Yahoo Fantasy data has been previously saved locally using the Data module in data.py). Source code in yfpy/query.py 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 227 228 229 230 231 232 233 234 def __init__ ( self , league_id : str , game_code : str , game_id : Optional [ int ] = None , yahoo_consumer_key : Optional [ str ] = None , yahoo_consumer_secret : Optional [ str ] = None , yahoo_access_token_json : Optional [ Union [ str , Dict ]] = None , env_var_fallback : bool = True , env_file_location : Optional [ Path ] = None , save_token_data_to_env_file : Optional [ bool ] = False , all_output_as_json_str : bool = False , browser_callback : bool = not runtime_environment_is_docker , retries : int = 3 , backoff : int = 0 , offline : bool = False ): \"\"\"Instantiate a YahooQueryObject for running queries against the Yahoo fantasy REST API. Args: league_id (str): League ID of selected Yahoo Fantasy league. game_code (str): Game code of selected Yahoo Fantasy game corresponding to a specific sport (refers to the current season if used as the value for game_key), where \"nfl\" is for fantasy football, \"nhl\" is for fantasy hockey, \"mlb\" is for fantasy baseball, and \"nba\" is for fantasy basketball. game_id (:obj:`int`, optional): Game ID of selected Yahoo fantasy game corresponding to a specific year, and defaulting to the game ID for the current year. yahoo_consumer_key (:obj:`str`, optional): User defined Yahoo developer app consumer key (must be provided in conjunction with yahoo_consumer_secret). yahoo_consumer_secret (:obj:`str`, optional): User defined Yahoo developer app consumer secret (must be provided in conjunction with yahoo_consumer_key). yahoo_access_token_json (str | dict, optional): User defined JSON (string or dict) containing refreshable access token generated by the yahoo-oauth library to avoid having to reauthenticate on every access to the Yahoo Fantasy Sports API (overrides yahoo_consumer_key/yahoo_consumer_secret and all Yahoo access token environment variables). env_var_fallback (:obj:`bool`, optional): Fall back to values retrieved from environment variables for any missing arguments or access token fields (defaults to True). env_file_location (:obj:`Path`, optional): Path to directory where existing .env file is located or new .env file should be generated when provided in conjunction with save_access_token_data_to_env_file=True (defaults to None). save_token_data_to_env_file (:obj:`bool`, optional): Boolean to save Yahoo access token data to local .env file (must be provided in conjunction with env_file_location) (defaults to False) all_output_as_json_str (:obj:`bool`, optional): Option to automatically convert all query output to JSON strings. browser_callback (:obj:`bool`, optional): Enable or disable (enabled by default) whether the yahoo-oauth library automatically opens a browser window to authenticate (if disabled, it will output the callback URL). retries (:obj:`int`, optional): Number of times to retry a query if it fails (defaults to 3). backoff (:obj:`int`, optional): Multiplier that incrementally increases the wait time before retrying a failed query request. offline (:obj:`bool`, optional): Boolean to run in offline mode (Only works if all needed Yahoo Fantasy data has been previously saved locally using the Data module in data.py). Attributes: _env_var_fallback (bool): Fall back to values retrieved from environment variables for any missing arguments or access token fields. _yahoo_access_token_dict (dict[str, Any]): Dictionary containing refreshable access token data generated by the yahoo-oauth library to avoid having to reauthenticate on every access to the Yahoo Fantasy Sports API. _yahoo_consumer_key (str): User defined Yahoo developer app consumer key. _yahoo_consumer_secret (str): User defined Yahoo developer app consumer secret. _browser_callback (bool): Enable or disable (enabled by default) whether the yahoo-oauth library automatically opens a browser window to authenticate (if disabled, it will output the callback URL). _retries (int): Number of times to retry a query if it fails (defaults to 3). _backoff (int): Multiplier that incrementally increases the wait time before retrying a failed query request. _fantasy_content_data_field (str): The initial JSON field in which all Yahoo Fantasy Sports API responses store the data output of the submitted query. league_id (str): League ID of selected Yahoo Fantasy league. game_code (str): Game code of selected Yahoo Fantasy game corresponding to a specific sport (refers to the current season if used as the value for game_key), where \"nfl\" is for fantasy football, \"nhl\" is for fantasy hockey, \"mlb\" is for fantasy baseball, and \"nba\" is for fantasy basketball. game_id (int): Game ID of selected Yahoo fantasy game corresponding to a specific year, and defaulting to the game ID for the current year. league_key (str): The Yahoo Fantasy Sports league key formatted as .l.. executed_queries (list[dict[str, Any]]): List of completed queries and their responses. all_output_as_json_str (bool): Option to automatically convert all query output to JSON strings. offline (bool): Boolean to run in offline mode (Only works if all needed Yahoo Fantasy data has been previously saved locally using the Data module in data.py). \"\"\" self . _env_var_fallback = env_var_fallback # load provided .env file if it exists to read any additional environment variables stored there if self . _env_var_fallback and env_file_location : env_file_path = env_file_location / \".env\" if env_file_path . is_file (): load_dotenv ( env_file_path ) self . _yahoo_access_token_dict : Dict [ str , Any ] = self . _get_dict_from_access_token_json ( yahoo_access_token_json ) # warn user that providing Yahoo access token JSON or populating a YAHOO_ACCESS_TOKEN_JSON environment variable # will override any values provided in the yahoo_consumer_key and yahoo_consumer_secret parameters if self . _yahoo_access_token_dict and ( yahoo_consumer_key or yahoo_consumer_secret ): logger . warning ( \"Providing a yahoo_access_token_json argument or setting env_var_fallback to True and having a \" \"YAHOO_ACCESS_TOKEN_JSON will override any values provided for yahoo_consumer_key or \" \"yahoo_consumer_secret.\" ) # retrieve the Yahoo consumer key and Yahoo consumer secret from the access token dict and fall back to the # provided parameters if no dict exists self . _yahoo_consumer_key = self . _yahoo_access_token_dict . get ( \"consumer_key\" , yahoo_consumer_key ) self . _yahoo_consumer_secret = self . _yahoo_access_token_dict . get ( \"consumer_secret\" , yahoo_consumer_secret ) # catch when a Yahoo consumer key was not provided if not self . _yahoo_consumer_key : # check for YAHOO_CONSUMER_KEY environment variable value if env_var_fallback is True if self . _env_var_fallback : if yahoo_consumer_key_env_var := os . environ . get ( \"YAHOO_CONSUMER_KEY\" ): self . _yahoo_consumer_key = yahoo_consumer_key_env_var if not self . _yahoo_consumer_key : logger . error ( \"Missing required Yahoo consumer key (no yahoo_consumer_key argument provided to \" \"YahooFantasySportsQuery, no consumer_key value provided in yahoo_access_token_json, or no \" \"YAHOO_CONSUMER_KEY environment variable value found).\" ) sys . exit ( 1 ) # catch when a Yahoo consumer secret was not provided if not self . _yahoo_consumer_secret : # check for YAHOO_CONSUMER_SECRET environment variable value if env_var_fallback is True if self . _env_var_fallback : if yahoo_consumer_secret_env_var := os . environ . get ( \"YAHOO_CONSUMER_SECRET\" ): self . _yahoo_consumer_secret = yahoo_consumer_secret_env_var if not self . _yahoo_consumer_secret : logger . error ( \"Missing required Yahoo consumer secret (no yahoo_consumer_secret argument provided to \" \"YahooFantasySportsQuery, no consumer_secret value provided in yahoo_access_token_json, or no \" \"YAHOO_CONSUMER_SECRET environment variable value found).\" ) sys . exit ( 1 ) # explicitly check for truthy/falsy value self . _browser_callback : bool = True if browser_callback is True else False self . _retries : int = retries self . _backoff : int = backoff self . _fantasy_content_data_field : str = \"fantasy_content\" self . league_id : str = league_id self . game_code : str = ( game_code if game_code in yahoo_fantasy_sports_game_codes else retrieve_game_code_from_user () ) self . game_id : int = game_id self . league_key : str = None self . executed_queries : List [ Dict [ str , Any ]] = [] # explicitly check for truthy/falsy value self . all_output_as_json_str : bool = True if all_output_as_json_str is True else False # explicitly check for truthy/falsy value self . offline : bool = True if offline is True else False if not self . offline : self . _authenticate () if save_token_data_to_env_file : self . save_access_token_data_to_env_file ( env_file_location ) save_access_token_data_to_env_file \u00b6 save_access_token_data_to_env_file ( env_file_location , env_file_name = \".env\" , save_json_to_var_only = False , ) Saves the fields and values of a Yahoo access token into a .env file. Parameters: env_file_location \u2013 obj: Path , optional): Path to directory where existing .env file is located or new .env file should be generated. env_file_name \u2013 obj: str , optional): The name of the target .env file (defaults to \".env\"). save_json_to_var_only \u2013 obj: bool , optional): Boolean to determine whether or not to write a JSON string of Yahoo access token fields to a YAHOO_ACCESS_TOKEN_JSON environment variable in the target .env file instead of writing Yahoo access token fields to separate environment variables in the target .env file. (defaults to False). Returns: None \u2013 None Source code in yfpy/query.py 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 def save_access_token_data_to_env_file ( self , env_file_location : Path , env_file_name : str = \".env\" , save_json_to_var_only : bool = False ) -> None : \"\"\"Saves the fields and values of a Yahoo access token into a .env file. Args: env_file_location (:obj:`Path`, optional): Path to directory where existing .env file is located or new .env file should be generated. env_file_name (:obj:`str`, optional): The name of the target .env file (defaults to \".env\"). save_json_to_var_only (:obj:`bool`, optional): Boolean to determine whether or not to write a JSON string of Yahoo access token fields to a YAHOO_ACCESS_TOKEN_JSON environment variable in the target .env file instead of writing Yahoo access token fields to separate environment variables in the target .env file. (defaults to False). Returns: None \"\"\" if env_file_location : env_file_path = env_file_location / env_file_name else : logger . warning ( \"Missing argument env_file_location. Yahoo access token will NOT be saved to .env file.\" ) # exit method without saving Yahoo access token data when no env_file_location argument is provided return env_file_content = self . _retrieve_env_file_contents ( env_file_path ) if save_json_to_var_only : # generate a JSON string with escaped double quotes using nested json.dumps() and write it to a # YAHOO_ACCESS_TOKEN_JSON environment variable if save_json_to_var_only is set to True instead of writing # Yahoo access token fields to separate environment variables in target .env file env_file_content [ \"yahoo_access_token_json\" ] = json . dumps ( json . dumps ( self . _yahoo_access_token_dict )) else : # replace values of any matching environment variables in .env file with values from Yahoo access token # fields or add new environment variables to .env file if any fields are missing for k , v in self . _yahoo_access_token_dict . items (): env_file_content [ f \"yahoo_ { k } \" ] = v # write contents to .env file (overwrites contents if file exists or creates a new file if not) with open ( env_file_path , \"w\" ) as env_file : for k , v in env_file_content . items (): if k . startswith ( \"blank\" ): env_file . write ( v ) elif k . startswith ( \"comment\" ): env_file . write ( f \" { v } \\n \" ) else : env_file . write ( f \" { k . upper () } = { v } \\n \" ) get_response \u00b6 get_response ( url ) Retrieve Yahoo Fantasy Sports data from the REST API. Parameters: url ( str ) \u2013 REST API request URL string. Returns: Response ( Response ) \u2013 API response from Yahoo Fantasy Sports API request. Source code in yfpy/query.py 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 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 def get_response ( self , url : str ) -> Response : \"\"\"Retrieve Yahoo Fantasy Sports data from the REST API. Args: url (str): REST API request URL string. Returns: Response: API response from Yahoo Fantasy Sports API request. \"\"\" logger . debug ( f \"Making request to URL: { url } \" ) response : Response = self . oauth . session . get ( url , params = { \"format\" : \"json\" }) status_code = response . status_code # when you exceed Yahoo's allowed data request limits, they throw a request status code of 999 if status_code == 999 : raise HTTPError ( \"Yahoo data unavailable due to rate limiting. Please try again later.\" ) if status_code == 401 : self . _authenticate () response_json = {} try : response_json = response . json () logger . debug ( f \"Response (JSON): { response_json } \" ) except JSONDecodeError : response . raise_for_status () try : if ( status_code // 100 ) != 2 : # handle if the yahoo query returns an error if response_json . get ( \"error\" ): response_error_msg = response_json . get ( \"error\" ) . get ( \"description\" ) error_msg = f \"Attempt to retrieve data at URL { response . url } failed with error: \" \\ f \" \\\" { response_error_msg } \\\" \" logger . error ( error_msg ) raise YahooFantasySportsDataNotFound ( error_msg , url = response . url ) response . raise_for_status () except HTTPError as e : # retry with incremental back-off if self . _retries > 0 : self . _retries -= 1 self . _backoff += 1 logger . warning ( f \"Request for URL { url } failed with status code { response . status_code } . \" f \"Retrying { self . _retries } more time { 's' if self . _retries > 1 else '' } ...\" ) time . sleep ( 0.3 * self . _backoff ) response = self . get_response ( url ) else : # log error and terminate query if status code is not 200 after 3 retries logger . error ( f \"Request failed with status code: { response . status_code } - { e } \" ) response . raise_for_status () raw_response_data = response_json . get ( self . _fantasy_content_data_field ) # extract data from \"fantasy_content\" field if it exists if raw_response_data : logger . debug ( f \"Data fetched with query URL: { response . url } \" ) logger . debug ( f \"Response (Yahoo fantasy data extracted from: \" f \" \\\" { self . _fantasy_content_data_field } \\\" ): { raw_response_data } \" ) else : error_msg = f \"No data found at URL { response . url } when attempting extraction from field: \" \\ f \" \\\" { self . _fantasy_content_data_field } \\\" \" logger . error ( error_msg ) raise YahooFantasySportsDataNotFound ( error_msg , url = response . url ) return response query \u00b6 query ( url , data_key_list , data_type_class = None , sort_function = None , ) Base query class to retrieve requested data from the Yahoo fantasy sports REST API. Parameters: url ( str ) \u2013 REST API request URL string. data_key_list ( list [ str ] | list [ list [ str ]] ) \u2013 List of keys used to extract the specific data desired by the given query (supports strings and lists of strings). Supports lists containing only key strings such as [\"game\", \"stat_categories\"], and also supports lists containing key strings followed by lists of key strings such as [\"team\", [\"team_points\", \"team_projected_points\"]]. data_type_class \u2013 obj: Type , optional): Highest level data model type (if one exists for the retrieved data). sort_function ( Callable of sort function , default: None ) \u2013 Optional lambda function to return sorted query results. Returns: object ( Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]] ) \u2013 Model class instance from yfpy/models.py, dictionary, or list (depending on query), with unpacked Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]] \u2013 and parsed response data. Source code in yfpy/query.py 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 def query ( self , url : str , data_key_list : Union [ List [ str ], List [ List [ str ]]], data_type_class : Type = None , sort_function : Callable = None ) -> ( Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]]): \"\"\"Base query class to retrieve requested data from the Yahoo fantasy sports REST API. Args: url (str): REST API request URL string. data_key_list (list[str] | list[list[str]]): List of keys used to extract the specific data desired by the given query (supports strings and lists of strings). Supports lists containing only key strings such as [\"game\", \"stat_categories\"], and also supports lists containing key strings followed by lists of key strings such as [\"team\", [\"team_points\", \"team_projected_points\"]]. data_type_class (:obj:`Type`, optional): Highest level data model type (if one exists for the retrieved data). sort_function (Callable of sort function, optional)): Optional lambda function to return sorted query results. Returns: object: Model class instance from yfpy/models.py, dictionary, or list (depending on query), with unpacked and parsed response data. \"\"\" if not self . offline : response = self . get_response ( url ) raw_response_data = response . json () . get ( self . _fantasy_content_data_field ) # print(json.dumps(raw_response_data, indent=2)) # iterate through list of data keys and drill down to final desired data field for i in range ( len ( data_key_list )): if isinstance ( raw_response_data , list ): if isinstance ( data_key_list [ i ], list ): reformatted = reformat_json_list ( raw_response_data ) raw_response_data = [ { data_key_list [ i ][ 0 ]: reformatted [ data_key_list [ i ][ 0 ]]}, { data_key_list [ i ][ 1 ]: reformatted [ data_key_list [ i ][ 1 ]]} ] else : raw_response_data = reformat_json_list ( raw_response_data )[ data_key_list [ i ]] else : if isinstance ( data_key_list [ i ], list ): raw_response_data = [ { data_key_list [ i ][ 0 ]: raw_response_data [ data_key_list [ i ][ 0 ]]}, { data_key_list [ i ][ 1 ]: raw_response_data [ data_key_list [ i ][ 1 ]]} ] else : raw_response_data = raw_response_data . get ( data_key_list [ i ]) if raw_response_data : logger . debug ( f \"Response (Yahoo fantasy data extracted from: { data_key_list } ): { raw_response_data } \" ) else : error_msg = f \"No data found when attempting extraction from fields: { data_key_list } \" logger . error ( error_msg ) raise YahooFantasySportsDataNotFound ( error_msg , payload = data_key_list , url = response . url ) # unpack, parse, and assign data types to all retrieved data content unpacked = unpack_data ( raw_response_data , YahooFantasyObject ) logger . debug ( f \"Unpacked and parsed JSON (Yahoo fantasy data wth parent type: { data_type_class } ): \\n { unpacked } \" ) self . executed_queries . append ({ \"url\" : response . url , \"response_status_code\" : response . status_code , \"response\" : response }) # cast the highest level of data to type corresponding to query (if type exists) query_data = data_type_class ( unpacked ) if data_type_class else unpacked # sort data when applicable if sort_function and not isinstance ( query_data , dict ): query_data = sorted ( query_data , key = sort_function ) # flatten lists of single-key dicts of objects into lists of those objects if isinstance ( query_data , list ): last_data_key = data_key_list [ - 1 ] if last_data_key . endswith ( \"s\" ): query_data = [ el [ last_data_key [: - 1 ]] for el in query_data ] if self . all_output_as_json_str : return jsonify_data ( query_data ) else : return query_data else : logger . error ( \"Cannot run Yahoo query while using offline mode! Please try again with offline=False.\" ) get_all_yahoo_fantasy_game_keys \u00b6 get_all_yahoo_fantasy_game_keys () Retrieve all Yahoo Fantasy Sports game keys by ID (from year of inception to present), sorted by season/year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_all_yahoo_fantasy_game_keys () [ Game({ \"code\": \"nfl\", \"game_id\": \"50\", \"game_key\": \"50\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"1999\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/1999\" }), ..., Game({...}) ] Returns: List [ Game ] \u2013 list[Game]: List of YFPY Game instances. Source code in yfpy/query.py 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 def get_all_yahoo_fantasy_game_keys ( self ) -> List [ Game ]: \"\"\"Retrieve all Yahoo Fantasy Sports game keys by ID (from year of inception to present), sorted by season/year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_all_yahoo_fantasy_game_keys() [ Game({ \"code\": \"nfl\", \"game_id\": \"50\", \"game_key\": \"50\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"1999\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/1999\" }), ..., Game({...}) ] Returns: list[Game]: List of YFPY Game instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/games;game_codes= { self . game_code } \" , [ \"games\" ], sort_function = lambda x : x . get ( \"game\" ) . season ) get_game_key_by_season \u00b6 get_game_key_by_season ( season ) Retrieve specific game key by season. Parameters: season ( int ) \u2013 User defined season/year for which to retrieve the Yahoo Fantasy Sports game. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_game_key_by_season ( 2021 ) 338 Returns: str ( str ) \u2013 The game key for a Yahoo Fantasy Sports game specified by season. Source code in yfpy/query.py 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 def get_game_key_by_season ( self , season : int ) -> str : \"\"\"Retrieve specific game key by season. Args: season (int): User defined season/year for which to retrieve the Yahoo Fantasy Sports game. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_key_by_season(2021) 338 Returns: str: The game key for a Yahoo Fantasy Sports game specified by season. \"\"\" all_output_as_json = False if self . all_output_as_json_str : self . all_output_as_json_str = False all_output_as_json = True game_key = self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/games;game_codes= { self . game_code } ;seasons= { season } \" , [ \"games\" ] ) . get ( \"game\" ) . game_key if all_output_as_json : self . all_output_as_json_str = True return game_key get_current_game_info \u00b6 get_current_game_info () Retrieve game info for current fantasy season. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_current_game_info () Game({ \"code\": \"nfl\", \"game_id\": \"390\", \"game_key\": \"390\", \"game_weeks\": [ { \"game_week\": { \"display_name\": \"1\", \"end\": \"2019-09-09\", \"start\": \"2019-09-05\", \"week\": \"1\" } }, ... ], \"is_game_over\": 0, \"is_live_draft_lobby_active\": 1, \"is_offseason\": 0, \"is_registration_over\": 0, \"name\": \"Football\", \"position_types\": [ { \"position_type\": { \"type\": \"O\", \"display_name\": \"Offense\" } }, ... ], \"roster_positions\": [ { \"roster_position\": { \"position\": \"QB\", \"position_type\": \"O\" } }, ... ], \"season\": \"2019\", \"stat_categories\": { \"stats\": [ { \"stat\": { \"display_name\": \"GP\", \"name\": \"Games Played\", \"sort_order\": \"1\", \"stat_id\": 0 } }, ... }, \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/f1\" }) Returns: Game ( Game ) \u2013 YFPY Game instance. Source code in yfpy/query.py 646 647 648 649 650 651 652 653 654 655 656 657 658 659 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 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 def get_current_game_info ( self ) -> Game : \"\"\"Retrieve game info for current fantasy season. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_current_game_info() Game({ \"code\": \"nfl\", \"game_id\": \"390\", \"game_key\": \"390\", \"game_weeks\": [ { \"game_week\": { \"display_name\": \"1\", \"end\": \"2019-09-09\", \"start\": \"2019-09-05\", \"week\": \"1\" } }, ... ], \"is_game_over\": 0, \"is_live_draft_lobby_active\": 1, \"is_offseason\": 0, \"is_registration_over\": 0, \"name\": \"Football\", \"position_types\": [ { \"position_type\": { \"type\": \"O\", \"display_name\": \"Offense\" } }, ... ], \"roster_positions\": [ { \"roster_position\": { \"position\": \"QB\", \"position_type\": \"O\" } }, ... ], \"season\": \"2019\", \"stat_categories\": { \"stats\": [ { \"stat\": { \"display_name\": \"GP\", \"name\": \"Games Played\", \"sort_order\": \"1\", \"stat_id\": 0 } }, ... }, \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/f1\" }) Returns: Game: YFPY Game instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { self . game_code } ;\" f \"out=metadata,players,game_weeks,stat_categories,position_types,roster_positions\" , [ \"game\" ], Game ) get_current_game_metadata \u00b6 get_current_game_metadata () Retrieve game metadata for current fantasy season. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_current_game_metadata () Game({ \"code\": \"nfl\", \"game_id\": \"390\", \"game_key\": \"390\", \"is_game_over\": 0, \"is_live_draft_lobby_active\": 1, \"is_offseason\": 0, \"is_registration_over\": 0, \"name\": \"Football\", \"season\": \"2019\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/f1\" }) Returns: Game ( Game ) \u2013 YFPY Game instance. Source code in yfpy/query.py 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 def get_current_game_metadata ( self ) -> Game : \"\"\"Retrieve game metadata for current fantasy season. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_current_game_metadata() Game({ \"code\": \"nfl\", \"game_id\": \"390\", \"game_key\": \"390\", \"is_game_over\": 0, \"is_live_draft_lobby_active\": 1, \"is_offseason\": 0, \"is_registration_over\": 0, \"name\": \"Football\", \"season\": \"2019\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/f1\" }) Returns: Game: YFPY Game instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { self . game_code } /metadata\" , [ \"game\" ], Game ) get_game_info_by_game_id \u00b6 get_game_info_by_game_id ( game_id ) Retrieve game info for specific game by ID. Parameters: game_id ( int ) \u2013 Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_game_info_by_game_id ( 390 ) Game({ \"code\": \"nfl\", \"game_id\": \"390\", \"game_key\": \"390\", \"game_weeks\": [ { \"game_week\": { \"display_name\": \"1\", \"end\": \"2019-09-09\", \"start\": \"2019-09-05\", \"week\": \"1\" } }, ... ], \"is_game_over\": 0, \"is_live_draft_lobby_active\": 1, \"is_offseason\": 0, \"is_registration_over\": 0, \"name\": \"Football\", \"position_types\": [ { \"position_type\": { \"type\": \"O\", \"display_name\": \"Offense\" } }, ... ], \"roster_positions\": [ { \"roster_position\": { \"position\": \"QB\", \"position_type\": \"O\" } }, ... ], \"season\": \"2019\", \"stat_categories\": { \"stats\": [ { \"stat\": { \"display_name\": \"GP\", \"name\": \"Games Played\", \"sort_order\": \"1\", \"stat_id\": 0 } }, ... }, \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/f1\" }) Returns: Game ( Game ) \u2013 YFPY Game instance. Source code in yfpy/query.py 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 def get_game_info_by_game_id ( self , game_id : int ) -> Game : \"\"\"Retrieve game info for specific game by ID. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_info_by_game_id(390) Game({ \"code\": \"nfl\", \"game_id\": \"390\", \"game_key\": \"390\", \"game_weeks\": [ { \"game_week\": { \"display_name\": \"1\", \"end\": \"2019-09-09\", \"start\": \"2019-09-05\", \"week\": \"1\" } }, ... ], \"is_game_over\": 0, \"is_live_draft_lobby_active\": 1, \"is_offseason\": 0, \"is_registration_over\": 0, \"name\": \"Football\", \"position_types\": [ { \"position_type\": { \"type\": \"O\", \"display_name\": \"Offense\" } }, ... ], \"roster_positions\": [ { \"roster_position\": { \"position\": \"QB\", \"position_type\": \"O\" } }, ... ], \"season\": \"2019\", \"stat_categories\": { \"stats\": [ { \"stat\": { \"display_name\": \"GP\", \"name\": \"Games Played\", \"sort_order\": \"1\", \"stat_id\": 0 } }, ... }, \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/f1\" }) Returns: Game: YFPY Game instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } ;\" f \"out=metadata,players,game_weeks,stat_categories,position_types,roster_positions\" , [ \"game\" ], Game ) get_game_metadata_by_game_id \u00b6 get_game_metadata_by_game_id ( game_id ) Retrieve game metadata for specific game by ID. Parameters: game_id ( int ) \u2013 Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_game_metadata_by_game_id ( 331 ) Game({ \"code\": \"nfl\", \"game_id\": \"331\", \"game_key\": \"331\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"2014\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014\" }) Returns: Game ( Game ) \u2013 YFPY Game instance. Source code in yfpy/query.py 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 def get_game_metadata_by_game_id ( self , game_id : int ) -> Game : \"\"\"Retrieve game metadata for specific game by ID. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_metadata_by_game_id(331) Game({ \"code\": \"nfl\", \"game_id\": \"331\", \"game_key\": \"331\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"2014\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014\" }) Returns: Game: YFPY Game instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } /metadata\" , [ \"game\" ], Game ) get_game_weeks_by_game_id \u00b6 get_game_weeks_by_game_id ( game_id ) Retrieve all valid weeks of a specific game by ID. Parameters: game_id ( int ) \u2013 Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_game_weeks_by_game_id ( 331 ) [ GameWeek({ \"display_name\": \"1\", \"end\": \"2014-09-08\", \"start\": \"2014-09-04\", \"week\": \"1\" }), ..., GameWeek({ \"display_name\": \"17\", \"end\": \"2014-12-28\", \"start\": \"2014-12-23\", \"week\": \"17\" }) ] Returns: List [ GameWeek ] \u2013 list[GameWeek]: List of YFPY GameWeek instances. Source code in yfpy/query.py 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 def get_game_weeks_by_game_id ( self , game_id : int ) -> List [ GameWeek ]: \"\"\"Retrieve all valid weeks of a specific game by ID. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_weeks_by_game_id(331) [ GameWeek({ \"display_name\": \"1\", \"end\": \"2014-09-08\", \"start\": \"2014-09-04\", \"week\": \"1\" }), ..., GameWeek({ \"display_name\": \"17\", \"end\": \"2014-12-28\", \"start\": \"2014-12-23\", \"week\": \"17\" }) ] Returns: list[GameWeek]: List of YFPY GameWeek instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } /game_weeks\" , [ \"game\" , \"game_weeks\" ] ) get_game_stat_categories_by_game_id \u00b6 get_game_stat_categories_by_game_id ( game_id ) Retrieve all valid stat categories of a specific game by ID. Parameters: game_id ( int ) \u2013 Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_game_stat_categories_by_game_id ( 331 ) StatCategories({ \"stats\": [ { \"stat\": { \"display_name\": \"GP\", \"name\": \"Games Played\", \"sort_order\": \"1\", \"stat_id\": 0 } }, ..., { \"stat\": { \"display_name\": \"Rush 1st Downs\", \"name\": \"Rushing 1st Downs\", \"sort_order\": \"1\", \"stat_id\": 81 } } ] }) Returns: StatCategories ( StatCategories ) \u2013 YFPY StatCategories instance. Source code in yfpy/query.py 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 def get_game_stat_categories_by_game_id ( self , game_id : int ) -> StatCategories : \"\"\"Retrieve all valid stat categories of a specific game by ID. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_stat_categories_by_game_id(331) StatCategories({ \"stats\": [ { \"stat\": { \"display_name\": \"GP\", \"name\": \"Games Played\", \"sort_order\": \"1\", \"stat_id\": 0 } }, ..., { \"stat\": { \"display_name\": \"Rush 1st Downs\", \"name\": \"Rushing 1st Downs\", \"sort_order\": \"1\", \"stat_id\": 81 } } ] }) Returns: StatCategories: YFPY StatCategories instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } /stat_categories\" , [ \"game\" , \"stat_categories\" ], StatCategories ) get_game_position_types_by_game_id \u00b6 get_game_position_types_by_game_id ( game_id ) Retrieve all valid position types for specific game by ID sorted alphabetically by type. Parameters: game_id ( int ) \u2013 Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_game_position_types_by_game_id ( 331 ) [ PositionType({ \"type\": \"O\", \"display_name\": \"Offense\" }), ..., PositionType({ \"type\": \"K\", \"display_name\": \"Kickers\" }) ] Returns: List [ PositionType ] \u2013 list[PositionType]: List of YFPY PositionType instances. Source code in yfpy/query.py 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 def get_game_position_types_by_game_id ( self , game_id : int ) -> List [ PositionType ]: \"\"\"Retrieve all valid position types for specific game by ID sorted alphabetically by type. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_position_types_by_game_id(331) [ PositionType({ \"type\": \"O\", \"display_name\": \"Offense\" }), ..., PositionType({ \"type\": \"K\", \"display_name\": \"Kickers\" }) ] Returns: list[PositionType]: List of YFPY PositionType instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } /position_types\" , [ \"game\" , \"position_types\" ], sort_function = lambda x : x . get ( \"position_type\" ) . type ) get_game_roster_positions_by_game_id \u00b6 get_game_roster_positions_by_game_id ( game_id ) Retrieve all valid roster positions for specific game by ID sorted alphabetically by position. Parameters: game_id ( int ) \u2013 Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_game_roster_positions_by_game_id ( 331 ) [ {RosterPosition({ \"position\": \"BN\" }), ..., RosterPosition({ \"position\": \"WR\", \"position_type\": \"O\" }) ] Returns: List [ RosterPosition ] \u2013 list[RosterPosition]: List of YFPY RosterPosition instances. Source code in yfpy/query.py 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 def get_game_roster_positions_by_game_id ( self , game_id : int ) -> List [ RosterPosition ]: \"\"\"Retrieve all valid roster positions for specific game by ID sorted alphabetically by position. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_roster_positions_by_game_id(331) [ {RosterPosition({ \"position\": \"BN\" }), ..., RosterPosition({ \"position\": \"WR\", \"position_type\": \"O\" }) ] Returns: list[RosterPosition]: List of YFPY RosterPosition instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } /roster_positions\" , [ \"game\" , \"roster_positions\" ], sort_function = lambda x : x . get ( \"roster_position\" ) . position ) get_league_key \u00b6 get_league_key ( season = None ) Retrieve league key for selected league. Parameters: season ( int , default: None ) \u2013 User defined season/year for which to retrieve the Yahoo Fantasy Sports league key. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_league_key ( 2021 ) 331.l.729259 Returns: str ( str ) \u2013 League key string for selected league. Source code in yfpy/query.py 1007 1008 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 def get_league_key ( self , season : int = None ) -> str : \"\"\"Retrieve league key for selected league. Args: season (int): User defined season/year for which to retrieve the Yahoo Fantasy Sports league key. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_key(2021) 331.l.729259 Returns: str: League key string for selected league. \"\"\" if not self . league_key : if season : return f \" { self . get_game_key_by_season ( season ) } .l. { self . league_id } \" elif self . game_id : return f \" { self . get_game_metadata_by_game_id ( self . game_id ) . game_key } .l. { self . league_id } \" else : logger . warning ( \"No game id or season/year provided, defaulting to current fantasy season.\" ) return f \" { self . get_current_game_metadata () . game_key } .l. { self . league_id } \" else : return self . league_key get_current_user \u00b6 get_current_user () Retrieve metadata for current logged-in user. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_current_user () User({ \"guid\": \"USER_GUID_STRING\" }) Returns: User ( User ) \u2013 YFPY User instance. Source code in yfpy/query.py 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 def get_current_user ( self ) -> User : \"\"\"Retrieve metadata for current logged-in user. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_current_user() User({ \"guid\": \"USER_GUID_STRING\" }) Returns: User: YFPY User instance. \"\"\" return self . query ( \"https://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/\" , [ \"users\" , \"0\" , \"user\" ], User ) get_user_games \u00b6 get_user_games () Retrieve game history for current logged-in user sorted by season/year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_user_games () [ Game({ \"code\": \"nfl\", \"game_id\": \"359\", \"game_key\": \"359\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"2016\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2016\" }) ..., Game({...}) ] Returns: List [ Game ] \u2013 list[Game]: List of YFPY Game instances. Source code in yfpy/query.py 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 def get_user_games ( self ) -> List [ Game ]: \"\"\"Retrieve game history for current logged-in user sorted by season/year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_user_games() [ Game({ \"code\": \"nfl\", \"game_id\": \"359\", \"game_key\": \"359\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"2016\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2016\" }) ..., Game({...}) ] Returns: list[Game]: List of YFPY Game instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/games;codes= { self . game_code } /\" , [ \"users\" , \"0\" , \"user\" , \"games\" ], sort_function = lambda x : x . get ( \"game\" ) . season ) get_user_leagues_by_game_key \u00b6 get_user_leagues_by_game_key ( game_key ) Retrieve league history for current logged-in user for specific game by game IDs/keys sorted by season/year. Parameters: game_key ( int | str ) \u2013 The game_id (int) or game_key (str) for a specific Yahoo Fantasy game. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_user_leagues_by_game_key ( 331 ) [ League({ \"allow_add_to_dl_extra_pos\": 0, \"current_week\": \"16\", \"draft_status\": \"postdraft\", \"edit_key\": \"16\", \"end_date\": \"2018-12-24\", \"end_week\": \"16\", \"game_code\": \"nfl\", \"iris_group_chat_id\": \"\", \"is_cash_league\": \"0\", \"is_finished\": 1, \"is_pro_league\": \"0\", \"league_id\": \"169896\", \"league_key\": \"380.l.169896\", \"league_type\": \"private\", \"league_update_timestamp\": \"1546498723\", \"logo_url\": \"\", \"name\": \"League Name\", \"num_teams\": 12, \"password\": null, \"renew\": \"371_52364\", \"renewed\": \"390_78725\", \"scoring_type\": \"head\", \"season\": \"2018\", \"short_invitation_url\": \"\", \"start_date\": \"2018-09-06\", \"start_week\": \"1\", \"url\": \"\", \"weekly_deadline\": null }), ..., League({...}) ] Returns: List [ League ] \u2013 list[League]: List of YFPY League instances. Source code in yfpy/query.py 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 def get_user_leagues_by_game_key ( self , game_key : Union [ int , str ]) -> List [ League ]: \"\"\"Retrieve league history for current logged-in user for specific game by game IDs/keys sorted by season/year. Args: game_key (int | str): The game_id (int) or game_key (str) for a specific Yahoo Fantasy game. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_user_leagues_by_game_key(331) [ League({ \"allow_add_to_dl_extra_pos\": 0, \"current_week\": \"16\", \"draft_status\": \"postdraft\", \"edit_key\": \"16\", \"end_date\": \"2018-12-24\", \"end_week\": \"16\", \"game_code\": \"nfl\", \"iris_group_chat_id\": \"\", \"is_cash_league\": \"0\", \"is_finished\": 1, \"is_pro_league\": \"0\", \"league_id\": \"169896\", \"league_key\": \"380.l.169896\", \"league_type\": \"private\", \"league_update_timestamp\": \"1546498723\", \"logo_url\": \"\", \"name\": \"League Name\", \"num_teams\": 12, \"password\": null, \"renew\": \"371_52364\", \"renewed\": \"390_78725\", \"scoring_type\": \"head\", \"season\": \"2018\", \"short_invitation_url\": \"\", \"start_date\": \"2018-09-06\", \"start_week\": \"1\", \"url\": \"\", \"weekly_deadline\": null }), ..., League({...}) ] Returns: list[League]: List of YFPY League instances. \"\"\" leagues = self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/games;game_keys= { game_key } /leagues/\" , [ \"users\" , \"0\" , \"user\" , \"games\" , \"0\" , \"game\" , \"leagues\" ], sort_function = lambda x : x . get ( \"league\" ) . season ) return leagues if isinstance ( leagues , list ) else [ leagues . get ( \"league\" )] get_user_teams \u00b6 get_user_teams () Retrieve teams for all leagues for current logged-in user for current game sorted by season/year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_user_teams () [ Game({ \"code\": \"nfl\", \"game_id\": \"359\", \"game_key\": \"359\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"2016\", \"teams\": [ { \"team\": { \"draft_grade\": \"A\", \"draft_position\": 9, \"draft_recap_url\": \"\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": [ { \"manager\": { \"email\": \"\", \"guid\": \"\", \"image_url\": \"\", \"is_comanager\": \"1\", \"manager_id\": \"14\", \"nickname\": \"\" } } ], \"name\": \"Legion\", \"number_of_moves\": \"48\", \"number_of_trades\": \"2\", \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"1\", \"team_key\": \"359.l.5521.t.1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"\" } }, \"url\": \"\", \"waiver_priority\": 11 } } ], \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2016\" }) ..., Game({...}) ] Returns: List [ Game ] \u2013 list[Game]: List of YFPY Game instances with \"teams\" attribute containing list of YFPY Team instances. Source code in yfpy/query.py 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 def get_user_teams ( self ) -> List [ Game ]: \"\"\"Retrieve teams for all leagues for current logged-in user for current game sorted by season/year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_user_teams() [ Game({ \"code\": \"nfl\", \"game_id\": \"359\", \"game_key\": \"359\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"2016\", \"teams\": [ { \"team\": { \"draft_grade\": \"A\", \"draft_position\": 9, \"draft_recap_url\": \"\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": [ { \"manager\": { \"email\": \"\", \"guid\": \"\", \"image_url\": \"\", \"is_comanager\": \"1\", \"manager_id\": \"14\", \"nickname\": \"\" } } ], \"name\": \"Legion\", \"number_of_moves\": \"48\", \"number_of_trades\": \"2\", \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"1\", \"team_key\": \"359.l.5521.t.1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"\" } }, \"url\": \"\", \"waiver_priority\": 11 } } ], \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2016\" }) ..., Game({...}) ] Returns: list[Game]: List of YFPY Game instances with \"teams\" attribute containing list of YFPY Team instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/games;codes= { self . game_code } /teams/\" , [ \"users\" , \"0\" , \"user\" , \"games\" ], sort_function = lambda x : x . get ( \"game\" ) . season ) get_league_info \u00b6 get_league_info () Retrieve info for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_league_info () League({ \"allow_add_to_dl_extra_pos\": 0, \"current_week\": \"16\", \"draft_status\": \"postdraft\", \"edit_key\": \"16\", \"end_date\": \"2014-12-22\", \"end_week\": \"16\", \"game_code\": \"nfl\", \"iris_group_chat_id\": null, \"is_cash_league\": \"0\", \"is_finished\": 1, \"is_pro_league\": \"1\", \"league_id\": \"729259\", \"league_key\": \"331.l.729259\", \"league_type\": \"public\", \"league_update_timestamp\": \"1420099793\", \"logo_url\": \"https://s.yimg.com/cv/api/default/20180206/default-league-logo@2x.png\", \"name\": \"Yahoo Public 729259\", \"num_teams\": 10, \"renew\": null, \"renewed\": null, \"scoreboard\": { \"week\": \"16\", \"matchups\": [ ... ] }, \"scoring_type\": \"head\", \"season\": \"2014\", \"settings\": { ... }, \"standings\": { \"teams\": [ ..., ... ], ... }, \"start_date\": \"2014-09-04\", \"start_week\": \"1\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259\", \"weekly_deadline\": null }) Returns: League ( League ) \u2013 YFPY League instance. Source code in yfpy/query.py 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 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 def get_league_info ( self ) -> League : \"\"\"Retrieve info for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_info() League({ \"allow_add_to_dl_extra_pos\": 0, \"current_week\": \"16\", \"draft_status\": \"postdraft\", \"edit_key\": \"16\", \"end_date\": \"2014-12-22\", \"end_week\": \"16\", \"game_code\": \"nfl\", \"iris_group_chat_id\": null, \"is_cash_league\": \"0\", \"is_finished\": 1, \"is_pro_league\": \"1\", \"league_id\": \"729259\", \"league_key\": \"331.l.729259\", \"league_type\": \"public\", \"league_update_timestamp\": \"1420099793\", \"logo_url\": \"https://s.yimg.com/cv/api/default/20180206/default-league-logo@2x.png\", \"name\": \"Yahoo Public 729259\", \"num_teams\": 10, \"renew\": null, \"renewed\": null, \"scoreboard\": { \"week\": \"16\", \"matchups\": [ ... ] }, \"scoring_type\": \"head\", \"season\": \"2014\", \"settings\": { ... }, \"standings\": { \"teams\": [ ..., ... ], ... }, \"start_date\": \"2014-09-04\", \"start_week\": \"1\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259\", \"weekly_deadline\": null }) Returns: League: YFPY League instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } ;\" f \"out=metadata,settings,standings,scoreboard,teams,players,draftresults,transactions\" , [ \"league\" ], League ) get_league_metadata \u00b6 get_league_metadata () Retrieve metadata for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_league_metadata () League({ \"allow_add_to_dl_extra_pos\": 0, \"current_week\": \"16\", \"draft_status\": \"postdraft\", \"edit_key\": \"16\", \"end_date\": \"2014-12-22\", \"end_week\": \"16\", \"game_code\": \"nfl\", \"iris_group_chat_id\": null, \"is_cash_league\": \"0\", \"is_finished\": 1, \"is_pro_league\": \"1\", \"league_id\": \"729259\", \"league_key\": \"331.l.729259\", \"league_type\": \"public\", \"league_update_timestamp\": \"1420099793\", \"logo_url\": \"https://s.yimg.com/cv/api/default/20180206/default-league-logo@2x.png\", \"name\": \"Yahoo Public 729259\", \"num_teams\": 10, \"renew\": null, \"renewed\": null, \"scoring_type\": \"head\", \"season\": \"2014\", \"start_date\": \"2014-09-04\", \"start_week\": \"1\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259\", \"weekly_deadline\": null }) Returns: League ( League ) \u2013 YFPY League instance. Source code in yfpy/query.py 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 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 def get_league_metadata ( self ) -> League : \"\"\"Retrieve metadata for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_metadata() League({ \"allow_add_to_dl_extra_pos\": 0, \"current_week\": \"16\", \"draft_status\": \"postdraft\", \"edit_key\": \"16\", \"end_date\": \"2014-12-22\", \"end_week\": \"16\", \"game_code\": \"nfl\", \"iris_group_chat_id\": null, \"is_cash_league\": \"0\", \"is_finished\": 1, \"is_pro_league\": \"1\", \"league_id\": \"729259\", \"league_key\": \"331.l.729259\", \"league_type\": \"public\", \"league_update_timestamp\": \"1420099793\", \"logo_url\": \"https://s.yimg.com/cv/api/default/20180206/default-league-logo@2x.png\", \"name\": \"Yahoo Public 729259\", \"num_teams\": 10, \"renew\": null, \"renewed\": null, \"scoring_type\": \"head\", \"season\": \"2014\", \"start_date\": \"2014-09-04\", \"start_week\": \"1\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259\", \"weekly_deadline\": null }) Returns: League: YFPY League instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /metadata\" , [ \"league\" ], League ) get_league_settings \u00b6 get_league_settings () Retrieve settings (rules) for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_league_settings () Settings({ \"cant_cut_list\": \"yahoo\", \"draft_time\": \"1408410000\", \"draft_type\": \"live\", \"has_multiweek_championship\": 0, \"has_playoff_consolation_games\": true, \"is_auction_draft\": \"0\", \"max_teams\": \"10\", \"num_playoff_consolation_teams\": 4, \"num_playoff_teams\": \"4\", \"pickem_enabled\": \"1\", \"player_pool\": \"ALL\", \"playoff_start_week\": \"15\", \"post_draft_players\": \"W\", \"roster_positions\": [ { \"roster_position\": { \"count\": 1, \"position\": \"QB\", \"position_type\": \"O\" } }, ... ], \"scoring_type\": \"head\", \"stat_categories\": { \"stats\": [ { \"stat\": { \"display_name\": \"Pass Yds\", \"enabled\": \"1\", \"name\": \"Passing Yards\", \"position_type\": \"O\", \"sort_order\": \"1\", \"stat_id\": 4, \"stat_position_types\": { \"stat_position_type\": { \"position_type\": \"O\" } } } }, ... ] }, \"stat_modifiers\": { \"stats\": [ { \"stat\": { \"stat_id\": 4, \"value\": \"0.04\" } }, ... ] }, \"trade_end_date\": \"2014-11-14\", \"trade_ratify_type\": \"yahoo\", \"trade_reject_time\": \"2\", \"uses_faab\": \"0\", \"uses_fractional_points\": \"1\", \"uses_lock_eliminated_teams\": 1, \"uses_negative_points\": \"1\", \"uses_playoff\": \"1\", \"uses_playoff_reseeding\": 0, \"waiver_rule\": \"gametime\", \"waiver_time\": \"2\", \"waiver_type\": \"R\" }) Returns: Settings ( Settings ) \u2013 YFPY Settings instance. Source code in yfpy/query.py 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 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 def get_league_settings ( self ) -> Settings : \"\"\"Retrieve settings (rules) for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_settings() Settings({ \"cant_cut_list\": \"yahoo\", \"draft_time\": \"1408410000\", \"draft_type\": \"live\", \"has_multiweek_championship\": 0, \"has_playoff_consolation_games\": true, \"is_auction_draft\": \"0\", \"max_teams\": \"10\", \"num_playoff_consolation_teams\": 4, \"num_playoff_teams\": \"4\", \"pickem_enabled\": \"1\", \"player_pool\": \"ALL\", \"playoff_start_week\": \"15\", \"post_draft_players\": \"W\", \"roster_positions\": [ { \"roster_position\": { \"count\": 1, \"position\": \"QB\", \"position_type\": \"O\" } }, ... ], \"scoring_type\": \"head\", \"stat_categories\": { \"stats\": [ { \"stat\": { \"display_name\": \"Pass Yds\", \"enabled\": \"1\", \"name\": \"Passing Yards\", \"position_type\": \"O\", \"sort_order\": \"1\", \"stat_id\": 4, \"stat_position_types\": { \"stat_position_type\": { \"position_type\": \"O\" } } } }, ... ] }, \"stat_modifiers\": { \"stats\": [ { \"stat\": { \"stat_id\": 4, \"value\": \"0.04\" } }, ... ] }, \"trade_end_date\": \"2014-11-14\", \"trade_ratify_type\": \"yahoo\", \"trade_reject_time\": \"2\", \"uses_faab\": \"0\", \"uses_fractional_points\": \"1\", \"uses_lock_eliminated_teams\": 1, \"uses_negative_points\": \"1\", \"uses_playoff\": \"1\", \"uses_playoff_reseeding\": 0, \"waiver_rule\": \"gametime\", \"waiver_time\": \"2\", \"waiver_type\": \"R\" }) Returns: Settings: YFPY Settings instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /settings\" , [ \"league\" , \"settings\" ], Settings ) get_league_standings \u00b6 get_league_standings () Retrieve standings for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_league_standings () Standings({ \"teams\": [ { \"team\": { \"clinched_playoffs\": 1, \"draft_grade\": \"C+\", \"draft_position\": 7, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/8/draftrecap\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"PMTCFWSK5U5LI4SKWREUR56B5A\", \"manager_id\": \"8\", \"nickname\": \"--hidden--\" } }, \"name\": \"clam dam\", \"number_of_moves\": \"27\", \"number_of_trades\": 0, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"8\", \"team_key\": \"331.l.729259.t.8\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://s.yimg.com/cv/apiv2/default/nfl/nfl_1.png\" } }, \"team_points\": { \"coverage_type\": \"season\", \"season\": \"2014\", \"total\": \"1507.06\" }, \"team_standings\": { \"outcome_totals\": { \"losses\": 2, \"percentage\": 0.857, \"ties\": 0, \"wins\": 12 }, \"playoff_seed\": \"1\", \"points_against\": 1263.78, \"points_for\": 1507.06, \"rank\": 1, \"streak\": { \"type\": \"win\", \"value\": \"2\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/8\", \"waiver_priority\": 10 } }, ... ] }) Returns: Standings ( Standings ) \u2013 YFPY Standings instance. Source code in yfpy/query.py 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 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 def get_league_standings ( self ) -> Standings : \"\"\"Retrieve standings for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_standings() Standings({ \"teams\": [ { \"team\": { \"clinched_playoffs\": 1, \"draft_grade\": \"C+\", \"draft_position\": 7, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/8/draftrecap\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"PMTCFWSK5U5LI4SKWREUR56B5A\", \"manager_id\": \"8\", \"nickname\": \"--hidden--\" } }, \"name\": \"clam dam\", \"number_of_moves\": \"27\", \"number_of_trades\": 0, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"8\", \"team_key\": \"331.l.729259.t.8\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://s.yimg.com/cv/apiv2/default/nfl/nfl_1.png\" } }, \"team_points\": { \"coverage_type\": \"season\", \"season\": \"2014\", \"total\": \"1507.06\" }, \"team_standings\": { \"outcome_totals\": { \"losses\": 2, \"percentage\": 0.857, \"ties\": 0, \"wins\": 12 }, \"playoff_seed\": \"1\", \"points_against\": 1263.78, \"points_for\": 1507.06, \"rank\": 1, \"streak\": { \"type\": \"win\", \"value\": \"2\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/8\", \"waiver_priority\": 10 } }, ... ] }) Returns: Standings: YFPY Standings instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /standings\" , [ \"league\" , \"standings\" ], Standings ) get_league_teams \u00b6 get_league_teams () Retrieve teams for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_league_teams () [ Team({ \"clinched_playoffs\": 1, \"draft_grade\": \"B\", \"draft_position\": 4, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1/draftrecap\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"BMACD7S5UXV7JIQX4PGGUVQJAU\", \"manager_id\": \"1\", \"nickname\": \"--hidden--\" } }, \"name\": \"Hellacious Hill 12\", \"number_of_moves\": \"71\", \"number_of_trades\": 0, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"1\", \"team_key\": \"331.l.729259.t.1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1441/24935131299_a8242dab70_192sq.jpg?ct=fantasy\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1\", \"waiver_priority\": 9 }), ..., Team({...}) ] Returns: List [ Team ] \u2013 list[Team]: List of YFPY Team instances. Source code in yfpy/query.py 1506 1507 1508 1509 1510 1511 1512 1513 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 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 def get_league_teams ( self ) -> List [ Team ]: \"\"\"Retrieve teams for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_teams() [ Team({ \"clinched_playoffs\": 1, \"draft_grade\": \"B\", \"draft_position\": 4, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1/draftrecap\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"BMACD7S5UXV7JIQX4PGGUVQJAU\", \"manager_id\": \"1\", \"nickname\": \"--hidden--\" } }, \"name\": \"Hellacious Hill 12\", \"number_of_moves\": \"71\", \"number_of_trades\": 0, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"1\", \"team_key\": \"331.l.729259.t.1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1441/24935131299_a8242dab70_192sq.jpg?ct=fantasy\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1\", \"waiver_priority\": 9 }), ..., Team({...}) ] Returns: list[Team]: List of YFPY Team instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /teams\" , [ \"league\" , \"teams\" ] ) get_league_players \u00b6 get_league_players ( player_count_limit = None , player_count_start = 0 , is_retry = False , ) Retrieve valid players for chosen league. Parameters: player_count_limit ( int , default: None ) \u2013 Maximum number of players to retreive. player_count_start ( int , default: 0 ) \u2013 Index from which to retrieve all subsequent players. is_retry ( bool , default: False ) \u2013 Boolean to indicate whether the method is being retried during error handling. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_league_players ( 50 , 25 ) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"K\", \"editorial_player_key\": \"nfl.p.3727\", \"editorial_team_abbr\": \"Ind\", \"editorial_team_full_name\": \"Indianapolis Colts\", \"editorial_team_key\": \"nfl.t.11\", \"eligible_positions\": { \"position\": \"K\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/OpHvpCHjl_PQvkeQUgsjsA--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt 3PTQ2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08152019/3727.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Adam\", \"ascii_last\": \"Vinatieri\", \"first\": \"Adam\", \"full\": \"Adam Vinatieri\", \"last\": \"Vinatieri\" }, \"player_id\": \"3727\", \"player_key\": \"331.p.3727\", \"player_notes_last_timestamp\": 1568758320, \"position_type\": \"K\", \"primary_position\": \"K\", \"uniform_number\": \"4\" }), ..., Player({...}) ] Returns: List [ Player ] \u2013 list[Player]: List of YFPY Player instances. Source code in yfpy/query.py 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 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 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 def get_league_players ( self , player_count_limit : int = None , player_count_start : int = 0 , is_retry : bool = False ) -> List [ Player ]: \"\"\"Retrieve valid players for chosen league. Args: player_count_limit (int): Maximum number of players to retreive. player_count_start (int): Index from which to retrieve all subsequent players. is_retry (bool): Boolean to indicate whether the method is being retried during error handling. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_players(50, 25) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"K\", \"editorial_player_key\": \"nfl.p.3727\", \"editorial_team_abbr\": \"Ind\", \"editorial_team_full_name\": \"Indianapolis Colts\", \"editorial_team_key\": \"nfl.t.11\", \"eligible_positions\": { \"position\": \"K\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/OpHvpCHjl_PQvkeQUgsjsA--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt 3PTQ2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08152019/3727.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Adam\", \"ascii_last\": \"Vinatieri\", \"first\": \"Adam\", \"full\": \"Adam Vinatieri\", \"last\": \"Vinatieri\" }, \"player_id\": \"3727\", \"player_key\": \"331.p.3727\", \"player_notes_last_timestamp\": 1568758320, \"position_type\": \"K\", \"primary_position\": \"K\", \"uniform_number\": \"4\" }), ..., Player({...}) ] Returns: list[Player]: List of YFPY Player instances. \"\"\" league_player_count = player_count_start all_players_retrieved = False league_player_data = [] league_player_retrieval_limit = 25 while not all_players_retrieved : try : league_player_query_data = self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"start= { league_player_count } ;count= { league_player_retrieval_limit if not is_retry else 1 } \" , [ \"league\" , \"players\" ] ) league_players = ( league_player_query_data if isinstance ( league_player_query_data , list ) else [ league_player_query_data ]) league_player_count_from_query = len ( league_players ) if player_count_limit : if ( league_player_count + league_player_count_from_query ) < player_count_limit : league_player_count += league_player_count_from_query league_player_data . extend ( league_players ) else : for ndx in range ( player_count_limit - league_player_count ): league_player_data . append ( league_players [ ndx ]) league_player_count += ( player_count_limit - league_player_count ) all_players_retrieved = True else : league_player_count += league_player_count_from_query league_player_data . extend ( league_players ) except YahooFantasySportsDataNotFound as yfpy_err : if not is_retry : payload = yfpy_err . payload if payload : logger . debug ( \"No more league player data available.\" ) all_players_retrieved = True else : logger . warning ( f \"Error retrieving player batch: \" f \" { league_player_count } - { league_player_count + league_player_retrieval_limit - 1 } . \" f \"Attempting to retrieve individual players from batch.\" ) player_retrieval_successes = [] player_retrieval_failures = [] for i in range ( 25 ): try : player_data = self . get_league_players ( player_count_limit = league_player_count + 1 , player_count_start = league_player_count , is_retry = True ) player_retrieval_successes . extend ( player_data ) except YahooFantasySportsDataNotFound as nested_yfpy_err : player_retrieval_failures . append ( { \"failed_player_retrieval_index\" : league_player_count , \"failed_player_retrieval_url\" : nested_yfpy_err . url , \"failed_player_retrieval_message\" : nested_yfpy_err . message } ) league_player_count += 1 league_player_data . extend ( player_retrieval_successes ) logger . warning ( f \"Players retrieval failures: \\n { prettify_data ( player_retrieval_failures ) } \" ) else : raise yfpy_err logger . debug ( f \"League player count: { league_player_count } \" ) return league_player_data get_league_draft_results \u00b6 get_league_draft_results () Retrieve draft results for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_league_draft_results () [ DraftResult({ \"pick\": 1, \"round\": 1, \"team_key\": \"331.l.729259.t.4\", \"player_key\": \"331.p.9317\" }), ..., DraftResult({...}) ] Returns: List [ DraftResult ] \u2013 list[DraftResult]: List of YFPY DraftResult instances. Source code in yfpy/query.py 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 def get_league_draft_results ( self ) -> List [ DraftResult ]: \"\"\"Retrieve draft results for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_draft_results() [ DraftResult({ \"pick\": 1, \"round\": 1, \"team_key\": \"331.l.729259.t.4\", \"player_key\": \"331.p.9317\" }), ..., DraftResult({...}) ] Returns: list[DraftResult]: List of YFPY DraftResult instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /draftresults\" , [ \"league\" , \"draft_results\" ] ) get_league_transactions \u00b6 get_league_transactions () Retrieve transactions for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_league_transactions () [ Transaction({ \"players\": [ { \"player\": { \"display_position\": \"RB\", \"editorial_team_abbr\": \"NO\", \"name\": { \"ascii_first\": \"Kerwynn\", \"ascii_last\": \"Williams\", \"first\": \"Kerwynn\", \"full\": \"Kerwynn Williams\", \"last\": \"Williams\" }, \"player_id\": \"26853\", \"player_key\": \"331.p.26853\", \"position_type\": \"O\", \"transaction_data\": { \"destination_team_key\": \"331.l.729259.t.1\", \"destination_team_name\": \"Hellacious Hill 12\", \"destination_type\": \"team\", \"source_type\": \"freeagents\", \"type\": \"add\" } } } ], \"status\": \"successful\", \"timestamp\": \"1419188151\", \"transaction_id\": \"282\", \"transaction_key\": \"331.l.729259.tr.282\", \"type\": \"add/drop\" }), ..., Transaction({...}) ] Returns: List [ Transaction ] \u2013 list[Transaction]: List of YFPY Transaction instances. Source code in yfpy/query.py 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 def get_league_transactions ( self ) -> List [ Transaction ]: \"\"\"Retrieve transactions for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_transactions() [ Transaction({ \"players\": [ { \"player\": { \"display_position\": \"RB\", \"editorial_team_abbr\": \"NO\", \"name\": { \"ascii_first\": \"Kerwynn\", \"ascii_last\": \"Williams\", \"first\": \"Kerwynn\", \"full\": \"Kerwynn Williams\", \"last\": \"Williams\" }, \"player_id\": \"26853\", \"player_key\": \"331.p.26853\", \"position_type\": \"O\", \"transaction_data\": { \"destination_team_key\": \"331.l.729259.t.1\", \"destination_team_name\": \"Hellacious Hill 12\", \"destination_type\": \"team\", \"source_type\": \"freeagents\", \"type\": \"add\" } } } ], \"status\": \"successful\", \"timestamp\": \"1419188151\", \"transaction_id\": \"282\", \"transaction_key\": \"331.l.729259.tr.282\", \"type\": \"add/drop\" }), ..., Transaction({...}) ] Returns: list[Transaction]: List of YFPY Transaction instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /transactions\" , [ \"league\" , \"transactions\" ] ) get_league_scoreboard_by_week \u00b6 get_league_scoreboard_by_week ( chosen_week ) Retrieve scoreboard for chosen league by week. Parameters: chosen_week ( int ) \u2013 Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_league_scoreboard_by_week ( 1 ) Scoreboard({ \"week\": \"1\", \"matchups\": [ { \"matchup\": { \"is_consolation\": \"0\", \"is_matchup_recap_available\": 1, \"is_playoffs\": \"0\", \"is_tied\": 0, \"matchup_grades\": [ { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.1\" } }, { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.2\" } } ], \"matchup_recap_title\": \"Wax On Wax Off Gets Victory Against Hellacious Hill 12\", \"matchup_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/recap? week=1&mid1=1&mid2=2\", \"status\": \"postevent\", \"teams\": [ { \"team\": { } }, { \"team\": { } } ], \"week\": \"1\", \"week_end\": \"2014-09-08\", \"week_start\": \"2014-09-04\", \"winner_team_key\": \"331.l.729259.t.2\" } }, ... ] }) Returns: Scoreboard ( Scoreboard ) \u2013 YFPY Scoreboard instance. Source code in yfpy/query.py 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 def get_league_scoreboard_by_week ( self , chosen_week : int ) -> Scoreboard : \"\"\"Retrieve scoreboard for chosen league by week. Args: chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_scoreboard_by_week(1) Scoreboard({ \"week\": \"1\", \"matchups\": [ { \"matchup\": { \"is_consolation\": \"0\", \"is_matchup_recap_available\": 1, \"is_playoffs\": \"0\", \"is_tied\": 0, \"matchup_grades\": [ { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.1\" } }, { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.2\" } } ], \"matchup_recap_title\": \"Wax On Wax Off Gets Victory Against Hellacious Hill 12\", \"matchup_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/recap? week=1&mid1=1&mid2=2\", \"status\": \"postevent\", \"teams\": [ { \"team\": { } }, { \"team\": { } } ], \"week\": \"1\", \"week_end\": \"2014-09-08\", \"week_start\": \"2014-09-04\", \"winner_team_key\": \"331.l.729259.t.2\" } }, ... ] }) Returns: Scoreboard: YFPY Scoreboard instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /scoreboard;\" f \"week= { chosen_week } \" , [ \"league\" , \"scoreboard\" ], Scoreboard ) get_league_matchups_by_week \u00b6 get_league_matchups_by_week ( chosen_week ) Retrieve matchups for chosen league by week. Parameters: chosen_week ( int ) \u2013 Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_league_matchups_by_week ( 1 ) [ Matchup({ \"is_consolation\": \"0\", \"is_matchup_recap_available\": 1, \"is_playoffs\": \"0\", \"is_tied\": 0, \"matchup_grades\": [ { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.1\" } }, { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.2\" } } ], \"matchup_recap_title\": \"Wax On Wax Off Gets Victory Against Hellacious Hill 12\", \"matchup_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/recap? week=1&mid1=1&mid2=2\", \"status\": \"postevent\", \"teams\": [ { \"team\": { } }, { \"team\": { } } ], \"week\": \"1\", \"week_end\": \"2014-09-08\", \"week_start\": \"2014-09-04\", \"winner_team_key\": \"331.l.729259.t.2\" }), ..., Matchup({...}) ] Returns: List [ Matchup ] \u2013 list[Matchup]: List of YFPY Matchup instances. Source code in yfpy/query.py 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 def get_league_matchups_by_week ( self , chosen_week : int ) -> List [ Matchup ]: \"\"\"Retrieve matchups for chosen league by week. Args: chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_matchups_by_week(1) [ Matchup({ \"is_consolation\": \"0\", \"is_matchup_recap_available\": 1, \"is_playoffs\": \"0\", \"is_tied\": 0, \"matchup_grades\": [ { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.1\" } }, { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.2\" } } ], \"matchup_recap_title\": \"Wax On Wax Off Gets Victory Against Hellacious Hill 12\", \"matchup_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/recap? week=1&mid1=1&mid2=2\", \"status\": \"postevent\", \"teams\": [ { \"team\": { } }, { \"team\": { } } ], \"week\": \"1\", \"week_end\": \"2014-09-08\", \"week_start\": \"2014-09-04\", \"winner_team_key\": \"331.l.729259.t.2\" }), ..., Matchup({...}) ] Returns: list[Matchup]: List of YFPY Matchup instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /scoreboard;\" f \"week= { chosen_week } \" , [ \"league\" , \"scoreboard\" , \"0\" , \"matchups\" ] ) get_team_info \u00b6 get_team_info ( team_id ) Retrieve info of specific team by team_id for chosen league. Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_team_info ( 1 ) Team({ \"clinched_playoffs\": 1, \"draft_grade\": \"B\", \"draft_position\": 4, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1/draftrecap\", \"draft_results\": [ ... ], \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"BMACD7S5UXV7JIQX4PGGUVQJAU\", \"manager_id\": \"1\", \"nickname\": \"--hidden--\" } }, \"matchups\": [ ... ], \"name\": \"Hellacious Hill 12\", \"number_of_moves\": \"71\", \"number_of_trades\": 0, \"roster\": { ... }, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"1\", \"team_key\": \"331.l.729259.t.1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1441/24935131299_a8242dab70_192sq.jpg?ct=fantasy\" } }, \"team_points\": { \"coverage_type\": \"season\", \"season\": \"2014\", \"total\": \"1409.24\" }, \"team_standings\": { \"outcome_totals\": { \"losses\": 5, \"percentage\": 0.643, \"ties\": 0, \"wins\": 9 }, \"playoff_seed\": \"2\", \"points_against\": 1266.6599999999999, \"points_for\": 1409.24, \"rank\": 2, \"streak\": { \"type\": \"win\", \"value\": \"1\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1\", \"waiver_priority\": 9 }) Returns: Team ( Team ) \u2013 YFPY Team instance. Source code in yfpy/query.py 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 def get_team_info ( self , team_id : Union [ str , int ]) -> Team : \"\"\"Retrieve info of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_info(1) Team({ \"clinched_playoffs\": 1, \"draft_grade\": \"B\", \"draft_position\": 4, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1/draftrecap\", \"draft_results\": [ ... ], \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"BMACD7S5UXV7JIQX4PGGUVQJAU\", \"manager_id\": \"1\", \"nickname\": \"--hidden--\" } }, \"matchups\": [ ... ], \"name\": \"Hellacious Hill 12\", \"number_of_moves\": \"71\", \"number_of_trades\": 0, \"roster\": { ... }, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"1\", \"team_key\": \"331.l.729259.t.1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1441/24935131299_a8242dab70_192sq.jpg?ct=fantasy\" } }, \"team_points\": { \"coverage_type\": \"season\", \"season\": \"2014\", \"total\": \"1409.24\" }, \"team_standings\": { \"outcome_totals\": { \"losses\": 5, \"percentage\": 0.643, \"ties\": 0, \"wins\": 9 }, \"playoff_seed\": \"2\", \"points_against\": 1266.6599999999999, \"points_for\": 1409.24, \"rank\": 2, \"streak\": { \"type\": \"win\", \"value\": \"1\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1\", \"waiver_priority\": 9 }) Returns: Team: YFPY Team instance. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } ;\" f \"out=metadata,stats,standings,roster,draftresults,matchups\" , [ \"team\" ], Team ) get_team_metadata \u00b6 get_team_metadata ( team_id ) Retrieve metadata of specific team by team_id for chosen league. Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_team_metadata ( 1 ) Team({ \"team_key\": \"331.l.729259.t.1\", \"team_id\": \"1\", \"name\": \"Hellacious Hill 12\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1441/24935131299_a8242dab70_192sq.jpg?ct=fantasy\" } }, \"waiver_priority\": 9, \"number_of_moves\": \"71\", \"number_of_trades\": 0, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"clinched_playoffs\": 1, \"league_scoring_type\": \"head\", \"draft_position\": 4, \"has_draft_grade\": 1, \"draft_grade\": \"B\", \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1/draftrecap\", \"managers\": { \"manager\": { \"guid\": \"BMACD7S5UXV7JIQX4PGGUVQJAU\", \"manager_id\": \"1\", \"nickname\": \"--hidden--\" } } }) Returns: Team ( Team ) \u2013 YFPY Team instance. Source code in yfpy/query.py 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 def get_team_metadata ( self , team_id : Union [ str , int ]) -> Team : \"\"\"Retrieve metadata of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_metadata(1) Team({ \"team_key\": \"331.l.729259.t.1\", \"team_id\": \"1\", \"name\": \"Hellacious Hill 12\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1441/24935131299_a8242dab70_192sq.jpg?ct=fantasy\" } }, \"waiver_priority\": 9, \"number_of_moves\": \"71\", \"number_of_trades\": 0, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"clinched_playoffs\": 1, \"league_scoring_type\": \"head\", \"draft_position\": 4, \"has_draft_grade\": 1, \"draft_grade\": \"B\", \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1/draftrecap\", \"managers\": { \"manager\": { \"guid\": \"BMACD7S5UXV7JIQX4PGGUVQJAU\", \"manager_id\": \"1\", \"nickname\": \"--hidden--\" } } }) Returns: Team: YFPY Team instance. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /metadata\" , [ \"team\" ], Team ) get_team_stats \u00b6 get_team_stats ( team_id ) Retrieve stats of specific team by team_id for chosen league. Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_team_stats ( 1 ) TeamPoints({ \"coverage_type\": \"season\", \"season\": \"2014\", \"total\": \"1409.24\" }) Returns: TeamPoints ( TeamPoints ) \u2013 YFPY TeamPoints instance. Source code in yfpy/query.py 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 def get_team_stats ( self , team_id : Union [ str , int ]) -> TeamPoints : \"\"\"Retrieve stats of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_stats(1) TeamPoints({ \"coverage_type\": \"season\", \"season\": \"2014\", \"total\": \"1409.24\" }) Returns: TeamPoints: YFPY TeamPoints instance. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /stats\" , [ \"team\" , \"team_points\" ], TeamPoints ) get_team_stats_by_week \u00b6 get_team_stats_by_week ( team_id , chosen_week = 'current' ) Retrieve stats of specific team by team_id and by week for chosen league. Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week ( int , default: 'current' ) \u2013 Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_team_stats_by_week ( 1 , 1 ) { \"team_points\": TeamPoints({ \"coverage_type\": \"week\", \"total\": \"95.06\", \"week\": \"1\" }), \"team_projected_points\": TeamProjectedPoints({ \"coverage_type\": \"week\", \"total\": \"78.85\", \"week\": \"1\" }) } Returns: Dict [ str , Union [ TeamPoints , TeamProjectedPoints ]] \u2013 dict[str, TeamPoints | TeamProjectedPoints]: Dictionary containing keys \"team_points\" and \"team_projected_points\" with respective values YFPY TeamPoints and YFPY TeamProjectedPoints instances. Source code in yfpy/query.py 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 def get_team_stats_by_week ( self , team_id : Union [ str , int ], chosen_week : Union [ int , str ] = \"current\" ) -> Dict [ str , Union [ TeamPoints , TeamProjectedPoints ]]: \"\"\"Retrieve stats of specific team by team_id and by week for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_stats_by_week(1, 1) { \"team_points\": TeamPoints({ \"coverage_type\": \"week\", \"total\": \"95.06\", \"week\": \"1\" }), \"team_projected_points\": TeamProjectedPoints({ \"coverage_type\": \"week\", \"total\": \"78.85\", \"week\": \"1\" }) } Returns: dict[str, TeamPoints | TeamProjectedPoints]: Dictionary containing keys \"team_points\" and \"team_projected_points\" with respective values YFPY TeamPoints and YFPY TeamProjectedPoints instances. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /stats;type=week;week= { chosen_week } \" , [ \"team\" , [ \"team_points\" , \"team_projected_points\" ]] ) get_team_standings \u00b6 get_team_standings ( team_id ) Retrieve standings of specific team by team_id for chosen league. Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_team_standings ( 1 ) TeamStandings({ \"rank\": 2, \"playoff_seed\": \"2\", \"outcome_totals\": { \"losses\": 5, \"percentage\": 0.643, \"ties\": 0, \"wins\": 9 }, \"streak\": { \"type\": \"win\", \"value\": \"1\" }, \"points_for\": \"1409.24\", \"points_against\": 1266.6599999999999 }) Returns: TeamStandings ( TeamStandings ) \u2013 YFPY TeamStandings instance. Source code in yfpy/query.py 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 def get_team_standings ( self , team_id : Union [ str , int ]) -> TeamStandings : \"\"\"Retrieve standings of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_standings(1) TeamStandings({ \"rank\": 2, \"playoff_seed\": \"2\", \"outcome_totals\": { \"losses\": 5, \"percentage\": 0.643, \"ties\": 0, \"wins\": 9 }, \"streak\": { \"type\": \"win\", \"value\": \"1\" }, \"points_for\": \"1409.24\", \"points_against\": 1266.6599999999999 }) Returns: TeamStandings: YFPY TeamStandings instance. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /standings\" , [ \"team\" , \"team_standings\" ], TeamStandings ) get_team_roster_by_week \u00b6 get_team_roster_by_week ( team_id , chosen_week = 'current' ) Retrieve roster of specific team by team_id and by week for chosen league. Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week ( int , default: 'current' ) \u2013 Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_team_roster_by_week ( 1 , 1 ) Roster({ \"coverage_type\": \"week\", \"week\": \"1\", \"is_editable\": 0, \"players\": [ { \"player\": { \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt 3PTQ2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"1\" }, \"uniform_number\": \"12\" } }, ... ] }) Returns: Roster ( Roster ) \u2013 YFPY Roster instance. Source code in yfpy/query.py 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 def get_team_roster_by_week ( self , team_id : Union [ str , int ], chosen_week : Union [ int , str ] = \"current\" ) -> Roster : \"\"\"Retrieve roster of specific team by team_id and by week for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_roster_by_week(1, 1) Roster({ \"coverage_type\": \"week\", \"week\": \"1\", \"is_editable\": 0, \"players\": [ { \"player\": { \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt 3PTQ2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"1\" }, \"uniform_number\": \"12\" } }, ... ] }) Returns: Roster: YFPY Roster instance. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /roster;week= { chosen_week } \" , [ \"team\" , \"roster\" ], Roster ) get_team_roster_player_info_by_week \u00b6 get_team_roster_player_info_by_week ( team_id , chosen_week = \"current\" ) Retrieve roster with ALL player info of specific team by team_id and by week for chosen league. Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week ( int , default: 'current' ) \u2013 Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_team_roster_player_info_by_week ( 1 , 1 ) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"draft_analysis\": { \"average_pick\": \"65.9\", \"average_round\": \"7.6\", \"average_cost\": \"5.0\", \"percent_drafted\": \"1.00\" }, \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/ https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"ownership\": { \"ownership_type\": \"team\", \"owner_team_key\": \"331.l.729259.t.1\", \"owner_team_name\": \"Hellacious Hill 12\" }, \"percent_owned\": { \"coverage_type\": \"week\", \"week\": \"17\", \"value\": 99, \"delta\": \"0\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"player_points\": { \"coverage_type\": \"week\", \"week\": \"1\", \"total\": 10.26 }, \"player_stats\": { \"coverage_type\": \"week\", \"week\": \"1\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"249\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"1\" }, \"uniform_number\": \"12\" }), ..., Player({...}) ] Returns: List [ Player ] \u2013 list[Player]: List of YFPY Player instances containing attributes \"draft_analysis\", \"ownership\", \"percent_owned\", and \"player_stats\". Source code in yfpy/query.py 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 def get_team_roster_player_info_by_week ( self , team_id : Union [ str , int ], chosen_week : Union [ int , str ] = \"current\" ) -> List [ Player ]: \"\"\"Retrieve roster with ALL player info of specific team by team_id and by week for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_roster_player_info_by_week(1, 1) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"draft_analysis\": { \"average_pick\": \"65.9\", \"average_round\": \"7.6\", \"average_cost\": \"5.0\", \"percent_drafted\": \"1.00\" }, \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/ https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"ownership\": { \"ownership_type\": \"team\", \"owner_team_key\": \"331.l.729259.t.1\", \"owner_team_name\": \"Hellacious Hill 12\" }, \"percent_owned\": { \"coverage_type\": \"week\", \"week\": \"17\", \"value\": 99, \"delta\": \"0\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"player_points\": { \"coverage_type\": \"week\", \"week\": \"1\", \"total\": 10.26 }, \"player_stats\": { \"coverage_type\": \"week\", \"week\": \"1\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"249\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"1\" }, \"uniform_number\": \"12\" }), ..., Player({...}) ] Returns: list[Player]: List of YFPY Player instances containing attributes \"draft_analysis\", \"ownership\", \"percent_owned\", and \"player_stats\". \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /roster;week= { chosen_week } /players;\" f \"out=metadata,stats,ownership,percent_owned,draft_analysis\" , [ \"team\" , \"roster\" , \"0\" , \"players\" ] ) get_team_roster_player_info_by_date \u00b6 get_team_roster_player_info_by_date ( team_id , chosen_date = None ) Retrieve roster with ALL player info of specific team by team_id and by date for chosen league. Note This applies to MLB, NBA, and NHL leagues, but does NOT apply to NFL leagues. This query will FAIL if you pass it an INVALID date string! Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_date ( str , default: None ) \u2013 Selected date for which to retrieve data. REQUIRED FORMAT: YYYY-MM-DD (Ex. 2011-05-01) Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nhl\" ) >>> query . get_team_roster_player_info_by_date ( 1 , \"2011-05-01\" ) [ Player({ \"display_position\": \"C\", \"draft_analysis\": { \"average_pick\": 33.2, \"average_round\": 3.5, \"average_cost\": 39.2, \"percent_drafted\": 1.0 }, \"editorial_player_key\": \"nhl.p.3981\", \"editorial_team_abbr\": \"Chi\", \"editorial_team_full_name\": \"Chicago Blackhawks\", \"editorial_team_key\": \"nhl.t.4\", \"eligible_positions\": [ \"C\", \"F\" ], \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/tz.KOMoEiBDch6AJAGaUtg--~C/ YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/ https://s.yimg.com/xe/i/us/sp/v/nhl_cutout/players_l/11032021/3981.png\" }, \"is_editable\": 0, \"is_undroppable\": 0, \"name\": { \"ascii_first\": \"Jonathan\", \"ascii_last\": \"Toews\", \"first\": \"Jonathan\", \"full\": \"Jonathan Toews\", \"last\": \"Toews\" }, \"ownership\": { \"ownership_type\": \"team\", \"owner_team_key\": \"303.l.69624.t.2\", \"owner_team_name\": \"The Bateleurs\" }, \"percent_owned\": { \"coverage_type\": \"week\", \"week\": 25, \"value\": 98, \"delta\": -1.0 }, \"player_id\": 3981, \"player_key\": \"303.p.3981\", \"player_notes_last_timestamp\": 1651606838, \"player_stats\": { \"coverage_type\": \"date\", \"stats\": [ { \"stat\": { \"stat_id\": 1, \"value\": 1.0 } }, ... ] }, \"position_type\": \"P\", \"primary_position\": \"C\", \"selected_position\": { \"coverage_type\": \"date\", \"is_flex\": 0, \"position\": \"C\" }, \"uniform_number\": 19 }), ..., Player({...}) ] Returns: List [ Player ] \u2013 list[Player]: List of YFPY Player instances containing attributes \"draft_analysis\", \"ownership\", \"percent_owned\", and \"player_stats\". Source code in yfpy/query.py 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 def get_team_roster_player_info_by_date ( self , team_id : Union [ str , int ], chosen_date : str = None ) -> List [ Player ]: \"\"\"Retrieve roster with ALL player info of specific team by team_id and by date for chosen league. Note: This applies to MLB, NBA, and NHL leagues, but does NOT apply to NFL leagues. This query will FAIL if you pass it an INVALID date string! Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_date (str): Selected date for which to retrieve data. REQUIRED FORMAT: YYYY-MM-DD (Ex. 2011-05-01) Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nhl\") >>> query.get_team_roster_player_info_by_date(1, \"2011-05-01\") [ Player({ \"display_position\": \"C\", \"draft_analysis\": { \"average_pick\": 33.2, \"average_round\": 3.5, \"average_cost\": 39.2, \"percent_drafted\": 1.0 }, \"editorial_player_key\": \"nhl.p.3981\", \"editorial_team_abbr\": \"Chi\", \"editorial_team_full_name\": \"Chicago Blackhawks\", \"editorial_team_key\": \"nhl.t.4\", \"eligible_positions\": [ \"C\", \"F\" ], \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/tz.KOMoEiBDch6AJAGaUtg--~C/ YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/ https://s.yimg.com/xe/i/us/sp/v/nhl_cutout/players_l/11032021/3981.png\" }, \"is_editable\": 0, \"is_undroppable\": 0, \"name\": { \"ascii_first\": \"Jonathan\", \"ascii_last\": \"Toews\", \"first\": \"Jonathan\", \"full\": \"Jonathan Toews\", \"last\": \"Toews\" }, \"ownership\": { \"ownership_type\": \"team\", \"owner_team_key\": \"303.l.69624.t.2\", \"owner_team_name\": \"The Bateleurs\" }, \"percent_owned\": { \"coverage_type\": \"week\", \"week\": 25, \"value\": 98, \"delta\": -1.0 }, \"player_id\": 3981, \"player_key\": \"303.p.3981\", \"player_notes_last_timestamp\": 1651606838, \"player_stats\": { \"coverage_type\": \"date\", \"stats\": [ { \"stat\": { \"stat_id\": 1, \"value\": 1.0 } }, ... ] }, \"position_type\": \"P\", \"primary_position\": \"C\", \"selected_position\": { \"coverage_type\": \"date\", \"is_flex\": 0, \"position\": \"C\" }, \"uniform_number\": 19 }), ..., Player({...}) ] Returns: list[Player]: List of YFPY Player instances containing attributes \"draft_analysis\", \"ownership\", \"percent_owned\", and \"player_stats\". \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /\" f \"roster { ';date=' + str ( chosen_date ) if chosen_date else '' } /players;\" f \"out=metadata,stats,ownership,percent_owned,draft_analysis\" , [ \"team\" , \"roster\" , \"0\" , \"players\" ] ) get_team_roster_player_stats \u00b6 get_team_roster_player_stats ( team_id ) Retrieve roster with ALL player info for the season of specific team by team_id and for chosen league. Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_team_roster_player_stats ( 1 ) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"draft_analysis\": { \"average_pick\": \"65.9\", \"average_round\": \"7.6\", \"average_cost\": \"5.0\", \"percent_drafted\": \"1.00\" }, \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"player_points\": { \"coverage_type\": \"season\", \"total\": 287.06 }, \"player_stats\": { \"coverage_type\": \"season\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"4109\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"16\" }, \"uniform_number\": \"12\" }), ..., Player({...}) ] Returns: List [ Player ] \u2013 list[Player]: List of YFPY Player instances containing attributes \"draft_analysis\", \"ownership\", \"percent_owned\", and \"player_stats\". Source code in yfpy/query.py 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 def get_team_roster_player_stats ( self , team_id : Union [ str , int ]) -> List [ Player ]: \"\"\"Retrieve roster with ALL player info for the season of specific team by team_id and for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_roster_player_stats(1) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"draft_analysis\": { \"average_pick\": \"65.9\", \"average_round\": \"7.6\", \"average_cost\": \"5.0\", \"percent_drafted\": \"1.00\" }, \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"player_points\": { \"coverage_type\": \"season\", \"total\": 287.06 }, \"player_stats\": { \"coverage_type\": \"season\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"4109\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"16\" }, \"uniform_number\": \"12\" }), ..., Player({...}) ] Returns: list[Player]: List of YFPY Player instances containing attributes \"draft_analysis\", \"ownership\", \"percent_owned\", and \"player_stats\". \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /roster/players/stats;type=season\" , [ \"team\" , \"roster\" , \"0\" , \"players\" ] ) get_team_roster_player_stats_by_week \u00b6 get_team_roster_player_stats_by_week ( team_id , chosen_week = \"current\" ) Retrieve roster with player stats of specific team by team_id and by week for chosen league. Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week ( int , default: 'current' ) \u2013 Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_team_roster_player_stats_by_week ( 1 , 1 ) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt 3PTQ2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"player_points\": { \"coverage_type\": \"week\", \"week\": \"1\", \"total\": 10.26 }, \"player_stats\": { \"coverage_type\": \"week\", \"week\": \"1\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"249\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"1\" }, \"uniform_number\": \"12\" }), ..., Player({...}) ] Returns: List [ Player ] \u2013 list[Player]: List of YFPY Player instances containing attribute \"player_stats\". Source code in yfpy/query.py 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 def get_team_roster_player_stats_by_week ( self , team_id : Union [ str , int ], chosen_week : Union [ int , str ] = \"current\" ) -> List [ Player ]: \"\"\"Retrieve roster with player stats of specific team by team_id and by week for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_roster_player_stats_by_week(1, 1) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt 3PTQ2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"player_points\": { \"coverage_type\": \"week\", \"week\": \"1\", \"total\": 10.26 }, \"player_stats\": { \"coverage_type\": \"week\", \"week\": \"1\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"249\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"1\" }, \"uniform_number\": \"12\" }), ..., Player({...}) ] Returns: list[Player]: List of YFPY Player instances containing attribute \"player_stats\". \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /roster;week= { chosen_week } /players/stats\" , [ \"team\" , \"roster\" , \"0\" , \"players\" ] ) get_team_draft_results \u00b6 get_team_draft_results ( team_id ) Retrieve draft results of specific team by team_id for chosen league. Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_team_draft_results ( 1 ) [ DraftResult({ \"pick\": 4, \"round\": 1, \"team_key\": \"331.l.729259.t.1\", \"player_key\": \"331.p.8256\" }), ..., DraftResults({...}) ] Returns: List [ DraftResult ] \u2013 list[DraftResult]: List of YFPY DraftResult instances. Source code in yfpy/query.py 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 def get_team_draft_results ( self , team_id : Union [ str , int ]) -> List [ DraftResult ]: \"\"\"Retrieve draft results of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_draft_results(1) [ DraftResult({ \"pick\": 4, \"round\": 1, \"team_key\": \"331.l.729259.t.1\", \"player_key\": \"331.p.8256\" }), ..., DraftResults({...}) ] Returns: list[DraftResult]: List of YFPY DraftResult instances. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /draftresults\" , [ \"team\" , \"draft_results\" ] ) get_team_matchups \u00b6 get_team_matchups ( team_id ) Retrieve matchups of specific team by team_id for chosen league. Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_team_matchups ( 1 ) [ Matchup({ (see get_league_matchups_by_week docstring for matchup data example) }) ] Returns: List [ Matchup ] \u2013 list[Matchup]: List of YFPY Matchup instances. Source code in yfpy/query.py 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 def get_team_matchups ( self , team_id : Union [ str , int ]) -> List [ Matchup ]: \"\"\"Retrieve matchups of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_matchups(1) [ Matchup({ (see get_league_matchups_by_week docstring for matchup data example) }) ] Returns: list[Matchup]: List of YFPY Matchup instances. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /matchups\" , [ \"team\" , \"matchups\" ] ) get_player_stats_for_season \u00b6 get_player_stats_for_season ( player_key , limit_to_league_stats = True ) Retrieve stats of specific player by player_key for the entire season for chosen league. Parameters: player_key ( str ) \u2013 The player key of chosen player (example: 331.p.7200 - .p. ). limit_to_league_stats ( bool , default: True ) \u2013 Boolean (default: True) to limit the retrieved player stats to those for the selected league. When set to False, query retrieves all player stats for the game (NFL, NHL, NBA, MLB). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_player_stats_for_season ( \"331.p.7200\" ) Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"player_points\": { \"coverage_type\": \"season\", \"total\": 359.14 }, \"player_stats\": { \"coverage_type\": \"season\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"4381\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player ( Player ) \u2013 YFPY Player instance. Source code in yfpy/query.py 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 def get_player_stats_for_season ( self , player_key : str , limit_to_league_stats : bool = True ) -> Player : \"\"\"Retrieve stats of specific player by player_key for the entire season for chosen league. Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). limit_to_league_stats (bool): Boolean (default: True) to limit the retrieved player stats to those for the selected league. When set to False, query retrieves all player stats for the game (NFL, NHL, NBA, MLB). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_player_stats_for_season(\"331.p.7200\") Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"player_points\": { \"coverage_type\": \"season\", \"total\": 359.14 }, \"player_stats\": { \"coverage_type\": \"season\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"4381\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player: YFPY Player instance. \"\"\" if limit_to_league_stats : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /stats\" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player ) else : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/players;\" f \"player_keys= { player_key } /stats\" , [ \"players\" , \"0\" , \"player\" ], Player ) get_player_stats_by_week \u00b6 get_player_stats_by_week ( player_key , chosen_week = \"current\" , limit_to_league_stats = True , ) Retrieve stats of specific player by player_key and by week for chosen league. Parameters: player_key ( str ) \u2013 The player key of chosen player (example: 331.p.7200 - .p. ). chosen_week ( int , default: 'current' ) \u2013 Selected week for which to retrieve data. limit_to_league_stats ( bool , default: True ) \u2013 Boolean (default: True) to limit the retrieved player stats to those for the selected league. When set to False, query retrieves all player stats for the game (NFL, NHL, NBA, MLB). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_player_stats_by_week ( \"331.p.7200\" , 1 ) Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"player_points\": { \"coverage_type\": \"week\", \"week\": \"1\", \"total\": 10.56 }, \"player_stats\": { \"coverage_type\": \"week\", \"week\": \"1\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"189\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player ( Player ) \u2013 YFPY Player instance containing attribute \"player_stats\". Source code in yfpy/query.py 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 def get_player_stats_by_week ( self , player_key : str , chosen_week : Union [ int , str ] = \"current\" , limit_to_league_stats : bool = True ) -> Player : \"\"\"Retrieve stats of specific player by player_key and by week for chosen league. Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). chosen_week (int): Selected week for which to retrieve data. limit_to_league_stats (bool): Boolean (default: True) to limit the retrieved player stats to those for the selected league. When set to False, query retrieves all player stats for the game (NFL, NHL, NBA, MLB). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_player_stats_by_week(\"331.p.7200\", 1) Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"player_points\": { \"coverage_type\": \"week\", \"week\": \"1\", \"total\": 10.56 }, \"player_stats\": { \"coverage_type\": \"week\", \"week\": \"1\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"189\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player: YFPY Player instance containing attribute \"player_stats\". \"\"\" if limit_to_league_stats : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /stats;type=week;week= { chosen_week } \" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player ) else : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/players;\" f \"player_keys= { player_key } /stats;type=week;week= { chosen_week } \" , [ \"players\" , \"0\" , \"player\" ], Player ) get_player_stats_by_date \u00b6 get_player_stats_by_date ( player_key , chosen_date = None , limit_to_league_stats = True ) Retrieve player stats by player_key and by date for chosen league. Note This applies to MLB, NBA, and NHL leagues, but does NOT apply to NFL leagues. This query will FAIL if you pass it an INVALID date string! Parameters: player_key ( str ) \u2013 The player key of chosen player (example: 331.p.7200 - .p. ). chosen_date ( str , default: None ) \u2013 Selected date for which to retrieve data. REQUIRED FORMAT: YYYY-MM-DD (Ex. 2011-05-01) limit_to_league_stats ( bool , default: True ) \u2013 Boolean (default: True) to limit the retrieved player stats to those for the selected league. When set to False, query retrieves all player stats for the game (NFL, NHL, NBA, MLB). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nhl\" ) >>> query . get_player_stats_by_date ( \"nhl.p.4588\" , \"2011-05-01\" ) Player({ \"display_position\": \"G\", \"editorial_player_key\": \"nhl.p.4588\", \"editorial_team_abbr\": \"Was\", \"editorial_team_full_name\": \"Washington Capitals\", \"editorial_team_key\": \"nhl.t.23\", \"eligible_positions\": { \"position\": \"G\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/CzntDh_d59voTqU6fhQy3g--~C/YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2 NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/https://s.yimg.com/ xe/i/us/sp/v/nhl_cutout/players_l/10182019/4588.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Braden\", \"ascii_last\": \"Holtby\", \"first\": \"Braden\", \"full\": \"Braden Holtby\", \"last\": \"Holtby\" }, \"player_id\": \"4588\", \"player_key\": \"303.p.4588\", \"player_notes_last_timestamp\": 1574133600, \"player_stats\": { \"coverage_type\": \"date\", \"stats\": [ { \"stat\": { \"stat_id\": \"19\", \"value\": \"1\" } }, { \"stat\": { \"stat_id\": \"22\", \"value\": \"1\" } }, { \"stat\": { \"stat_id\": \"23\", \"value\": \"1.00\" } }, { \"stat\": { \"stat_id\": \"25\", \"value\": \"29\" } }, { \"stat\": { \"stat_id\": \"24\", \"value\": \"30\" } }, { \"stat\": { \"stat_id\": \"26\", \"value\": \".967\" } }, { \"stat\": { \"stat_id\": \"27\", \"value\": \"0\" } } ] }, \"position_type\": \"G\", \"primary_position\": \"G\", \"uniform_number\": \"70\" }) Returns: Player ( Player ) \u2013 YFPY Player instnace containing attribute \"player_stats\". Source code in yfpy/query.py 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 def get_player_stats_by_date ( self , player_key : str , chosen_date : str = None , limit_to_league_stats : bool = True ) -> Player : \"\"\"Retrieve player stats by player_key and by date for chosen league. Note: This applies to MLB, NBA, and NHL leagues, but does NOT apply to NFL leagues. This query will FAIL if you pass it an INVALID date string! Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). chosen_date (str): Selected date for which to retrieve data. REQUIRED FORMAT: YYYY-MM-DD (Ex. 2011-05-01) limit_to_league_stats (bool): Boolean (default: True) to limit the retrieved player stats to those for the selected league. When set to False, query retrieves all player stats for the game (NFL, NHL, NBA, MLB). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nhl\") >>> query.get_player_stats_by_date(\"nhl.p.4588\", \"2011-05-01\") Player({ \"display_position\": \"G\", \"editorial_player_key\": \"nhl.p.4588\", \"editorial_team_abbr\": \"Was\", \"editorial_team_full_name\": \"Washington Capitals\", \"editorial_team_key\": \"nhl.t.23\", \"eligible_positions\": { \"position\": \"G\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/CzntDh_d59voTqU6fhQy3g--~C/YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2 NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/https://s.yimg.com/ xe/i/us/sp/v/nhl_cutout/players_l/10182019/4588.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Braden\", \"ascii_last\": \"Holtby\", \"first\": \"Braden\", \"full\": \"Braden Holtby\", \"last\": \"Holtby\" }, \"player_id\": \"4588\", \"player_key\": \"303.p.4588\", \"player_notes_last_timestamp\": 1574133600, \"player_stats\": { \"coverage_type\": \"date\", \"stats\": [ { \"stat\": { \"stat_id\": \"19\", \"value\": \"1\" } }, { \"stat\": { \"stat_id\": \"22\", \"value\": \"1\" } }, { \"stat\": { \"stat_id\": \"23\", \"value\": \"1.00\" } }, { \"stat\": { \"stat_id\": \"25\", \"value\": \"29\" } }, { \"stat\": { \"stat_id\": \"24\", \"value\": \"30\" } }, { \"stat\": { \"stat_id\": \"26\", \"value\": \".967\" } }, { \"stat\": { \"stat_id\": \"27\", \"value\": \"0\" } } ] }, \"position_type\": \"G\", \"primary_position\": \"G\", \"uniform_number\": \"70\" }) Returns: Player: YFPY Player instnace containing attribute \"player_stats\". \"\"\" if limit_to_league_stats : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /stats;type=date;date= { chosen_date } \" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player ) else : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/players;\" f \"player_keys= { player_key } /stats;type=date;date= { chosen_date } \" , [ \"players\" , \"0\" , \"player\" ], Player ) get_player_ownership \u00b6 get_player_ownership ( player_key ) Retrieve ownership of specific player by player_key for chosen league. Parameters: player_key ( str ) \u2013 The player key of chosen player (example: 331.p.7200 - .p. ). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_player_ownership ( \"331.p.7200\" ) Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"ownership\": { \"ownership_type\": \"team\", \"owner_team_key\": \"331.l.729259.t.4\", \"owner_team_name\": \"hold my D\", \"teams\": { \"team\": { \"clinched_playoffs\": 1, \"draft_grade\": \"B-\", \"draft_position\": 1, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/4/draftrecap\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"5KLNXUYW5RP22UMRKUXHBCIITI\", \"manager_id\": \"4\", \"nickname\": \"--hidden--\" } }, \"name\": \"hold my D\", \"number_of_moves\": \"27\", \"number_of_trades\": \"1\", \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"4\", \"team_key\": \"331.l.729259.t.4\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1589/24677593583_68859308dd_192sq.jpg?ct=fantasy\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/4\", \"waiver_priority\": 7 } } }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player ( Player ) \u2013 YFPY Player instance containing attribute \"ownership\". Source code in yfpy/query.py 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 def get_player_ownership ( self , player_key : str ) -> Player : \"\"\"Retrieve ownership of specific player by player_key for chosen league. Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_player_ownership(\"331.p.7200\") Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"ownership\": { \"ownership_type\": \"team\", \"owner_team_key\": \"331.l.729259.t.4\", \"owner_team_name\": \"hold my D\", \"teams\": { \"team\": { \"clinched_playoffs\": 1, \"draft_grade\": \"B-\", \"draft_position\": 1, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/4/draftrecap\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"5KLNXUYW5RP22UMRKUXHBCIITI\", \"manager_id\": \"4\", \"nickname\": \"--hidden--\" } }, \"name\": \"hold my D\", \"number_of_moves\": \"27\", \"number_of_trades\": \"1\", \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"4\", \"team_key\": \"331.l.729259.t.4\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1589/24677593583_68859308dd_192sq.jpg?ct=fantasy\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/4\", \"waiver_priority\": 7 } } }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player: YFPY Player instance containing attribute \"ownership\". \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /ownership\" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player ) get_player_percent_owned_by_week \u00b6 get_player_percent_owned_by_week ( player_key , chosen_week = \"current\" ) Retrieve percent-owned of specific player by player_key and by week for chosen league. Parameters: player_key ( str ) \u2013 The player key of chosen player (example: 331.p.7200 - .p. ). chosen_week ( int , default: 'current' ) \u2013 Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_player_percent_owned_by_week ( \"331.p.7200\" , 1 ) Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/ https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"percent_owned\": { \"coverage_type\": \"week\", \"week\": \"1\", \"value\": 100, \"delta\": \"0\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player ( Player ) \u2013 YFPY Player instance containing attribute \"percent_owned\". Source code in yfpy/query.py 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 def get_player_percent_owned_by_week ( self , player_key : str , chosen_week : Union [ int , str ] = \"current\" ) -> Player : \"\"\"Retrieve percent-owned of specific player by player_key and by week for chosen league. Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_player_percent_owned_by_week(\"331.p.7200\", 1) Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/ https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"percent_owned\": { \"coverage_type\": \"week\", \"week\": \"1\", \"value\": 100, \"delta\": \"0\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player: YFPY Player instance containing attribute \"percent_owned\". \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /percent_owned;type=week;week= { chosen_week } \" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player ) get_player_draft_analysis \u00b6 get_player_draft_analysis ( player_key ) Retrieve draft analysis of specific player by player_key for chosen league. Parameters: player_key ( str ) \u2013 The player key of chosen player (example: 331.p.7200 - .p. ). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_player_draft_analysis ( \"331.p.7200\" ) Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"draft_analysis\": { \"average_pick\": \"19.9\", \"average_round\": \"2.8\", \"average_cost\": \"38.5\", \"percent_drafted\": \"1.00\" }, \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player ( Player ) \u2013 YFPY Player instance containing attribute \"draft_analysis\". Source code in yfpy/query.py 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 def get_player_draft_analysis ( self , player_key : str ) -> Player : \"\"\"Retrieve draft analysis of specific player by player_key for chosen league. Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_player_draft_analysis(\"331.p.7200\") Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"draft_analysis\": { \"average_pick\": \"19.9\", \"average_round\": \"2.8\", \"average_cost\": \"38.5\", \"percent_drafted\": \"1.00\" }, \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player: YFPY Player instance containing attribute \"draft_analysis\". \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /draft_analysis\" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player )","title":"Query"},{"location":"query/#query","text":"YFPY module for making Yahoo Fantasy Sports REST API queries. This module provides all available Yahoo Fantasy Sports API queries as callable methods on the YahooFantasySportsQuery class. Attributes: logger ( Logger ) \u2013 Module level logger for usage and debugging.","title":"Query"},{"location":"query/#yfpy.query.YahooFantasySportsQuery","text":"Bases: object Yahoo Fantasy Sports REST API query CLASS to retrieve all types of fantasy sports data. Source code in yfpy/query.py 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 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 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 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 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 470 471 472 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 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 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 695 696 697 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 728 729 730 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 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 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 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 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 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 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 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 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 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 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 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 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 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 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 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 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 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 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 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 class YahooFantasySportsQuery ( object ): \"\"\"Yahoo Fantasy Sports REST API query CLASS to retrieve all types of fantasy sports data. \"\"\" YFO = TypeVar ( \"YFO\" , bound = YahooFantasyObject ) runtime_environment_is_docker = os . environ . get ( \"RUNTIME_ENVIRONMENT\" , None ) == \"docker\" def __init__ ( self , league_id : str , game_code : str , game_id : Optional [ int ] = None , yahoo_consumer_key : Optional [ str ] = None , yahoo_consumer_secret : Optional [ str ] = None , yahoo_access_token_json : Optional [ Union [ str , Dict ]] = None , env_var_fallback : bool = True , env_file_location : Optional [ Path ] = None , save_token_data_to_env_file : Optional [ bool ] = False , all_output_as_json_str : bool = False , browser_callback : bool = not runtime_environment_is_docker , retries : int = 3 , backoff : int = 0 , offline : bool = False ): \"\"\"Instantiate a YahooQueryObject for running queries against the Yahoo fantasy REST API. Args: league_id (str): League ID of selected Yahoo Fantasy league. game_code (str): Game code of selected Yahoo Fantasy game corresponding to a specific sport (refers to the current season if used as the value for game_key), where \"nfl\" is for fantasy football, \"nhl\" is for fantasy hockey, \"mlb\" is for fantasy baseball, and \"nba\" is for fantasy basketball. game_id (:obj:`int`, optional): Game ID of selected Yahoo fantasy game corresponding to a specific year, and defaulting to the game ID for the current year. yahoo_consumer_key (:obj:`str`, optional): User defined Yahoo developer app consumer key (must be provided in conjunction with yahoo_consumer_secret). yahoo_consumer_secret (:obj:`str`, optional): User defined Yahoo developer app consumer secret (must be provided in conjunction with yahoo_consumer_key). yahoo_access_token_json (str | dict, optional): User defined JSON (string or dict) containing refreshable access token generated by the yahoo-oauth library to avoid having to reauthenticate on every access to the Yahoo Fantasy Sports API (overrides yahoo_consumer_key/yahoo_consumer_secret and all Yahoo access token environment variables). env_var_fallback (:obj:`bool`, optional): Fall back to values retrieved from environment variables for any missing arguments or access token fields (defaults to True). env_file_location (:obj:`Path`, optional): Path to directory where existing .env file is located or new .env file should be generated when provided in conjunction with save_access_token_data_to_env_file=True (defaults to None). save_token_data_to_env_file (:obj:`bool`, optional): Boolean to save Yahoo access token data to local .env file (must be provided in conjunction with env_file_location) (defaults to False) all_output_as_json_str (:obj:`bool`, optional): Option to automatically convert all query output to JSON strings. browser_callback (:obj:`bool`, optional): Enable or disable (enabled by default) whether the yahoo-oauth library automatically opens a browser window to authenticate (if disabled, it will output the callback URL). retries (:obj:`int`, optional): Number of times to retry a query if it fails (defaults to 3). backoff (:obj:`int`, optional): Multiplier that incrementally increases the wait time before retrying a failed query request. offline (:obj:`bool`, optional): Boolean to run in offline mode (Only works if all needed Yahoo Fantasy data has been previously saved locally using the Data module in data.py). Attributes: _env_var_fallback (bool): Fall back to values retrieved from environment variables for any missing arguments or access token fields. _yahoo_access_token_dict (dict[str, Any]): Dictionary containing refreshable access token data generated by the yahoo-oauth library to avoid having to reauthenticate on every access to the Yahoo Fantasy Sports API. _yahoo_consumer_key (str): User defined Yahoo developer app consumer key. _yahoo_consumer_secret (str): User defined Yahoo developer app consumer secret. _browser_callback (bool): Enable or disable (enabled by default) whether the yahoo-oauth library automatically opens a browser window to authenticate (if disabled, it will output the callback URL). _retries (int): Number of times to retry a query if it fails (defaults to 3). _backoff (int): Multiplier that incrementally increases the wait time before retrying a failed query request. _fantasy_content_data_field (str): The initial JSON field in which all Yahoo Fantasy Sports API responses store the data output of the submitted query. league_id (str): League ID of selected Yahoo Fantasy league. game_code (str): Game code of selected Yahoo Fantasy game corresponding to a specific sport (refers to the current season if used as the value for game_key), where \"nfl\" is for fantasy football, \"nhl\" is for fantasy hockey, \"mlb\" is for fantasy baseball, and \"nba\" is for fantasy basketball. game_id (int): Game ID of selected Yahoo fantasy game corresponding to a specific year, and defaulting to the game ID for the current year. league_key (str): The Yahoo Fantasy Sports league key formatted as .l.. executed_queries (list[dict[str, Any]]): List of completed queries and their responses. all_output_as_json_str (bool): Option to automatically convert all query output to JSON strings. offline (bool): Boolean to run in offline mode (Only works if all needed Yahoo Fantasy data has been previously saved locally using the Data module in data.py). \"\"\" self . _env_var_fallback = env_var_fallback # load provided .env file if it exists to read any additional environment variables stored there if self . _env_var_fallback and env_file_location : env_file_path = env_file_location / \".env\" if env_file_path . is_file (): load_dotenv ( env_file_path ) self . _yahoo_access_token_dict : Dict [ str , Any ] = self . _get_dict_from_access_token_json ( yahoo_access_token_json ) # warn user that providing Yahoo access token JSON or populating a YAHOO_ACCESS_TOKEN_JSON environment variable # will override any values provided in the yahoo_consumer_key and yahoo_consumer_secret parameters if self . _yahoo_access_token_dict and ( yahoo_consumer_key or yahoo_consumer_secret ): logger . warning ( \"Providing a yahoo_access_token_json argument or setting env_var_fallback to True and having a \" \"YAHOO_ACCESS_TOKEN_JSON will override any values provided for yahoo_consumer_key or \" \"yahoo_consumer_secret.\" ) # retrieve the Yahoo consumer key and Yahoo consumer secret from the access token dict and fall back to the # provided parameters if no dict exists self . _yahoo_consumer_key = self . _yahoo_access_token_dict . get ( \"consumer_key\" , yahoo_consumer_key ) self . _yahoo_consumer_secret = self . _yahoo_access_token_dict . get ( \"consumer_secret\" , yahoo_consumer_secret ) # catch when a Yahoo consumer key was not provided if not self . _yahoo_consumer_key : # check for YAHOO_CONSUMER_KEY environment variable value if env_var_fallback is True if self . _env_var_fallback : if yahoo_consumer_key_env_var := os . environ . get ( \"YAHOO_CONSUMER_KEY\" ): self . _yahoo_consumer_key = yahoo_consumer_key_env_var if not self . _yahoo_consumer_key : logger . error ( \"Missing required Yahoo consumer key (no yahoo_consumer_key argument provided to \" \"YahooFantasySportsQuery, no consumer_key value provided in yahoo_access_token_json, or no \" \"YAHOO_CONSUMER_KEY environment variable value found).\" ) sys . exit ( 1 ) # catch when a Yahoo consumer secret was not provided if not self . _yahoo_consumer_secret : # check for YAHOO_CONSUMER_SECRET environment variable value if env_var_fallback is True if self . _env_var_fallback : if yahoo_consumer_secret_env_var := os . environ . get ( \"YAHOO_CONSUMER_SECRET\" ): self . _yahoo_consumer_secret = yahoo_consumer_secret_env_var if not self . _yahoo_consumer_secret : logger . error ( \"Missing required Yahoo consumer secret (no yahoo_consumer_secret argument provided to \" \"YahooFantasySportsQuery, no consumer_secret value provided in yahoo_access_token_json, or no \" \"YAHOO_CONSUMER_SECRET environment variable value found).\" ) sys . exit ( 1 ) # explicitly check for truthy/falsy value self . _browser_callback : bool = True if browser_callback is True else False self . _retries : int = retries self . _backoff : int = backoff self . _fantasy_content_data_field : str = \"fantasy_content\" self . league_id : str = league_id self . game_code : str = ( game_code if game_code in yahoo_fantasy_sports_game_codes else retrieve_game_code_from_user () ) self . game_id : int = game_id self . league_key : str = None self . executed_queries : List [ Dict [ str , Any ]] = [] # explicitly check for truthy/falsy value self . all_output_as_json_str : bool = True if all_output_as_json_str is True else False # explicitly check for truthy/falsy value self . offline : bool = True if offline is True else False if not self . offline : self . _authenticate () if save_token_data_to_env_file : self . save_access_token_data_to_env_file ( env_file_location ) def _get_dict_from_access_token_json ( self , yahoo_access_token_json : Union [ str , Dict ]) -> Dict [ str , Any ]: \"\"\"Creates a dictionary of Yahoo access token fields extracted from provided JSON (or a provided dictionary). Args: yahoo_access_token_json (str | dict): A valid JSON string or Python dictionary containing Yahoo access token fields and values. Returns: dict[str, Any]: A dictionary of key/value pairs containing the required values to authenticate using a Yahoo access token. \"\"\" yahoo_access_token_dict : Dict [ str , Any ] = {} # check if there is no provided token JSON and attempt to retrieve them from the YAHOO_ACCESS_TOKEN_JSON # environment variable if fallback to environment variables is True if not yahoo_access_token_json and self . _env_var_fallback : yahoo_access_token_json = os . environ . get ( \"YAHOO_ACCESS_TOKEN_JSON\" ) if yahoo_access_token_json : # parse Yahoo access token JSON as needed if isinstance ( yahoo_access_token_json , str ): try : yahoo_access_token_dict = json . loads ( yahoo_access_token_json ) except JSONDecodeError as e : logger . error ( f \"Invalid JSON provided in yahoo_access_token_json: \\n { e } \" ) sys . exit ( 1 ) elif isinstance ( yahoo_access_token_json , dict ): yahoo_access_token_dict = yahoo_access_token_json else : logger . error ( f \"Invalid object type provided in yahoo_access_token_json or YAHOO_ACCESS_TOKEN_JSON environment \" f \"variable: { type ( yahoo_access_token_json ) } \" ) sys . exit ( 1 ) # check if any fields required by a Yahoo access token are missing yahoo_access_token_required_fields = { \"access_token\" , \"consumer_key\" , \"consumer_secret\" , \"guid\" , \"refresh_token\" , \"token_time\" , \"token_type\" } if not set ( yahoo_access_token_dict . keys ()) . issuperset ( yahoo_access_token_required_fields ): logger . error ( f \"Missing required fields in yahoo_access_token_json: \" f \" { yahoo_access_token_required_fields . difference ( yahoo_access_token_dict . keys ()) } \" ) sys . exit ( 1 ) return yahoo_access_token_dict def _authenticate ( self ) -> None : \"\"\"Authenticate with the Yahoo Fantasy Sports REST API using OAuth2. Returns: None \"\"\" logger . debug ( \"Authenticating with Yahoo.\" ) # provide Yahoo access token fields if available or search for them in environment variables if env_var_fallback # is True, and then complete OAuth2 3-legged handshake by either refreshing existing OAuth2 refresh token or # requesting account access and returning a verification code to input to the command line prompt self . oauth = OAuth2 ( self . _yahoo_consumer_key , self . _yahoo_consumer_secret , access_token = self . _yahoo_access_token_dict . get ( \"access_token\" , os . environ . get ( \"YAHOO_ACCESS_TOKEN\" , None ) if self . _env_var_fallback else None ), guid = self . _yahoo_access_token_dict . get ( \"guid\" , os . environ . get ( \"YAHOO_GUID\" , None ) if self . _env_var_fallback else None ), refresh_token = self . _yahoo_access_token_dict . get ( \"refresh_token\" , os . environ . get ( \"YAHOO_REFRESH_TOKEN\" , None ) if self . _env_var_fallback else None ), token_time = self . _yahoo_access_token_dict . get ( \"token_time\" , float ( os . environ . get ( \"YAHOO_TOKEN_TIME\" , 0.0 )) if self . _env_var_fallback else 0.0 ), token_type = self . _yahoo_access_token_dict . get ( \"token_type\" , os . environ . get ( \"YAHOO_TOKEN_TYPE\" , None ) if self . _env_var_fallback else None ), browser_callback = self . _browser_callback , store_file = False ) if not self . oauth . token_is_valid (): self . oauth . refresh_access_token () self . _yahoo_access_token_dict . update ( { \"access_token\" : self . oauth . access_token , \"consumer_key\" : self . oauth . consumer_key , \"consumer_secret\" : self . oauth . consumer_secret , \"guid\" : self . oauth . guid , \"refresh_token\" : self . oauth . refresh_token , \"token_time\" : self . oauth . token_time , \"token_type\" : self . oauth . token_type , } ) @staticmethod def _retrieve_env_file_contents ( env_file_path : Path ) -> Dict [ str , str ]: \"\"\"Creates a dictionary of key/value pairs representing each line of a .env file (stores environment variables). Args: env_file_path (Path): The path to the directory where the target .env file is located. Returns: dict[str, str]: A dictionary of key/value pairs representing each line of a .env file. \"\"\" env_file_content = OrderedDict () if env_file_path . is_file (): with open ( env_file_path , \"r\" ) as env_file : for line_num , env_file_line in enumerate ( env_file , start = 1 ): if env_file_line . startswith ( \" \\n \" ): # track blank lines in .env file using their line number env_file_content [ f \"blank_ { line_num } \" ] = \" \\n \" elif env_file_line . startswith ( \"#\" ): # track comments in .env file using their line number env_file_content [ f \"comment_ { line_num } \" ] = env_file_line . strip () else : # extract and normalize environment variables from .env file env_var_name , env_var_value = env_file_line . split ( \"=\" , 1 ) env_file_content [ env_var_name . lower ()] = env_var_value . strip () return env_file_content def save_access_token_data_to_env_file ( self , env_file_location : Path , env_file_name : str = \".env\" , save_json_to_var_only : bool = False ) -> None : \"\"\"Saves the fields and values of a Yahoo access token into a .env file. Args: env_file_location (:obj:`Path`, optional): Path to directory where existing .env file is located or new .env file should be generated. env_file_name (:obj:`str`, optional): The name of the target .env file (defaults to \".env\"). save_json_to_var_only (:obj:`bool`, optional): Boolean to determine whether or not to write a JSON string of Yahoo access token fields to a YAHOO_ACCESS_TOKEN_JSON environment variable in the target .env file instead of writing Yahoo access token fields to separate environment variables in the target .env file. (defaults to False). Returns: None \"\"\" if env_file_location : env_file_path = env_file_location / env_file_name else : logger . warning ( \"Missing argument env_file_location. Yahoo access token will NOT be saved to .env file.\" ) # exit method without saving Yahoo access token data when no env_file_location argument is provided return env_file_content = self . _retrieve_env_file_contents ( env_file_path ) if save_json_to_var_only : # generate a JSON string with escaped double quotes using nested json.dumps() and write it to a # YAHOO_ACCESS_TOKEN_JSON environment variable if save_json_to_var_only is set to True instead of writing # Yahoo access token fields to separate environment variables in target .env file env_file_content [ \"yahoo_access_token_json\" ] = json . dumps ( json . dumps ( self . _yahoo_access_token_dict )) else : # replace values of any matching environment variables in .env file with values from Yahoo access token # fields or add new environment variables to .env file if any fields are missing for k , v in self . _yahoo_access_token_dict . items (): env_file_content [ f \"yahoo_ { k } \" ] = v # write contents to .env file (overwrites contents if file exists or creates a new file if not) with open ( env_file_path , \"w\" ) as env_file : for k , v in env_file_content . items (): if k . startswith ( \"blank\" ): env_file . write ( v ) elif k . startswith ( \"comment\" ): env_file . write ( f \" { v } \\n \" ) else : env_file . write ( f \" { k . upper () } = { v } \\n \" ) def get_response ( self , url : str ) -> Response : \"\"\"Retrieve Yahoo Fantasy Sports data from the REST API. Args: url (str): REST API request URL string. Returns: Response: API response from Yahoo Fantasy Sports API request. \"\"\" logger . debug ( f \"Making request to URL: { url } \" ) response : Response = self . oauth . session . get ( url , params = { \"format\" : \"json\" }) status_code = response . status_code # when you exceed Yahoo's allowed data request limits, they throw a request status code of 999 if status_code == 999 : raise HTTPError ( \"Yahoo data unavailable due to rate limiting. Please try again later.\" ) if status_code == 401 : self . _authenticate () response_json = {} try : response_json = response . json () logger . debug ( f \"Response (JSON): { response_json } \" ) except JSONDecodeError : response . raise_for_status () try : if ( status_code // 100 ) != 2 : # handle if the yahoo query returns an error if response_json . get ( \"error\" ): response_error_msg = response_json . get ( \"error\" ) . get ( \"description\" ) error_msg = f \"Attempt to retrieve data at URL { response . url } failed with error: \" \\ f \" \\\" { response_error_msg } \\\" \" logger . error ( error_msg ) raise YahooFantasySportsDataNotFound ( error_msg , url = response . url ) response . raise_for_status () except HTTPError as e : # retry with incremental back-off if self . _retries > 0 : self . _retries -= 1 self . _backoff += 1 logger . warning ( f \"Request for URL { url } failed with status code { response . status_code } . \" f \"Retrying { self . _retries } more time { 's' if self . _retries > 1 else '' } ...\" ) time . sleep ( 0.3 * self . _backoff ) response = self . get_response ( url ) else : # log error and terminate query if status code is not 200 after 3 retries logger . error ( f \"Request failed with status code: { response . status_code } - { e } \" ) response . raise_for_status () raw_response_data = response_json . get ( self . _fantasy_content_data_field ) # extract data from \"fantasy_content\" field if it exists if raw_response_data : logger . debug ( f \"Data fetched with query URL: { response . url } \" ) logger . debug ( f \"Response (Yahoo fantasy data extracted from: \" f \" \\\" { self . _fantasy_content_data_field } \\\" ): { raw_response_data } \" ) else : error_msg = f \"No data found at URL { response . url } when attempting extraction from field: \" \\ f \" \\\" { self . _fantasy_content_data_field } \\\" \" logger . error ( error_msg ) raise YahooFantasySportsDataNotFound ( error_msg , url = response . url ) return response # noinspection GrazieInspection def query ( self , url : str , data_key_list : Union [ List [ str ], List [ List [ str ]]], data_type_class : Type = None , sort_function : Callable = None ) -> ( Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]]): \"\"\"Base query class to retrieve requested data from the Yahoo fantasy sports REST API. Args: url (str): REST API request URL string. data_key_list (list[str] | list[list[str]]): List of keys used to extract the specific data desired by the given query (supports strings and lists of strings). Supports lists containing only key strings such as [\"game\", \"stat_categories\"], and also supports lists containing key strings followed by lists of key strings such as [\"team\", [\"team_points\", \"team_projected_points\"]]. data_type_class (:obj:`Type`, optional): Highest level data model type (if one exists for the retrieved data). sort_function (Callable of sort function, optional)): Optional lambda function to return sorted query results. Returns: object: Model class instance from yfpy/models.py, dictionary, or list (depending on query), with unpacked and parsed response data. \"\"\" if not self . offline : response = self . get_response ( url ) raw_response_data = response . json () . get ( self . _fantasy_content_data_field ) # print(json.dumps(raw_response_data, indent=2)) # iterate through list of data keys and drill down to final desired data field for i in range ( len ( data_key_list )): if isinstance ( raw_response_data , list ): if isinstance ( data_key_list [ i ], list ): reformatted = reformat_json_list ( raw_response_data ) raw_response_data = [ { data_key_list [ i ][ 0 ]: reformatted [ data_key_list [ i ][ 0 ]]}, { data_key_list [ i ][ 1 ]: reformatted [ data_key_list [ i ][ 1 ]]} ] else : raw_response_data = reformat_json_list ( raw_response_data )[ data_key_list [ i ]] else : if isinstance ( data_key_list [ i ], list ): raw_response_data = [ { data_key_list [ i ][ 0 ]: raw_response_data [ data_key_list [ i ][ 0 ]]}, { data_key_list [ i ][ 1 ]: raw_response_data [ data_key_list [ i ][ 1 ]]} ] else : raw_response_data = raw_response_data . get ( data_key_list [ i ]) if raw_response_data : logger . debug ( f \"Response (Yahoo fantasy data extracted from: { data_key_list } ): { raw_response_data } \" ) else : error_msg = f \"No data found when attempting extraction from fields: { data_key_list } \" logger . error ( error_msg ) raise YahooFantasySportsDataNotFound ( error_msg , payload = data_key_list , url = response . url ) # unpack, parse, and assign data types to all retrieved data content unpacked = unpack_data ( raw_response_data , YahooFantasyObject ) logger . debug ( f \"Unpacked and parsed JSON (Yahoo fantasy data wth parent type: { data_type_class } ): \\n { unpacked } \" ) self . executed_queries . append ({ \"url\" : response . url , \"response_status_code\" : response . status_code , \"response\" : response }) # cast the highest level of data to type corresponding to query (if type exists) query_data = data_type_class ( unpacked ) if data_type_class else unpacked # sort data when applicable if sort_function and not isinstance ( query_data , dict ): query_data = sorted ( query_data , key = sort_function ) # flatten lists of single-key dicts of objects into lists of those objects if isinstance ( query_data , list ): last_data_key = data_key_list [ - 1 ] if last_data_key . endswith ( \"s\" ): query_data = [ el [ last_data_key [: - 1 ]] for el in query_data ] if self . all_output_as_json_str : return jsonify_data ( query_data ) else : return query_data else : logger . error ( \"Cannot run Yahoo query while using offline mode! Please try again with offline=False.\" ) def get_all_yahoo_fantasy_game_keys ( self ) -> List [ Game ]: \"\"\"Retrieve all Yahoo Fantasy Sports game keys by ID (from year of inception to present), sorted by season/year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_all_yahoo_fantasy_game_keys() [ Game({ \"code\": \"nfl\", \"game_id\": \"50\", \"game_key\": \"50\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"1999\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/1999\" }), ..., Game({...}) ] Returns: list[Game]: List of YFPY Game instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/games;game_codes= { self . game_code } \" , [ \"games\" ], sort_function = lambda x : x . get ( \"game\" ) . season ) # noinspection PyUnresolvedReferences def get_game_key_by_season ( self , season : int ) -> str : \"\"\"Retrieve specific game key by season. Args: season (int): User defined season/year for which to retrieve the Yahoo Fantasy Sports game. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_key_by_season(2021) 338 Returns: str: The game key for a Yahoo Fantasy Sports game specified by season. \"\"\" all_output_as_json = False if self . all_output_as_json_str : self . all_output_as_json_str = False all_output_as_json = True game_key = self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/games;game_codes= { self . game_code } ;seasons= { season } \" , [ \"games\" ] ) . get ( \"game\" ) . game_key if all_output_as_json : self . all_output_as_json_str = True return game_key def get_current_game_info ( self ) -> Game : \"\"\"Retrieve game info for current fantasy season. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_current_game_info() Game({ \"code\": \"nfl\", \"game_id\": \"390\", \"game_key\": \"390\", \"game_weeks\": [ { \"game_week\": { \"display_name\": \"1\", \"end\": \"2019-09-09\", \"start\": \"2019-09-05\", \"week\": \"1\" } }, ... ], \"is_game_over\": 0, \"is_live_draft_lobby_active\": 1, \"is_offseason\": 0, \"is_registration_over\": 0, \"name\": \"Football\", \"position_types\": [ { \"position_type\": { \"type\": \"O\", \"display_name\": \"Offense\" } }, ... ], \"roster_positions\": [ { \"roster_position\": { \"position\": \"QB\", \"position_type\": \"O\" } }, ... ], \"season\": \"2019\", \"stat_categories\": { \"stats\": [ { \"stat\": { \"display_name\": \"GP\", \"name\": \"Games Played\", \"sort_order\": \"1\", \"stat_id\": 0 } }, ... }, \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/f1\" }) Returns: Game: YFPY Game instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { self . game_code } ;\" f \"out=metadata,players,game_weeks,stat_categories,position_types,roster_positions\" , [ \"game\" ], Game ) def get_current_game_metadata ( self ) -> Game : \"\"\"Retrieve game metadata for current fantasy season. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_current_game_metadata() Game({ \"code\": \"nfl\", \"game_id\": \"390\", \"game_key\": \"390\", \"is_game_over\": 0, \"is_live_draft_lobby_active\": 1, \"is_offseason\": 0, \"is_registration_over\": 0, \"name\": \"Football\", \"season\": \"2019\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/f1\" }) Returns: Game: YFPY Game instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { self . game_code } /metadata\" , [ \"game\" ], Game ) def get_game_info_by_game_id ( self , game_id : int ) -> Game : \"\"\"Retrieve game info for specific game by ID. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_info_by_game_id(390) Game({ \"code\": \"nfl\", \"game_id\": \"390\", \"game_key\": \"390\", \"game_weeks\": [ { \"game_week\": { \"display_name\": \"1\", \"end\": \"2019-09-09\", \"start\": \"2019-09-05\", \"week\": \"1\" } }, ... ], \"is_game_over\": 0, \"is_live_draft_lobby_active\": 1, \"is_offseason\": 0, \"is_registration_over\": 0, \"name\": \"Football\", \"position_types\": [ { \"position_type\": { \"type\": \"O\", \"display_name\": \"Offense\" } }, ... ], \"roster_positions\": [ { \"roster_position\": { \"position\": \"QB\", \"position_type\": \"O\" } }, ... ], \"season\": \"2019\", \"stat_categories\": { \"stats\": [ { \"stat\": { \"display_name\": \"GP\", \"name\": \"Games Played\", \"sort_order\": \"1\", \"stat_id\": 0 } }, ... }, \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/f1\" }) Returns: Game: YFPY Game instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } ;\" f \"out=metadata,players,game_weeks,stat_categories,position_types,roster_positions\" , [ \"game\" ], Game ) def get_game_metadata_by_game_id ( self , game_id : int ) -> Game : \"\"\"Retrieve game metadata for specific game by ID. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_metadata_by_game_id(331) Game({ \"code\": \"nfl\", \"game_id\": \"331\", \"game_key\": \"331\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"2014\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014\" }) Returns: Game: YFPY Game instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } /metadata\" , [ \"game\" ], Game ) def get_game_weeks_by_game_id ( self , game_id : int ) -> List [ GameWeek ]: \"\"\"Retrieve all valid weeks of a specific game by ID. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_weeks_by_game_id(331) [ GameWeek({ \"display_name\": \"1\", \"end\": \"2014-09-08\", \"start\": \"2014-09-04\", \"week\": \"1\" }), ..., GameWeek({ \"display_name\": \"17\", \"end\": \"2014-12-28\", \"start\": \"2014-12-23\", \"week\": \"17\" }) ] Returns: list[GameWeek]: List of YFPY GameWeek instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } /game_weeks\" , [ \"game\" , \"game_weeks\" ] ) def get_game_stat_categories_by_game_id ( self , game_id : int ) -> StatCategories : \"\"\"Retrieve all valid stat categories of a specific game by ID. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_stat_categories_by_game_id(331) StatCategories({ \"stats\": [ { \"stat\": { \"display_name\": \"GP\", \"name\": \"Games Played\", \"sort_order\": \"1\", \"stat_id\": 0 } }, ..., { \"stat\": { \"display_name\": \"Rush 1st Downs\", \"name\": \"Rushing 1st Downs\", \"sort_order\": \"1\", \"stat_id\": 81 } } ] }) Returns: StatCategories: YFPY StatCategories instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } /stat_categories\" , [ \"game\" , \"stat_categories\" ], StatCategories ) def get_game_position_types_by_game_id ( self , game_id : int ) -> List [ PositionType ]: \"\"\"Retrieve all valid position types for specific game by ID sorted alphabetically by type. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_position_types_by_game_id(331) [ PositionType({ \"type\": \"O\", \"display_name\": \"Offense\" }), ..., PositionType({ \"type\": \"K\", \"display_name\": \"Kickers\" }) ] Returns: list[PositionType]: List of YFPY PositionType instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } /position_types\" , [ \"game\" , \"position_types\" ], sort_function = lambda x : x . get ( \"position_type\" ) . type ) def get_game_roster_positions_by_game_id ( self , game_id : int ) -> List [ RosterPosition ]: \"\"\"Retrieve all valid roster positions for specific game by ID sorted alphabetically by position. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_roster_positions_by_game_id(331) [ {RosterPosition({ \"position\": \"BN\" }), ..., RosterPosition({ \"position\": \"WR\", \"position_type\": \"O\" }) ] Returns: list[RosterPosition]: List of YFPY RosterPosition instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } /roster_positions\" , [ \"game\" , \"roster_positions\" ], sort_function = lambda x : x . get ( \"roster_position\" ) . position ) def get_league_key ( self , season : int = None ) -> str : \"\"\"Retrieve league key for selected league. Args: season (int): User defined season/year for which to retrieve the Yahoo Fantasy Sports league key. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_key(2021) 331.l.729259 Returns: str: League key string for selected league. \"\"\" if not self . league_key : if season : return f \" { self . get_game_key_by_season ( season ) } .l. { self . league_id } \" elif self . game_id : return f \" { self . get_game_metadata_by_game_id ( self . game_id ) . game_key } .l. { self . league_id } \" else : logger . warning ( \"No game id or season/year provided, defaulting to current fantasy season.\" ) return f \" { self . get_current_game_metadata () . game_key } .l. { self . league_id } \" else : return self . league_key def get_current_user ( self ) -> User : \"\"\"Retrieve metadata for current logged-in user. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_current_user() User({ \"guid\": \"USER_GUID_STRING\" }) Returns: User: YFPY User instance. \"\"\" return self . query ( \"https://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/\" , [ \"users\" , \"0\" , \"user\" ], User ) def get_user_games ( self ) -> List [ Game ]: \"\"\"Retrieve game history for current logged-in user sorted by season/year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_user_games() [ Game({ \"code\": \"nfl\", \"game_id\": \"359\", \"game_key\": \"359\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"2016\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2016\" }) ..., Game({...}) ] Returns: list[Game]: List of YFPY Game instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/games;codes= { self . game_code } /\" , [ \"users\" , \"0\" , \"user\" , \"games\" ], sort_function = lambda x : x . get ( \"game\" ) . season ) def get_user_leagues_by_game_key ( self , game_key : Union [ int , str ]) -> List [ League ]: \"\"\"Retrieve league history for current logged-in user for specific game by game IDs/keys sorted by season/year. Args: game_key (int | str): The game_id (int) or game_key (str) for a specific Yahoo Fantasy game. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_user_leagues_by_game_key(331) [ League({ \"allow_add_to_dl_extra_pos\": 0, \"current_week\": \"16\", \"draft_status\": \"postdraft\", \"edit_key\": \"16\", \"end_date\": \"2018-12-24\", \"end_week\": \"16\", \"game_code\": \"nfl\", \"iris_group_chat_id\": \"\", \"is_cash_league\": \"0\", \"is_finished\": 1, \"is_pro_league\": \"0\", \"league_id\": \"169896\", \"league_key\": \"380.l.169896\", \"league_type\": \"private\", \"league_update_timestamp\": \"1546498723\", \"logo_url\": \"\", \"name\": \"League Name\", \"num_teams\": 12, \"password\": null, \"renew\": \"371_52364\", \"renewed\": \"390_78725\", \"scoring_type\": \"head\", \"season\": \"2018\", \"short_invitation_url\": \"\", \"start_date\": \"2018-09-06\", \"start_week\": \"1\", \"url\": \"\", \"weekly_deadline\": null }), ..., League({...}) ] Returns: list[League]: List of YFPY League instances. \"\"\" leagues = self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/games;game_keys= { game_key } /leagues/\" , [ \"users\" , \"0\" , \"user\" , \"games\" , \"0\" , \"game\" , \"leagues\" ], sort_function = lambda x : x . get ( \"league\" ) . season ) return leagues if isinstance ( leagues , list ) else [ leagues . get ( \"league\" )] def get_user_teams ( self ) -> List [ Game ]: \"\"\"Retrieve teams for all leagues for current logged-in user for current game sorted by season/year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_user_teams() [ Game({ \"code\": \"nfl\", \"game_id\": \"359\", \"game_key\": \"359\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"2016\", \"teams\": [ { \"team\": { \"draft_grade\": \"A\", \"draft_position\": 9, \"draft_recap_url\": \"\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": [ { \"manager\": { \"email\": \"\", \"guid\": \"\", \"image_url\": \"\", \"is_comanager\": \"1\", \"manager_id\": \"14\", \"nickname\": \"\" } } ], \"name\": \"Legion\", \"number_of_moves\": \"48\", \"number_of_trades\": \"2\", \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"1\", \"team_key\": \"359.l.5521.t.1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"\" } }, \"url\": \"\", \"waiver_priority\": 11 } } ], \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2016\" }) ..., Game({...}) ] Returns: list[Game]: List of YFPY Game instances with \"teams\" attribute containing list of YFPY Team instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/games;codes= { self . game_code } /teams/\" , [ \"users\" , \"0\" , \"user\" , \"games\" ], sort_function = lambda x : x . get ( \"game\" ) . season ) def get_league_info ( self ) -> League : \"\"\"Retrieve info for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_info() League({ \"allow_add_to_dl_extra_pos\": 0, \"current_week\": \"16\", \"draft_status\": \"postdraft\", \"edit_key\": \"16\", \"end_date\": \"2014-12-22\", \"end_week\": \"16\", \"game_code\": \"nfl\", \"iris_group_chat_id\": null, \"is_cash_league\": \"0\", \"is_finished\": 1, \"is_pro_league\": \"1\", \"league_id\": \"729259\", \"league_key\": \"331.l.729259\", \"league_type\": \"public\", \"league_update_timestamp\": \"1420099793\", \"logo_url\": \"https://s.yimg.com/cv/api/default/20180206/default-league-logo@2x.png\", \"name\": \"Yahoo Public 729259\", \"num_teams\": 10, \"renew\": null, \"renewed\": null, \"scoreboard\": { \"week\": \"16\", \"matchups\": [ ... ] }, \"scoring_type\": \"head\", \"season\": \"2014\", \"settings\": { ... }, \"standings\": { \"teams\": [ ..., ... ], ... }, \"start_date\": \"2014-09-04\", \"start_week\": \"1\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259\", \"weekly_deadline\": null }) Returns: League: YFPY League instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } ;\" f \"out=metadata,settings,standings,scoreboard,teams,players,draftresults,transactions\" , [ \"league\" ], League ) def get_league_metadata ( self ) -> League : \"\"\"Retrieve metadata for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_metadata() League({ \"allow_add_to_dl_extra_pos\": 0, \"current_week\": \"16\", \"draft_status\": \"postdraft\", \"edit_key\": \"16\", \"end_date\": \"2014-12-22\", \"end_week\": \"16\", \"game_code\": \"nfl\", \"iris_group_chat_id\": null, \"is_cash_league\": \"0\", \"is_finished\": 1, \"is_pro_league\": \"1\", \"league_id\": \"729259\", \"league_key\": \"331.l.729259\", \"league_type\": \"public\", \"league_update_timestamp\": \"1420099793\", \"logo_url\": \"https://s.yimg.com/cv/api/default/20180206/default-league-logo@2x.png\", \"name\": \"Yahoo Public 729259\", \"num_teams\": 10, \"renew\": null, \"renewed\": null, \"scoring_type\": \"head\", \"season\": \"2014\", \"start_date\": \"2014-09-04\", \"start_week\": \"1\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259\", \"weekly_deadline\": null }) Returns: League: YFPY League instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /metadata\" , [ \"league\" ], League ) def get_league_settings ( self ) -> Settings : \"\"\"Retrieve settings (rules) for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_settings() Settings({ \"cant_cut_list\": \"yahoo\", \"draft_time\": \"1408410000\", \"draft_type\": \"live\", \"has_multiweek_championship\": 0, \"has_playoff_consolation_games\": true, \"is_auction_draft\": \"0\", \"max_teams\": \"10\", \"num_playoff_consolation_teams\": 4, \"num_playoff_teams\": \"4\", \"pickem_enabled\": \"1\", \"player_pool\": \"ALL\", \"playoff_start_week\": \"15\", \"post_draft_players\": \"W\", \"roster_positions\": [ { \"roster_position\": { \"count\": 1, \"position\": \"QB\", \"position_type\": \"O\" } }, ... ], \"scoring_type\": \"head\", \"stat_categories\": { \"stats\": [ { \"stat\": { \"display_name\": \"Pass Yds\", \"enabled\": \"1\", \"name\": \"Passing Yards\", \"position_type\": \"O\", \"sort_order\": \"1\", \"stat_id\": 4, \"stat_position_types\": { \"stat_position_type\": { \"position_type\": \"O\" } } } }, ... ] }, \"stat_modifiers\": { \"stats\": [ { \"stat\": { \"stat_id\": 4, \"value\": \"0.04\" } }, ... ] }, \"trade_end_date\": \"2014-11-14\", \"trade_ratify_type\": \"yahoo\", \"trade_reject_time\": \"2\", \"uses_faab\": \"0\", \"uses_fractional_points\": \"1\", \"uses_lock_eliminated_teams\": 1, \"uses_negative_points\": \"1\", \"uses_playoff\": \"1\", \"uses_playoff_reseeding\": 0, \"waiver_rule\": \"gametime\", \"waiver_time\": \"2\", \"waiver_type\": \"R\" }) Returns: Settings: YFPY Settings instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /settings\" , [ \"league\" , \"settings\" ], Settings ) def get_league_standings ( self ) -> Standings : \"\"\"Retrieve standings for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_standings() Standings({ \"teams\": [ { \"team\": { \"clinched_playoffs\": 1, \"draft_grade\": \"C+\", \"draft_position\": 7, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/8/draftrecap\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"PMTCFWSK5U5LI4SKWREUR56B5A\", \"manager_id\": \"8\", \"nickname\": \"--hidden--\" } }, \"name\": \"clam dam\", \"number_of_moves\": \"27\", \"number_of_trades\": 0, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"8\", \"team_key\": \"331.l.729259.t.8\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://s.yimg.com/cv/apiv2/default/nfl/nfl_1.png\" } }, \"team_points\": { \"coverage_type\": \"season\", \"season\": \"2014\", \"total\": \"1507.06\" }, \"team_standings\": { \"outcome_totals\": { \"losses\": 2, \"percentage\": 0.857, \"ties\": 0, \"wins\": 12 }, \"playoff_seed\": \"1\", \"points_against\": 1263.78, \"points_for\": 1507.06, \"rank\": 1, \"streak\": { \"type\": \"win\", \"value\": \"2\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/8\", \"waiver_priority\": 10 } }, ... ] }) Returns: Standings: YFPY Standings instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /standings\" , [ \"league\" , \"standings\" ], Standings ) def get_league_teams ( self ) -> List [ Team ]: \"\"\"Retrieve teams for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_teams() [ Team({ \"clinched_playoffs\": 1, \"draft_grade\": \"B\", \"draft_position\": 4, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1/draftrecap\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"BMACD7S5UXV7JIQX4PGGUVQJAU\", \"manager_id\": \"1\", \"nickname\": \"--hidden--\" } }, \"name\": \"Hellacious Hill 12\", \"number_of_moves\": \"71\", \"number_of_trades\": 0, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"1\", \"team_key\": \"331.l.729259.t.1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1441/24935131299_a8242dab70_192sq.jpg?ct=fantasy\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1\", \"waiver_priority\": 9 }), ..., Team({...}) ] Returns: list[Team]: List of YFPY Team instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /teams\" , [ \"league\" , \"teams\" ] ) def get_league_players ( self , player_count_limit : int = None , player_count_start : int = 0 , is_retry : bool = False ) -> List [ Player ]: \"\"\"Retrieve valid players for chosen league. Args: player_count_limit (int): Maximum number of players to retreive. player_count_start (int): Index from which to retrieve all subsequent players. is_retry (bool): Boolean to indicate whether the method is being retried during error handling. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_players(50, 25) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"K\", \"editorial_player_key\": \"nfl.p.3727\", \"editorial_team_abbr\": \"Ind\", \"editorial_team_full_name\": \"Indianapolis Colts\", \"editorial_team_key\": \"nfl.t.11\", \"eligible_positions\": { \"position\": \"K\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/OpHvpCHjl_PQvkeQUgsjsA--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt 3PTQ2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08152019/3727.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Adam\", \"ascii_last\": \"Vinatieri\", \"first\": \"Adam\", \"full\": \"Adam Vinatieri\", \"last\": \"Vinatieri\" }, \"player_id\": \"3727\", \"player_key\": \"331.p.3727\", \"player_notes_last_timestamp\": 1568758320, \"position_type\": \"K\", \"primary_position\": \"K\", \"uniform_number\": \"4\" }), ..., Player({...}) ] Returns: list[Player]: List of YFPY Player instances. \"\"\" league_player_count = player_count_start all_players_retrieved = False league_player_data = [] league_player_retrieval_limit = 25 while not all_players_retrieved : try : league_player_query_data = self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"start= { league_player_count } ;count= { league_player_retrieval_limit if not is_retry else 1 } \" , [ \"league\" , \"players\" ] ) league_players = ( league_player_query_data if isinstance ( league_player_query_data , list ) else [ league_player_query_data ]) league_player_count_from_query = len ( league_players ) if player_count_limit : if ( league_player_count + league_player_count_from_query ) < player_count_limit : league_player_count += league_player_count_from_query league_player_data . extend ( league_players ) else : for ndx in range ( player_count_limit - league_player_count ): league_player_data . append ( league_players [ ndx ]) league_player_count += ( player_count_limit - league_player_count ) all_players_retrieved = True else : league_player_count += league_player_count_from_query league_player_data . extend ( league_players ) except YahooFantasySportsDataNotFound as yfpy_err : if not is_retry : payload = yfpy_err . payload if payload : logger . debug ( \"No more league player data available.\" ) all_players_retrieved = True else : logger . warning ( f \"Error retrieving player batch: \" f \" { league_player_count } - { league_player_count + league_player_retrieval_limit - 1 } . \" f \"Attempting to retrieve individual players from batch.\" ) player_retrieval_successes = [] player_retrieval_failures = [] for i in range ( 25 ): try : player_data = self . get_league_players ( player_count_limit = league_player_count + 1 , player_count_start = league_player_count , is_retry = True ) player_retrieval_successes . extend ( player_data ) except YahooFantasySportsDataNotFound as nested_yfpy_err : player_retrieval_failures . append ( { \"failed_player_retrieval_index\" : league_player_count , \"failed_player_retrieval_url\" : nested_yfpy_err . url , \"failed_player_retrieval_message\" : nested_yfpy_err . message } ) league_player_count += 1 league_player_data . extend ( player_retrieval_successes ) logger . warning ( f \"Players retrieval failures: \\n { prettify_data ( player_retrieval_failures ) } \" ) else : raise yfpy_err logger . debug ( f \"League player count: { league_player_count } \" ) return league_player_data def get_league_draft_results ( self ) -> List [ DraftResult ]: \"\"\"Retrieve draft results for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_draft_results() [ DraftResult({ \"pick\": 1, \"round\": 1, \"team_key\": \"331.l.729259.t.4\", \"player_key\": \"331.p.9317\" }), ..., DraftResult({...}) ] Returns: list[DraftResult]: List of YFPY DraftResult instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /draftresults\" , [ \"league\" , \"draft_results\" ] ) def get_league_transactions ( self ) -> List [ Transaction ]: \"\"\"Retrieve transactions for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_transactions() [ Transaction({ \"players\": [ { \"player\": { \"display_position\": \"RB\", \"editorial_team_abbr\": \"NO\", \"name\": { \"ascii_first\": \"Kerwynn\", \"ascii_last\": \"Williams\", \"first\": \"Kerwynn\", \"full\": \"Kerwynn Williams\", \"last\": \"Williams\" }, \"player_id\": \"26853\", \"player_key\": \"331.p.26853\", \"position_type\": \"O\", \"transaction_data\": { \"destination_team_key\": \"331.l.729259.t.1\", \"destination_team_name\": \"Hellacious Hill 12\", \"destination_type\": \"team\", \"source_type\": \"freeagents\", \"type\": \"add\" } } } ], \"status\": \"successful\", \"timestamp\": \"1419188151\", \"transaction_id\": \"282\", \"transaction_key\": \"331.l.729259.tr.282\", \"type\": \"add/drop\" }), ..., Transaction({...}) ] Returns: list[Transaction]: List of YFPY Transaction instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /transactions\" , [ \"league\" , \"transactions\" ] ) def get_league_scoreboard_by_week ( self , chosen_week : int ) -> Scoreboard : \"\"\"Retrieve scoreboard for chosen league by week. Args: chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_scoreboard_by_week(1) Scoreboard({ \"week\": \"1\", \"matchups\": [ { \"matchup\": { \"is_consolation\": \"0\", \"is_matchup_recap_available\": 1, \"is_playoffs\": \"0\", \"is_tied\": 0, \"matchup_grades\": [ { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.1\" } }, { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.2\" } } ], \"matchup_recap_title\": \"Wax On Wax Off Gets Victory Against Hellacious Hill 12\", \"matchup_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/recap? week=1&mid1=1&mid2=2\", \"status\": \"postevent\", \"teams\": [ { \"team\": { } }, { \"team\": { } } ], \"week\": \"1\", \"week_end\": \"2014-09-08\", \"week_start\": \"2014-09-04\", \"winner_team_key\": \"331.l.729259.t.2\" } }, ... ] }) Returns: Scoreboard: YFPY Scoreboard instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /scoreboard;\" f \"week= { chosen_week } \" , [ \"league\" , \"scoreboard\" ], Scoreboard ) def get_league_matchups_by_week ( self , chosen_week : int ) -> List [ Matchup ]: \"\"\"Retrieve matchups for chosen league by week. Args: chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_matchups_by_week(1) [ Matchup({ \"is_consolation\": \"0\", \"is_matchup_recap_available\": 1, \"is_playoffs\": \"0\", \"is_tied\": 0, \"matchup_grades\": [ { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.1\" } }, { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.2\" } } ], \"matchup_recap_title\": \"Wax On Wax Off Gets Victory Against Hellacious Hill 12\", \"matchup_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/recap? week=1&mid1=1&mid2=2\", \"status\": \"postevent\", \"teams\": [ { \"team\": { } }, { \"team\": { } } ], \"week\": \"1\", \"week_end\": \"2014-09-08\", \"week_start\": \"2014-09-04\", \"winner_team_key\": \"331.l.729259.t.2\" }), ..., Matchup({...}) ] Returns: list[Matchup]: List of YFPY Matchup instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /scoreboard;\" f \"week= { chosen_week } \" , [ \"league\" , \"scoreboard\" , \"0\" , \"matchups\" ] ) def get_team_info ( self , team_id : Union [ str , int ]) -> Team : \"\"\"Retrieve info of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_info(1) Team({ \"clinched_playoffs\": 1, \"draft_grade\": \"B\", \"draft_position\": 4, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1/draftrecap\", \"draft_results\": [ ... ], \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"BMACD7S5UXV7JIQX4PGGUVQJAU\", \"manager_id\": \"1\", \"nickname\": \"--hidden--\" } }, \"matchups\": [ ... ], \"name\": \"Hellacious Hill 12\", \"number_of_moves\": \"71\", \"number_of_trades\": 0, \"roster\": { ... }, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"1\", \"team_key\": \"331.l.729259.t.1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1441/24935131299_a8242dab70_192sq.jpg?ct=fantasy\" } }, \"team_points\": { \"coverage_type\": \"season\", \"season\": \"2014\", \"total\": \"1409.24\" }, \"team_standings\": { \"outcome_totals\": { \"losses\": 5, \"percentage\": 0.643, \"ties\": 0, \"wins\": 9 }, \"playoff_seed\": \"2\", \"points_against\": 1266.6599999999999, \"points_for\": 1409.24, \"rank\": 2, \"streak\": { \"type\": \"win\", \"value\": \"1\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1\", \"waiver_priority\": 9 }) Returns: Team: YFPY Team instance. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } ;\" f \"out=metadata,stats,standings,roster,draftresults,matchups\" , [ \"team\" ], Team ) def get_team_metadata ( self , team_id : Union [ str , int ]) -> Team : \"\"\"Retrieve metadata of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_metadata(1) Team({ \"team_key\": \"331.l.729259.t.1\", \"team_id\": \"1\", \"name\": \"Hellacious Hill 12\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1441/24935131299_a8242dab70_192sq.jpg?ct=fantasy\" } }, \"waiver_priority\": 9, \"number_of_moves\": \"71\", \"number_of_trades\": 0, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"clinched_playoffs\": 1, \"league_scoring_type\": \"head\", \"draft_position\": 4, \"has_draft_grade\": 1, \"draft_grade\": \"B\", \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1/draftrecap\", \"managers\": { \"manager\": { \"guid\": \"BMACD7S5UXV7JIQX4PGGUVQJAU\", \"manager_id\": \"1\", \"nickname\": \"--hidden--\" } } }) Returns: Team: YFPY Team instance. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /metadata\" , [ \"team\" ], Team ) def get_team_stats ( self , team_id : Union [ str , int ]) -> TeamPoints : \"\"\"Retrieve stats of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_stats(1) TeamPoints({ \"coverage_type\": \"season\", \"season\": \"2014\", \"total\": \"1409.24\" }) Returns: TeamPoints: YFPY TeamPoints instance. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /stats\" , [ \"team\" , \"team_points\" ], TeamPoints ) def get_team_stats_by_week ( self , team_id : Union [ str , int ], chosen_week : Union [ int , str ] = \"current\" ) -> Dict [ str , Union [ TeamPoints , TeamProjectedPoints ]]: \"\"\"Retrieve stats of specific team by team_id and by week for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_stats_by_week(1, 1) { \"team_points\": TeamPoints({ \"coverage_type\": \"week\", \"total\": \"95.06\", \"week\": \"1\" }), \"team_projected_points\": TeamProjectedPoints({ \"coverage_type\": \"week\", \"total\": \"78.85\", \"week\": \"1\" }) } Returns: dict[str, TeamPoints | TeamProjectedPoints]: Dictionary containing keys \"team_points\" and \"team_projected_points\" with respective values YFPY TeamPoints and YFPY TeamProjectedPoints instances. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /stats;type=week;week= { chosen_week } \" , [ \"team\" , [ \"team_points\" , \"team_projected_points\" ]] ) def get_team_standings ( self , team_id : Union [ str , int ]) -> TeamStandings : \"\"\"Retrieve standings of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_standings(1) TeamStandings({ \"rank\": 2, \"playoff_seed\": \"2\", \"outcome_totals\": { \"losses\": 5, \"percentage\": 0.643, \"ties\": 0, \"wins\": 9 }, \"streak\": { \"type\": \"win\", \"value\": \"1\" }, \"points_for\": \"1409.24\", \"points_against\": 1266.6599999999999 }) Returns: TeamStandings: YFPY TeamStandings instance. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /standings\" , [ \"team\" , \"team_standings\" ], TeamStandings ) def get_team_roster_by_week ( self , team_id : Union [ str , int ], chosen_week : Union [ int , str ] = \"current\" ) -> Roster : \"\"\"Retrieve roster of specific team by team_id and by week for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_roster_by_week(1, 1) Roster({ \"coverage_type\": \"week\", \"week\": \"1\", \"is_editable\": 0, \"players\": [ { \"player\": { \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt 3PTQ2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"1\" }, \"uniform_number\": \"12\" } }, ... ] }) Returns: Roster: YFPY Roster instance. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /roster;week= { chosen_week } \" , [ \"team\" , \"roster\" ], Roster ) def get_team_roster_player_info_by_week ( self , team_id : Union [ str , int ], chosen_week : Union [ int , str ] = \"current\" ) -> List [ Player ]: \"\"\"Retrieve roster with ALL player info of specific team by team_id and by week for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_roster_player_info_by_week(1, 1) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"draft_analysis\": { \"average_pick\": \"65.9\", \"average_round\": \"7.6\", \"average_cost\": \"5.0\", \"percent_drafted\": \"1.00\" }, \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/ https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"ownership\": { \"ownership_type\": \"team\", \"owner_team_key\": \"331.l.729259.t.1\", \"owner_team_name\": \"Hellacious Hill 12\" }, \"percent_owned\": { \"coverage_type\": \"week\", \"week\": \"17\", \"value\": 99, \"delta\": \"0\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"player_points\": { \"coverage_type\": \"week\", \"week\": \"1\", \"total\": 10.26 }, \"player_stats\": { \"coverage_type\": \"week\", \"week\": \"1\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"249\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"1\" }, \"uniform_number\": \"12\" }), ..., Player({...}) ] Returns: list[Player]: List of YFPY Player instances containing attributes \"draft_analysis\", \"ownership\", \"percent_owned\", and \"player_stats\". \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /roster;week= { chosen_week } /players;\" f \"out=metadata,stats,ownership,percent_owned,draft_analysis\" , [ \"team\" , \"roster\" , \"0\" , \"players\" ] ) def get_team_roster_player_info_by_date ( self , team_id : Union [ str , int ], chosen_date : str = None ) -> List [ Player ]: \"\"\"Retrieve roster with ALL player info of specific team by team_id and by date for chosen league. Note: This applies to MLB, NBA, and NHL leagues, but does NOT apply to NFL leagues. This query will FAIL if you pass it an INVALID date string! Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_date (str): Selected date for which to retrieve data. REQUIRED FORMAT: YYYY-MM-DD (Ex. 2011-05-01) Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nhl\") >>> query.get_team_roster_player_info_by_date(1, \"2011-05-01\") [ Player({ \"display_position\": \"C\", \"draft_analysis\": { \"average_pick\": 33.2, \"average_round\": 3.5, \"average_cost\": 39.2, \"percent_drafted\": 1.0 }, \"editorial_player_key\": \"nhl.p.3981\", \"editorial_team_abbr\": \"Chi\", \"editorial_team_full_name\": \"Chicago Blackhawks\", \"editorial_team_key\": \"nhl.t.4\", \"eligible_positions\": [ \"C\", \"F\" ], \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/tz.KOMoEiBDch6AJAGaUtg--~C/ YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/ https://s.yimg.com/xe/i/us/sp/v/nhl_cutout/players_l/11032021/3981.png\" }, \"is_editable\": 0, \"is_undroppable\": 0, \"name\": { \"ascii_first\": \"Jonathan\", \"ascii_last\": \"Toews\", \"first\": \"Jonathan\", \"full\": \"Jonathan Toews\", \"last\": \"Toews\" }, \"ownership\": { \"ownership_type\": \"team\", \"owner_team_key\": \"303.l.69624.t.2\", \"owner_team_name\": \"The Bateleurs\" }, \"percent_owned\": { \"coverage_type\": \"week\", \"week\": 25, \"value\": 98, \"delta\": -1.0 }, \"player_id\": 3981, \"player_key\": \"303.p.3981\", \"player_notes_last_timestamp\": 1651606838, \"player_stats\": { \"coverage_type\": \"date\", \"stats\": [ { \"stat\": { \"stat_id\": 1, \"value\": 1.0 } }, ... ] }, \"position_type\": \"P\", \"primary_position\": \"C\", \"selected_position\": { \"coverage_type\": \"date\", \"is_flex\": 0, \"position\": \"C\" }, \"uniform_number\": 19 }), ..., Player({...}) ] Returns: list[Player]: List of YFPY Player instances containing attributes \"draft_analysis\", \"ownership\", \"percent_owned\", and \"player_stats\". \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /\" f \"roster { ';date=' + str ( chosen_date ) if chosen_date else '' } /players;\" f \"out=metadata,stats,ownership,percent_owned,draft_analysis\" , [ \"team\" , \"roster\" , \"0\" , \"players\" ] ) def get_team_roster_player_stats ( self , team_id : Union [ str , int ]) -> List [ Player ]: \"\"\"Retrieve roster with ALL player info for the season of specific team by team_id and for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_roster_player_stats(1) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"draft_analysis\": { \"average_pick\": \"65.9\", \"average_round\": \"7.6\", \"average_cost\": \"5.0\", \"percent_drafted\": \"1.00\" }, \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"player_points\": { \"coverage_type\": \"season\", \"total\": 287.06 }, \"player_stats\": { \"coverage_type\": \"season\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"4109\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"16\" }, \"uniform_number\": \"12\" }), ..., Player({...}) ] Returns: list[Player]: List of YFPY Player instances containing attributes \"draft_analysis\", \"ownership\", \"percent_owned\", and \"player_stats\". \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /roster/players/stats;type=season\" , [ \"team\" , \"roster\" , \"0\" , \"players\" ] ) def get_team_roster_player_stats_by_week ( self , team_id : Union [ str , int ], chosen_week : Union [ int , str ] = \"current\" ) -> List [ Player ]: \"\"\"Retrieve roster with player stats of specific team by team_id and by week for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_roster_player_stats_by_week(1, 1) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt 3PTQ2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"player_points\": { \"coverage_type\": \"week\", \"week\": \"1\", \"total\": 10.26 }, \"player_stats\": { \"coverage_type\": \"week\", \"week\": \"1\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"249\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"1\" }, \"uniform_number\": \"12\" }), ..., Player({...}) ] Returns: list[Player]: List of YFPY Player instances containing attribute \"player_stats\". \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /roster;week= { chosen_week } /players/stats\" , [ \"team\" , \"roster\" , \"0\" , \"players\" ] ) def get_team_draft_results ( self , team_id : Union [ str , int ]) -> List [ DraftResult ]: \"\"\"Retrieve draft results of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_draft_results(1) [ DraftResult({ \"pick\": 4, \"round\": 1, \"team_key\": \"331.l.729259.t.1\", \"player_key\": \"331.p.8256\" }), ..., DraftResults({...}) ] Returns: list[DraftResult]: List of YFPY DraftResult instances. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /draftresults\" , [ \"team\" , \"draft_results\" ] ) def get_team_matchups ( self , team_id : Union [ str , int ]) -> List [ Matchup ]: \"\"\"Retrieve matchups of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_matchups(1) [ Matchup({ (see get_league_matchups_by_week docstring for matchup data example) }) ] Returns: list[Matchup]: List of YFPY Matchup instances. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /matchups\" , [ \"team\" , \"matchups\" ] ) def get_player_stats_for_season ( self , player_key : str , limit_to_league_stats : bool = True ) -> Player : \"\"\"Retrieve stats of specific player by player_key for the entire season for chosen league. Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). limit_to_league_stats (bool): Boolean (default: True) to limit the retrieved player stats to those for the selected league. When set to False, query retrieves all player stats for the game (NFL, NHL, NBA, MLB). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_player_stats_for_season(\"331.p.7200\") Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"player_points\": { \"coverage_type\": \"season\", \"total\": 359.14 }, \"player_stats\": { \"coverage_type\": \"season\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"4381\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player: YFPY Player instance. \"\"\" if limit_to_league_stats : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /stats\" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player ) else : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/players;\" f \"player_keys= { player_key } /stats\" , [ \"players\" , \"0\" , \"player\" ], Player ) def get_player_stats_by_week ( self , player_key : str , chosen_week : Union [ int , str ] = \"current\" , limit_to_league_stats : bool = True ) -> Player : \"\"\"Retrieve stats of specific player by player_key and by week for chosen league. Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). chosen_week (int): Selected week for which to retrieve data. limit_to_league_stats (bool): Boolean (default: True) to limit the retrieved player stats to those for the selected league. When set to False, query retrieves all player stats for the game (NFL, NHL, NBA, MLB). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_player_stats_by_week(\"331.p.7200\", 1) Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"player_points\": { \"coverage_type\": \"week\", \"week\": \"1\", \"total\": 10.56 }, \"player_stats\": { \"coverage_type\": \"week\", \"week\": \"1\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"189\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player: YFPY Player instance containing attribute \"player_stats\". \"\"\" if limit_to_league_stats : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /stats;type=week;week= { chosen_week } \" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player ) else : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/players;\" f \"player_keys= { player_key } /stats;type=week;week= { chosen_week } \" , [ \"players\" , \"0\" , \"player\" ], Player ) def get_player_stats_by_date ( self , player_key : str , chosen_date : str = None , limit_to_league_stats : bool = True ) -> Player : \"\"\"Retrieve player stats by player_key and by date for chosen league. Note: This applies to MLB, NBA, and NHL leagues, but does NOT apply to NFL leagues. This query will FAIL if you pass it an INVALID date string! Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). chosen_date (str): Selected date for which to retrieve data. REQUIRED FORMAT: YYYY-MM-DD (Ex. 2011-05-01) limit_to_league_stats (bool): Boolean (default: True) to limit the retrieved player stats to those for the selected league. When set to False, query retrieves all player stats for the game (NFL, NHL, NBA, MLB). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nhl\") >>> query.get_player_stats_by_date(\"nhl.p.4588\", \"2011-05-01\") Player({ \"display_position\": \"G\", \"editorial_player_key\": \"nhl.p.4588\", \"editorial_team_abbr\": \"Was\", \"editorial_team_full_name\": \"Washington Capitals\", \"editorial_team_key\": \"nhl.t.23\", \"eligible_positions\": { \"position\": \"G\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/CzntDh_d59voTqU6fhQy3g--~C/YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2 NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/https://s.yimg.com/ xe/i/us/sp/v/nhl_cutout/players_l/10182019/4588.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Braden\", \"ascii_last\": \"Holtby\", \"first\": \"Braden\", \"full\": \"Braden Holtby\", \"last\": \"Holtby\" }, \"player_id\": \"4588\", \"player_key\": \"303.p.4588\", \"player_notes_last_timestamp\": 1574133600, \"player_stats\": { \"coverage_type\": \"date\", \"stats\": [ { \"stat\": { \"stat_id\": \"19\", \"value\": \"1\" } }, { \"stat\": { \"stat_id\": \"22\", \"value\": \"1\" } }, { \"stat\": { \"stat_id\": \"23\", \"value\": \"1.00\" } }, { \"stat\": { \"stat_id\": \"25\", \"value\": \"29\" } }, { \"stat\": { \"stat_id\": \"24\", \"value\": \"30\" } }, { \"stat\": { \"stat_id\": \"26\", \"value\": \".967\" } }, { \"stat\": { \"stat_id\": \"27\", \"value\": \"0\" } } ] }, \"position_type\": \"G\", \"primary_position\": \"G\", \"uniform_number\": \"70\" }) Returns: Player: YFPY Player instnace containing attribute \"player_stats\". \"\"\" if limit_to_league_stats : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /stats;type=date;date= { chosen_date } \" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player ) else : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/players;\" f \"player_keys= { player_key } /stats;type=date;date= { chosen_date } \" , [ \"players\" , \"0\" , \"player\" ], Player ) def get_player_ownership ( self , player_key : str ) -> Player : \"\"\"Retrieve ownership of specific player by player_key for chosen league. Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_player_ownership(\"331.p.7200\") Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"ownership\": { \"ownership_type\": \"team\", \"owner_team_key\": \"331.l.729259.t.4\", \"owner_team_name\": \"hold my D\", \"teams\": { \"team\": { \"clinched_playoffs\": 1, \"draft_grade\": \"B-\", \"draft_position\": 1, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/4/draftrecap\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"5KLNXUYW5RP22UMRKUXHBCIITI\", \"manager_id\": \"4\", \"nickname\": \"--hidden--\" } }, \"name\": \"hold my D\", \"number_of_moves\": \"27\", \"number_of_trades\": \"1\", \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"4\", \"team_key\": \"331.l.729259.t.4\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1589/24677593583_68859308dd_192sq.jpg?ct=fantasy\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/4\", \"waiver_priority\": 7 } } }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player: YFPY Player instance containing attribute \"ownership\". \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /ownership\" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player ) def get_player_percent_owned_by_week ( self , player_key : str , chosen_week : Union [ int , str ] = \"current\" ) -> Player : \"\"\"Retrieve percent-owned of specific player by player_key and by week for chosen league. Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_player_percent_owned_by_week(\"331.p.7200\", 1) Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/ https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"percent_owned\": { \"coverage_type\": \"week\", \"week\": \"1\", \"value\": 100, \"delta\": \"0\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player: YFPY Player instance containing attribute \"percent_owned\". \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /percent_owned;type=week;week= { chosen_week } \" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player ) def get_player_draft_analysis ( self , player_key : str ) -> Player : \"\"\"Retrieve draft analysis of specific player by player_key for chosen league. Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_player_draft_analysis(\"331.p.7200\") Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"draft_analysis\": { \"average_pick\": \"19.9\", \"average_round\": \"2.8\", \"average_cost\": \"38.5\", \"percent_drafted\": \"1.00\" }, \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player: YFPY Player instance containing attribute \"draft_analysis\". \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /draft_analysis\" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player )","title":"YahooFantasySportsQuery"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.__init__","text":"__init__ ( league_id , game_code , game_id = None , yahoo_consumer_key = None , yahoo_consumer_secret = None , yahoo_access_token_json = None , env_var_fallback = True , env_file_location = None , save_token_data_to_env_file = False , all_output_as_json_str = False , browser_callback = not runtime_environment_is_docker , retries = 3 , backoff = 0 , offline = False , ) Instantiate a YahooQueryObject for running queries against the Yahoo fantasy REST API. Parameters: league_id ( str ) \u2013 League ID of selected Yahoo Fantasy league. game_code ( str ) \u2013 Game code of selected Yahoo Fantasy game corresponding to a specific sport (refers to the current season if used as the value for game_key), where \"nfl\" is for fantasy football, \"nhl\" is for fantasy hockey, \"mlb\" is for fantasy baseball, and \"nba\" is for fantasy basketball. game_id \u2013 obj: int , optional): Game ID of selected Yahoo fantasy game corresponding to a specific year, and defaulting to the game ID for the current year. yahoo_consumer_key \u2013 obj: str , optional): User defined Yahoo developer app consumer key (must be provided in conjunction with yahoo_consumer_secret). yahoo_consumer_secret \u2013 obj: str , optional): User defined Yahoo developer app consumer secret (must be provided in conjunction with yahoo_consumer_key). yahoo_access_token_json ( str | dict , default: None ) \u2013 User defined JSON (string or dict) containing refreshable access token generated by the yahoo-oauth library to avoid having to reauthenticate on every access to the Yahoo Fantasy Sports API (overrides yahoo_consumer_key/yahoo_consumer_secret and all Yahoo access token environment variables). env_var_fallback \u2013 obj: bool , optional): Fall back to values retrieved from environment variables for any missing arguments or access token fields (defaults to True). env_file_location \u2013 obj: Path , optional): Path to directory where existing .env file is located or new .env file should be generated when provided in conjunction with save_access_token_data_to_env_file=True (defaults to None). save_token_data_to_env_file \u2013 obj: bool , optional): Boolean to save Yahoo access token data to local .env file (must be provided in conjunction with env_file_location) (defaults to False) all_output_as_json_str \u2013 obj: bool , optional): Option to automatically convert all query output to JSON strings. browser_callback \u2013 obj: bool , optional): Enable or disable (enabled by default) whether the yahoo-oauth library automatically opens a browser window to authenticate (if disabled, it will output the callback URL). retries \u2013 obj: int , optional): Number of times to retry a query if it fails (defaults to 3). backoff \u2013 obj: int , optional): Multiplier that incrementally increases the wait time before retrying a failed query request. offline \u2013 obj: bool , optional): Boolean to run in offline mode (Only works if all needed Yahoo Fantasy data has been previously saved locally using the Data module in data.py). Attributes: _env_var_fallback ( bool ) \u2013 Fall back to values retrieved from environment variables for any missing arguments or access token fields. _yahoo_access_token_dict ( dict [ str , Any ] ) \u2013 Dictionary containing refreshable access token data generated by the yahoo-oauth library to avoid having to reauthenticate on every access to the Yahoo Fantasy Sports API. _yahoo_consumer_key ( str ) \u2013 User defined Yahoo developer app consumer key. _yahoo_consumer_secret ( str ) \u2013 User defined Yahoo developer app consumer secret. _browser_callback ( bool ) \u2013 Enable or disable (enabled by default) whether the yahoo-oauth library automatically opens a browser window to authenticate (if disabled, it will output the callback URL). _retries ( int ) \u2013 Number of times to retry a query if it fails (defaults to 3). _backoff ( int ) \u2013 Multiplier that incrementally increases the wait time before retrying a failed query request. _fantasy_content_data_field ( str ) \u2013 The initial JSON field in which all Yahoo Fantasy Sports API responses store the data output of the submitted query. league_id ( str ) \u2013 League ID of selected Yahoo Fantasy league. game_code ( str ) \u2013 Game code of selected Yahoo Fantasy game corresponding to a specific sport (refers to the current season if used as the value for game_key), where \"nfl\" is for fantasy football, \"nhl\" is for fantasy hockey, \"mlb\" is for fantasy baseball, and \"nba\" is for fantasy basketball. game_id ( int ) \u2013 Game ID of selected Yahoo fantasy game corresponding to a specific year, and defaulting to the game ID for the current year. league_key ( str ) \u2013 The Yahoo Fantasy Sports league key formatted as .l. . executed_queries ( list [ dict [ str , Any ]] ) \u2013 List of completed queries and their responses. all_output_as_json_str ( bool ) \u2013 Option to automatically convert all query output to JSON strings. offline ( bool ) \u2013 Boolean to run in offline mode (Only works if all needed Yahoo Fantasy data has been previously saved locally using the Data module in data.py). Source code in yfpy/query.py 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 227 228 229 230 231 232 233 234 def __init__ ( self , league_id : str , game_code : str , game_id : Optional [ int ] = None , yahoo_consumer_key : Optional [ str ] = None , yahoo_consumer_secret : Optional [ str ] = None , yahoo_access_token_json : Optional [ Union [ str , Dict ]] = None , env_var_fallback : bool = True , env_file_location : Optional [ Path ] = None , save_token_data_to_env_file : Optional [ bool ] = False , all_output_as_json_str : bool = False , browser_callback : bool = not runtime_environment_is_docker , retries : int = 3 , backoff : int = 0 , offline : bool = False ): \"\"\"Instantiate a YahooQueryObject for running queries against the Yahoo fantasy REST API. Args: league_id (str): League ID of selected Yahoo Fantasy league. game_code (str): Game code of selected Yahoo Fantasy game corresponding to a specific sport (refers to the current season if used as the value for game_key), where \"nfl\" is for fantasy football, \"nhl\" is for fantasy hockey, \"mlb\" is for fantasy baseball, and \"nba\" is for fantasy basketball. game_id (:obj:`int`, optional): Game ID of selected Yahoo fantasy game corresponding to a specific year, and defaulting to the game ID for the current year. yahoo_consumer_key (:obj:`str`, optional): User defined Yahoo developer app consumer key (must be provided in conjunction with yahoo_consumer_secret). yahoo_consumer_secret (:obj:`str`, optional): User defined Yahoo developer app consumer secret (must be provided in conjunction with yahoo_consumer_key). yahoo_access_token_json (str | dict, optional): User defined JSON (string or dict) containing refreshable access token generated by the yahoo-oauth library to avoid having to reauthenticate on every access to the Yahoo Fantasy Sports API (overrides yahoo_consumer_key/yahoo_consumer_secret and all Yahoo access token environment variables). env_var_fallback (:obj:`bool`, optional): Fall back to values retrieved from environment variables for any missing arguments or access token fields (defaults to True). env_file_location (:obj:`Path`, optional): Path to directory where existing .env file is located or new .env file should be generated when provided in conjunction with save_access_token_data_to_env_file=True (defaults to None). save_token_data_to_env_file (:obj:`bool`, optional): Boolean to save Yahoo access token data to local .env file (must be provided in conjunction with env_file_location) (defaults to False) all_output_as_json_str (:obj:`bool`, optional): Option to automatically convert all query output to JSON strings. browser_callback (:obj:`bool`, optional): Enable or disable (enabled by default) whether the yahoo-oauth library automatically opens a browser window to authenticate (if disabled, it will output the callback URL). retries (:obj:`int`, optional): Number of times to retry a query if it fails (defaults to 3). backoff (:obj:`int`, optional): Multiplier that incrementally increases the wait time before retrying a failed query request. offline (:obj:`bool`, optional): Boolean to run in offline mode (Only works if all needed Yahoo Fantasy data has been previously saved locally using the Data module in data.py). Attributes: _env_var_fallback (bool): Fall back to values retrieved from environment variables for any missing arguments or access token fields. _yahoo_access_token_dict (dict[str, Any]): Dictionary containing refreshable access token data generated by the yahoo-oauth library to avoid having to reauthenticate on every access to the Yahoo Fantasy Sports API. _yahoo_consumer_key (str): User defined Yahoo developer app consumer key. _yahoo_consumer_secret (str): User defined Yahoo developer app consumer secret. _browser_callback (bool): Enable or disable (enabled by default) whether the yahoo-oauth library automatically opens a browser window to authenticate (if disabled, it will output the callback URL). _retries (int): Number of times to retry a query if it fails (defaults to 3). _backoff (int): Multiplier that incrementally increases the wait time before retrying a failed query request. _fantasy_content_data_field (str): The initial JSON field in which all Yahoo Fantasy Sports API responses store the data output of the submitted query. league_id (str): League ID of selected Yahoo Fantasy league. game_code (str): Game code of selected Yahoo Fantasy game corresponding to a specific sport (refers to the current season if used as the value for game_key), where \"nfl\" is for fantasy football, \"nhl\" is for fantasy hockey, \"mlb\" is for fantasy baseball, and \"nba\" is for fantasy basketball. game_id (int): Game ID of selected Yahoo fantasy game corresponding to a specific year, and defaulting to the game ID for the current year. league_key (str): The Yahoo Fantasy Sports league key formatted as .l.. executed_queries (list[dict[str, Any]]): List of completed queries and their responses. all_output_as_json_str (bool): Option to automatically convert all query output to JSON strings. offline (bool): Boolean to run in offline mode (Only works if all needed Yahoo Fantasy data has been previously saved locally using the Data module in data.py). \"\"\" self . _env_var_fallback = env_var_fallback # load provided .env file if it exists to read any additional environment variables stored there if self . _env_var_fallback and env_file_location : env_file_path = env_file_location / \".env\" if env_file_path . is_file (): load_dotenv ( env_file_path ) self . _yahoo_access_token_dict : Dict [ str , Any ] = self . _get_dict_from_access_token_json ( yahoo_access_token_json ) # warn user that providing Yahoo access token JSON or populating a YAHOO_ACCESS_TOKEN_JSON environment variable # will override any values provided in the yahoo_consumer_key and yahoo_consumer_secret parameters if self . _yahoo_access_token_dict and ( yahoo_consumer_key or yahoo_consumer_secret ): logger . warning ( \"Providing a yahoo_access_token_json argument or setting env_var_fallback to True and having a \" \"YAHOO_ACCESS_TOKEN_JSON will override any values provided for yahoo_consumer_key or \" \"yahoo_consumer_secret.\" ) # retrieve the Yahoo consumer key and Yahoo consumer secret from the access token dict and fall back to the # provided parameters if no dict exists self . _yahoo_consumer_key = self . _yahoo_access_token_dict . get ( \"consumer_key\" , yahoo_consumer_key ) self . _yahoo_consumer_secret = self . _yahoo_access_token_dict . get ( \"consumer_secret\" , yahoo_consumer_secret ) # catch when a Yahoo consumer key was not provided if not self . _yahoo_consumer_key : # check for YAHOO_CONSUMER_KEY environment variable value if env_var_fallback is True if self . _env_var_fallback : if yahoo_consumer_key_env_var := os . environ . get ( \"YAHOO_CONSUMER_KEY\" ): self . _yahoo_consumer_key = yahoo_consumer_key_env_var if not self . _yahoo_consumer_key : logger . error ( \"Missing required Yahoo consumer key (no yahoo_consumer_key argument provided to \" \"YahooFantasySportsQuery, no consumer_key value provided in yahoo_access_token_json, or no \" \"YAHOO_CONSUMER_KEY environment variable value found).\" ) sys . exit ( 1 ) # catch when a Yahoo consumer secret was not provided if not self . _yahoo_consumer_secret : # check for YAHOO_CONSUMER_SECRET environment variable value if env_var_fallback is True if self . _env_var_fallback : if yahoo_consumer_secret_env_var := os . environ . get ( \"YAHOO_CONSUMER_SECRET\" ): self . _yahoo_consumer_secret = yahoo_consumer_secret_env_var if not self . _yahoo_consumer_secret : logger . error ( \"Missing required Yahoo consumer secret (no yahoo_consumer_secret argument provided to \" \"YahooFantasySportsQuery, no consumer_secret value provided in yahoo_access_token_json, or no \" \"YAHOO_CONSUMER_SECRET environment variable value found).\" ) sys . exit ( 1 ) # explicitly check for truthy/falsy value self . _browser_callback : bool = True if browser_callback is True else False self . _retries : int = retries self . _backoff : int = backoff self . _fantasy_content_data_field : str = \"fantasy_content\" self . league_id : str = league_id self . game_code : str = ( game_code if game_code in yahoo_fantasy_sports_game_codes else retrieve_game_code_from_user () ) self . game_id : int = game_id self . league_key : str = None self . executed_queries : List [ Dict [ str , Any ]] = [] # explicitly check for truthy/falsy value self . all_output_as_json_str : bool = True if all_output_as_json_str is True else False # explicitly check for truthy/falsy value self . offline : bool = True if offline is True else False if not self . offline : self . _authenticate () if save_token_data_to_env_file : self . save_access_token_data_to_env_file ( env_file_location )","title":"__init__"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.save_access_token_data_to_env_file","text":"save_access_token_data_to_env_file ( env_file_location , env_file_name = \".env\" , save_json_to_var_only = False , ) Saves the fields and values of a Yahoo access token into a .env file. Parameters: env_file_location \u2013 obj: Path , optional): Path to directory where existing .env file is located or new .env file should be generated. env_file_name \u2013 obj: str , optional): The name of the target .env file (defaults to \".env\"). save_json_to_var_only \u2013 obj: bool , optional): Boolean to determine whether or not to write a JSON string of Yahoo access token fields to a YAHOO_ACCESS_TOKEN_JSON environment variable in the target .env file instead of writing Yahoo access token fields to separate environment variables in the target .env file. (defaults to False). Returns: None \u2013 None Source code in yfpy/query.py 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 def save_access_token_data_to_env_file ( self , env_file_location : Path , env_file_name : str = \".env\" , save_json_to_var_only : bool = False ) -> None : \"\"\"Saves the fields and values of a Yahoo access token into a .env file. Args: env_file_location (:obj:`Path`, optional): Path to directory where existing .env file is located or new .env file should be generated. env_file_name (:obj:`str`, optional): The name of the target .env file (defaults to \".env\"). save_json_to_var_only (:obj:`bool`, optional): Boolean to determine whether or not to write a JSON string of Yahoo access token fields to a YAHOO_ACCESS_TOKEN_JSON environment variable in the target .env file instead of writing Yahoo access token fields to separate environment variables in the target .env file. (defaults to False). Returns: None \"\"\" if env_file_location : env_file_path = env_file_location / env_file_name else : logger . warning ( \"Missing argument env_file_location. Yahoo access token will NOT be saved to .env file.\" ) # exit method without saving Yahoo access token data when no env_file_location argument is provided return env_file_content = self . _retrieve_env_file_contents ( env_file_path ) if save_json_to_var_only : # generate a JSON string with escaped double quotes using nested json.dumps() and write it to a # YAHOO_ACCESS_TOKEN_JSON environment variable if save_json_to_var_only is set to True instead of writing # Yahoo access token fields to separate environment variables in target .env file env_file_content [ \"yahoo_access_token_json\" ] = json . dumps ( json . dumps ( self . _yahoo_access_token_dict )) else : # replace values of any matching environment variables in .env file with values from Yahoo access token # fields or add new environment variables to .env file if any fields are missing for k , v in self . _yahoo_access_token_dict . items (): env_file_content [ f \"yahoo_ { k } \" ] = v # write contents to .env file (overwrites contents if file exists or creates a new file if not) with open ( env_file_path , \"w\" ) as env_file : for k , v in env_file_content . items (): if k . startswith ( \"blank\" ): env_file . write ( v ) elif k . startswith ( \"comment\" ): env_file . write ( f \" { v } \\n \" ) else : env_file . write ( f \" { k . upper () } = { v } \\n \" )","title":"save_access_token_data_to_env_file"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_response","text":"get_response ( url ) Retrieve Yahoo Fantasy Sports data from the REST API. Parameters: url ( str ) \u2013 REST API request URL string. Returns: Response ( Response ) \u2013 API response from Yahoo Fantasy Sports API request. Source code in yfpy/query.py 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 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 def get_response ( self , url : str ) -> Response : \"\"\"Retrieve Yahoo Fantasy Sports data from the REST API. Args: url (str): REST API request URL string. Returns: Response: API response from Yahoo Fantasy Sports API request. \"\"\" logger . debug ( f \"Making request to URL: { url } \" ) response : Response = self . oauth . session . get ( url , params = { \"format\" : \"json\" }) status_code = response . status_code # when you exceed Yahoo's allowed data request limits, they throw a request status code of 999 if status_code == 999 : raise HTTPError ( \"Yahoo data unavailable due to rate limiting. Please try again later.\" ) if status_code == 401 : self . _authenticate () response_json = {} try : response_json = response . json () logger . debug ( f \"Response (JSON): { response_json } \" ) except JSONDecodeError : response . raise_for_status () try : if ( status_code // 100 ) != 2 : # handle if the yahoo query returns an error if response_json . get ( \"error\" ): response_error_msg = response_json . get ( \"error\" ) . get ( \"description\" ) error_msg = f \"Attempt to retrieve data at URL { response . url } failed with error: \" \\ f \" \\\" { response_error_msg } \\\" \" logger . error ( error_msg ) raise YahooFantasySportsDataNotFound ( error_msg , url = response . url ) response . raise_for_status () except HTTPError as e : # retry with incremental back-off if self . _retries > 0 : self . _retries -= 1 self . _backoff += 1 logger . warning ( f \"Request for URL { url } failed with status code { response . status_code } . \" f \"Retrying { self . _retries } more time { 's' if self . _retries > 1 else '' } ...\" ) time . sleep ( 0.3 * self . _backoff ) response = self . get_response ( url ) else : # log error and terminate query if status code is not 200 after 3 retries logger . error ( f \"Request failed with status code: { response . status_code } - { e } \" ) response . raise_for_status () raw_response_data = response_json . get ( self . _fantasy_content_data_field ) # extract data from \"fantasy_content\" field if it exists if raw_response_data : logger . debug ( f \"Data fetched with query URL: { response . url } \" ) logger . debug ( f \"Response (Yahoo fantasy data extracted from: \" f \" \\\" { self . _fantasy_content_data_field } \\\" ): { raw_response_data } \" ) else : error_msg = f \"No data found at URL { response . url } when attempting extraction from field: \" \\ f \" \\\" { self . _fantasy_content_data_field } \\\" \" logger . error ( error_msg ) raise YahooFantasySportsDataNotFound ( error_msg , url = response . url ) return response","title":"get_response"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.query","text":"query ( url , data_key_list , data_type_class = None , sort_function = None , ) Base query class to retrieve requested data from the Yahoo fantasy sports REST API. Parameters: url ( str ) \u2013 REST API request URL string. data_key_list ( list [ str ] | list [ list [ str ]] ) \u2013 List of keys used to extract the specific data desired by the given query (supports strings and lists of strings). Supports lists containing only key strings such as [\"game\", \"stat_categories\"], and also supports lists containing key strings followed by lists of key strings such as [\"team\", [\"team_points\", \"team_projected_points\"]]. data_type_class \u2013 obj: Type , optional): Highest level data model type (if one exists for the retrieved data). sort_function ( Callable of sort function , default: None ) \u2013 Optional lambda function to return sorted query results. Returns: object ( Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]] ) \u2013 Model class instance from yfpy/models.py, dictionary, or list (depending on query), with unpacked Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]] \u2013 and parsed response data. Source code in yfpy/query.py 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 def query ( self , url : str , data_key_list : Union [ List [ str ], List [ List [ str ]]], data_type_class : Type = None , sort_function : Callable = None ) -> ( Union [ str , YFO , List [ YFO ], Dict [ str , YFO ]]): \"\"\"Base query class to retrieve requested data from the Yahoo fantasy sports REST API. Args: url (str): REST API request URL string. data_key_list (list[str] | list[list[str]]): List of keys used to extract the specific data desired by the given query (supports strings and lists of strings). Supports lists containing only key strings such as [\"game\", \"stat_categories\"], and also supports lists containing key strings followed by lists of key strings such as [\"team\", [\"team_points\", \"team_projected_points\"]]. data_type_class (:obj:`Type`, optional): Highest level data model type (if one exists for the retrieved data). sort_function (Callable of sort function, optional)): Optional lambda function to return sorted query results. Returns: object: Model class instance from yfpy/models.py, dictionary, or list (depending on query), with unpacked and parsed response data. \"\"\" if not self . offline : response = self . get_response ( url ) raw_response_data = response . json () . get ( self . _fantasy_content_data_field ) # print(json.dumps(raw_response_data, indent=2)) # iterate through list of data keys and drill down to final desired data field for i in range ( len ( data_key_list )): if isinstance ( raw_response_data , list ): if isinstance ( data_key_list [ i ], list ): reformatted = reformat_json_list ( raw_response_data ) raw_response_data = [ { data_key_list [ i ][ 0 ]: reformatted [ data_key_list [ i ][ 0 ]]}, { data_key_list [ i ][ 1 ]: reformatted [ data_key_list [ i ][ 1 ]]} ] else : raw_response_data = reformat_json_list ( raw_response_data )[ data_key_list [ i ]] else : if isinstance ( data_key_list [ i ], list ): raw_response_data = [ { data_key_list [ i ][ 0 ]: raw_response_data [ data_key_list [ i ][ 0 ]]}, { data_key_list [ i ][ 1 ]: raw_response_data [ data_key_list [ i ][ 1 ]]} ] else : raw_response_data = raw_response_data . get ( data_key_list [ i ]) if raw_response_data : logger . debug ( f \"Response (Yahoo fantasy data extracted from: { data_key_list } ): { raw_response_data } \" ) else : error_msg = f \"No data found when attempting extraction from fields: { data_key_list } \" logger . error ( error_msg ) raise YahooFantasySportsDataNotFound ( error_msg , payload = data_key_list , url = response . url ) # unpack, parse, and assign data types to all retrieved data content unpacked = unpack_data ( raw_response_data , YahooFantasyObject ) logger . debug ( f \"Unpacked and parsed JSON (Yahoo fantasy data wth parent type: { data_type_class } ): \\n { unpacked } \" ) self . executed_queries . append ({ \"url\" : response . url , \"response_status_code\" : response . status_code , \"response\" : response }) # cast the highest level of data to type corresponding to query (if type exists) query_data = data_type_class ( unpacked ) if data_type_class else unpacked # sort data when applicable if sort_function and not isinstance ( query_data , dict ): query_data = sorted ( query_data , key = sort_function ) # flatten lists of single-key dicts of objects into lists of those objects if isinstance ( query_data , list ): last_data_key = data_key_list [ - 1 ] if last_data_key . endswith ( \"s\" ): query_data = [ el [ last_data_key [: - 1 ]] for el in query_data ] if self . all_output_as_json_str : return jsonify_data ( query_data ) else : return query_data else : logger . error ( \"Cannot run Yahoo query while using offline mode! Please try again with offline=False.\" )","title":"query"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_all_yahoo_fantasy_game_keys","text":"get_all_yahoo_fantasy_game_keys () Retrieve all Yahoo Fantasy Sports game keys by ID (from year of inception to present), sorted by season/year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_all_yahoo_fantasy_game_keys () [ Game({ \"code\": \"nfl\", \"game_id\": \"50\", \"game_key\": \"50\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"1999\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/1999\" }), ..., Game({...}) ] Returns: List [ Game ] \u2013 list[Game]: List of YFPY Game instances. Source code in yfpy/query.py 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 def get_all_yahoo_fantasy_game_keys ( self ) -> List [ Game ]: \"\"\"Retrieve all Yahoo Fantasy Sports game keys by ID (from year of inception to present), sorted by season/year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_all_yahoo_fantasy_game_keys() [ Game({ \"code\": \"nfl\", \"game_id\": \"50\", \"game_key\": \"50\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"1999\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/1999\" }), ..., Game({...}) ] Returns: list[Game]: List of YFPY Game instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/games;game_codes= { self . game_code } \" , [ \"games\" ], sort_function = lambda x : x . get ( \"game\" ) . season )","title":"get_all_yahoo_fantasy_game_keys"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_game_key_by_season","text":"get_game_key_by_season ( season ) Retrieve specific game key by season. Parameters: season ( int ) \u2013 User defined season/year for which to retrieve the Yahoo Fantasy Sports game. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_game_key_by_season ( 2021 ) 338 Returns: str ( str ) \u2013 The game key for a Yahoo Fantasy Sports game specified by season. Source code in yfpy/query.py 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 def get_game_key_by_season ( self , season : int ) -> str : \"\"\"Retrieve specific game key by season. Args: season (int): User defined season/year for which to retrieve the Yahoo Fantasy Sports game. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_key_by_season(2021) 338 Returns: str: The game key for a Yahoo Fantasy Sports game specified by season. \"\"\" all_output_as_json = False if self . all_output_as_json_str : self . all_output_as_json_str = False all_output_as_json = True game_key = self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/games;game_codes= { self . game_code } ;seasons= { season } \" , [ \"games\" ] ) . get ( \"game\" ) . game_key if all_output_as_json : self . all_output_as_json_str = True return game_key","title":"get_game_key_by_season"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_current_game_info","text":"get_current_game_info () Retrieve game info for current fantasy season. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_current_game_info () Game({ \"code\": \"nfl\", \"game_id\": \"390\", \"game_key\": \"390\", \"game_weeks\": [ { \"game_week\": { \"display_name\": \"1\", \"end\": \"2019-09-09\", \"start\": \"2019-09-05\", \"week\": \"1\" } }, ... ], \"is_game_over\": 0, \"is_live_draft_lobby_active\": 1, \"is_offseason\": 0, \"is_registration_over\": 0, \"name\": \"Football\", \"position_types\": [ { \"position_type\": { \"type\": \"O\", \"display_name\": \"Offense\" } }, ... ], \"roster_positions\": [ { \"roster_position\": { \"position\": \"QB\", \"position_type\": \"O\" } }, ... ], \"season\": \"2019\", \"stat_categories\": { \"stats\": [ { \"stat\": { \"display_name\": \"GP\", \"name\": \"Games Played\", \"sort_order\": \"1\", \"stat_id\": 0 } }, ... }, \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/f1\" }) Returns: Game ( Game ) \u2013 YFPY Game instance. Source code in yfpy/query.py 646 647 648 649 650 651 652 653 654 655 656 657 658 659 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 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 def get_current_game_info ( self ) -> Game : \"\"\"Retrieve game info for current fantasy season. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_current_game_info() Game({ \"code\": \"nfl\", \"game_id\": \"390\", \"game_key\": \"390\", \"game_weeks\": [ { \"game_week\": { \"display_name\": \"1\", \"end\": \"2019-09-09\", \"start\": \"2019-09-05\", \"week\": \"1\" } }, ... ], \"is_game_over\": 0, \"is_live_draft_lobby_active\": 1, \"is_offseason\": 0, \"is_registration_over\": 0, \"name\": \"Football\", \"position_types\": [ { \"position_type\": { \"type\": \"O\", \"display_name\": \"Offense\" } }, ... ], \"roster_positions\": [ { \"roster_position\": { \"position\": \"QB\", \"position_type\": \"O\" } }, ... ], \"season\": \"2019\", \"stat_categories\": { \"stats\": [ { \"stat\": { \"display_name\": \"GP\", \"name\": \"Games Played\", \"sort_order\": \"1\", \"stat_id\": 0 } }, ... }, \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/f1\" }) Returns: Game: YFPY Game instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { self . game_code } ;\" f \"out=metadata,players,game_weeks,stat_categories,position_types,roster_positions\" , [ \"game\" ], Game )","title":"get_current_game_info"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_current_game_metadata","text":"get_current_game_metadata () Retrieve game metadata for current fantasy season. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_current_game_metadata () Game({ \"code\": \"nfl\", \"game_id\": \"390\", \"game_key\": \"390\", \"is_game_over\": 0, \"is_live_draft_lobby_active\": 1, \"is_offseason\": 0, \"is_registration_over\": 0, \"name\": \"Football\", \"season\": \"2019\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/f1\" }) Returns: Game ( Game ) \u2013 YFPY Game instance. Source code in yfpy/query.py 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 def get_current_game_metadata ( self ) -> Game : \"\"\"Retrieve game metadata for current fantasy season. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_current_game_metadata() Game({ \"code\": \"nfl\", \"game_id\": \"390\", \"game_key\": \"390\", \"is_game_over\": 0, \"is_live_draft_lobby_active\": 1, \"is_offseason\": 0, \"is_registration_over\": 0, \"name\": \"Football\", \"season\": \"2019\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/f1\" }) Returns: Game: YFPY Game instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { self . game_code } /metadata\" , [ \"game\" ], Game )","title":"get_current_game_metadata"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_game_info_by_game_id","text":"get_game_info_by_game_id ( game_id ) Retrieve game info for specific game by ID. Parameters: game_id ( int ) \u2013 Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_game_info_by_game_id ( 390 ) Game({ \"code\": \"nfl\", \"game_id\": \"390\", \"game_key\": \"390\", \"game_weeks\": [ { \"game_week\": { \"display_name\": \"1\", \"end\": \"2019-09-09\", \"start\": \"2019-09-05\", \"week\": \"1\" } }, ... ], \"is_game_over\": 0, \"is_live_draft_lobby_active\": 1, \"is_offseason\": 0, \"is_registration_over\": 0, \"name\": \"Football\", \"position_types\": [ { \"position_type\": { \"type\": \"O\", \"display_name\": \"Offense\" } }, ... ], \"roster_positions\": [ { \"roster_position\": { \"position\": \"QB\", \"position_type\": \"O\" } }, ... ], \"season\": \"2019\", \"stat_categories\": { \"stats\": [ { \"stat\": { \"display_name\": \"GP\", \"name\": \"Games Played\", \"sort_order\": \"1\", \"stat_id\": 0 } }, ... }, \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/f1\" }) Returns: Game ( Game ) \u2013 YFPY Game instance. Source code in yfpy/query.py 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 def get_game_info_by_game_id ( self , game_id : int ) -> Game : \"\"\"Retrieve game info for specific game by ID. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_info_by_game_id(390) Game({ \"code\": \"nfl\", \"game_id\": \"390\", \"game_key\": \"390\", \"game_weeks\": [ { \"game_week\": { \"display_name\": \"1\", \"end\": \"2019-09-09\", \"start\": \"2019-09-05\", \"week\": \"1\" } }, ... ], \"is_game_over\": 0, \"is_live_draft_lobby_active\": 1, \"is_offseason\": 0, \"is_registration_over\": 0, \"name\": \"Football\", \"position_types\": [ { \"position_type\": { \"type\": \"O\", \"display_name\": \"Offense\" } }, ... ], \"roster_positions\": [ { \"roster_position\": { \"position\": \"QB\", \"position_type\": \"O\" } }, ... ], \"season\": \"2019\", \"stat_categories\": { \"stats\": [ { \"stat\": { \"display_name\": \"GP\", \"name\": \"Games Played\", \"sort_order\": \"1\", \"stat_id\": 0 } }, ... }, \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/f1\" }) Returns: Game: YFPY Game instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } ;\" f \"out=metadata,players,game_weeks,stat_categories,position_types,roster_positions\" , [ \"game\" ], Game )","title":"get_game_info_by_game_id"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_game_metadata_by_game_id","text":"get_game_metadata_by_game_id ( game_id ) Retrieve game metadata for specific game by ID. Parameters: game_id ( int ) \u2013 Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_game_metadata_by_game_id ( 331 ) Game({ \"code\": \"nfl\", \"game_id\": \"331\", \"game_key\": \"331\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"2014\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014\" }) Returns: Game ( Game ) \u2013 YFPY Game instance. Source code in yfpy/query.py 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 def get_game_metadata_by_game_id ( self , game_id : int ) -> Game : \"\"\"Retrieve game metadata for specific game by ID. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_metadata_by_game_id(331) Game({ \"code\": \"nfl\", \"game_id\": \"331\", \"game_key\": \"331\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"2014\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014\" }) Returns: Game: YFPY Game instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } /metadata\" , [ \"game\" ], Game )","title":"get_game_metadata_by_game_id"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_game_weeks_by_game_id","text":"get_game_weeks_by_game_id ( game_id ) Retrieve all valid weeks of a specific game by ID. Parameters: game_id ( int ) \u2013 Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_game_weeks_by_game_id ( 331 ) [ GameWeek({ \"display_name\": \"1\", \"end\": \"2014-09-08\", \"start\": \"2014-09-04\", \"week\": \"1\" }), ..., GameWeek({ \"display_name\": \"17\", \"end\": \"2014-12-28\", \"start\": \"2014-12-23\", \"week\": \"17\" }) ] Returns: List [ GameWeek ] \u2013 list[GameWeek]: List of YFPY GameWeek instances. Source code in yfpy/query.py 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 def get_game_weeks_by_game_id ( self , game_id : int ) -> List [ GameWeek ]: \"\"\"Retrieve all valid weeks of a specific game by ID. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_weeks_by_game_id(331) [ GameWeek({ \"display_name\": \"1\", \"end\": \"2014-09-08\", \"start\": \"2014-09-04\", \"week\": \"1\" }), ..., GameWeek({ \"display_name\": \"17\", \"end\": \"2014-12-28\", \"start\": \"2014-12-23\", \"week\": \"17\" }) ] Returns: list[GameWeek]: List of YFPY GameWeek instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } /game_weeks\" , [ \"game\" , \"game_weeks\" ] )","title":"get_game_weeks_by_game_id"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_game_stat_categories_by_game_id","text":"get_game_stat_categories_by_game_id ( game_id ) Retrieve all valid stat categories of a specific game by ID. Parameters: game_id ( int ) \u2013 Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_game_stat_categories_by_game_id ( 331 ) StatCategories({ \"stats\": [ { \"stat\": { \"display_name\": \"GP\", \"name\": \"Games Played\", \"sort_order\": \"1\", \"stat_id\": 0 } }, ..., { \"stat\": { \"display_name\": \"Rush 1st Downs\", \"name\": \"Rushing 1st Downs\", \"sort_order\": \"1\", \"stat_id\": 81 } } ] }) Returns: StatCategories ( StatCategories ) \u2013 YFPY StatCategories instance. Source code in yfpy/query.py 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 def get_game_stat_categories_by_game_id ( self , game_id : int ) -> StatCategories : \"\"\"Retrieve all valid stat categories of a specific game by ID. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_stat_categories_by_game_id(331) StatCategories({ \"stats\": [ { \"stat\": { \"display_name\": \"GP\", \"name\": \"Games Played\", \"sort_order\": \"1\", \"stat_id\": 0 } }, ..., { \"stat\": { \"display_name\": \"Rush 1st Downs\", \"name\": \"Rushing 1st Downs\", \"sort_order\": \"1\", \"stat_id\": 81 } } ] }) Returns: StatCategories: YFPY StatCategories instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } /stat_categories\" , [ \"game\" , \"stat_categories\" ], StatCategories )","title":"get_game_stat_categories_by_game_id"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_game_position_types_by_game_id","text":"get_game_position_types_by_game_id ( game_id ) Retrieve all valid position types for specific game by ID sorted alphabetically by type. Parameters: game_id ( int ) \u2013 Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_game_position_types_by_game_id ( 331 ) [ PositionType({ \"type\": \"O\", \"display_name\": \"Offense\" }), ..., PositionType({ \"type\": \"K\", \"display_name\": \"Kickers\" }) ] Returns: List [ PositionType ] \u2013 list[PositionType]: List of YFPY PositionType instances. Source code in yfpy/query.py 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 def get_game_position_types_by_game_id ( self , game_id : int ) -> List [ PositionType ]: \"\"\"Retrieve all valid position types for specific game by ID sorted alphabetically by type. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_position_types_by_game_id(331) [ PositionType({ \"type\": \"O\", \"display_name\": \"Offense\" }), ..., PositionType({ \"type\": \"K\", \"display_name\": \"Kickers\" }) ] Returns: list[PositionType]: List of YFPY PositionType instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } /position_types\" , [ \"game\" , \"position_types\" ], sort_function = lambda x : x . get ( \"position_type\" ) . type )","title":"get_game_position_types_by_game_id"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_game_roster_positions_by_game_id","text":"get_game_roster_positions_by_game_id ( game_id ) Retrieve all valid roster positions for specific game by ID sorted alphabetically by position. Parameters: game_id ( int ) \u2013 Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_game_roster_positions_by_game_id ( 331 ) [ {RosterPosition({ \"position\": \"BN\" }), ..., RosterPosition({ \"position\": \"WR\", \"position_type\": \"O\" }) ] Returns: List [ RosterPosition ] \u2013 list[RosterPosition]: List of YFPY RosterPosition instances. Source code in yfpy/query.py 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 def get_game_roster_positions_by_game_id ( self , game_id : int ) -> List [ RosterPosition ]: \"\"\"Retrieve all valid roster positions for specific game by ID sorted alphabetically by position. Args: game_id (int): Game ID of selected Yahoo Fantasy game corresponding to a specific year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_game_roster_positions_by_game_id(331) [ {RosterPosition({ \"position\": \"BN\" }), ..., RosterPosition({ \"position\": \"WR\", \"position_type\": \"O\" }) ] Returns: list[RosterPosition]: List of YFPY RosterPosition instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/game/ { game_id } /roster_positions\" , [ \"game\" , \"roster_positions\" ], sort_function = lambda x : x . get ( \"roster_position\" ) . position )","title":"get_game_roster_positions_by_game_id"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_league_key","text":"get_league_key ( season = None ) Retrieve league key for selected league. Parameters: season ( int , default: None ) \u2013 User defined season/year for which to retrieve the Yahoo Fantasy Sports league key. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_league_key ( 2021 ) 331.l.729259 Returns: str ( str ) \u2013 League key string for selected league. Source code in yfpy/query.py 1007 1008 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 def get_league_key ( self , season : int = None ) -> str : \"\"\"Retrieve league key for selected league. Args: season (int): User defined season/year for which to retrieve the Yahoo Fantasy Sports league key. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_key(2021) 331.l.729259 Returns: str: League key string for selected league. \"\"\" if not self . league_key : if season : return f \" { self . get_game_key_by_season ( season ) } .l. { self . league_id } \" elif self . game_id : return f \" { self . get_game_metadata_by_game_id ( self . game_id ) . game_key } .l. { self . league_id } \" else : logger . warning ( \"No game id or season/year provided, defaulting to current fantasy season.\" ) return f \" { self . get_current_game_metadata () . game_key } .l. { self . league_id } \" else : return self . league_key","title":"get_league_key"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_current_user","text":"get_current_user () Retrieve metadata for current logged-in user. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_current_user () User({ \"guid\": \"USER_GUID_STRING\" }) Returns: User ( User ) \u2013 YFPY User instance. Source code in yfpy/query.py 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 def get_current_user ( self ) -> User : \"\"\"Retrieve metadata for current logged-in user. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_current_user() User({ \"guid\": \"USER_GUID_STRING\" }) Returns: User: YFPY User instance. \"\"\" return self . query ( \"https://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/\" , [ \"users\" , \"0\" , \"user\" ], User )","title":"get_current_user"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_user_games","text":"get_user_games () Retrieve game history for current logged-in user sorted by season/year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_user_games () [ Game({ \"code\": \"nfl\", \"game_id\": \"359\", \"game_key\": \"359\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"2016\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2016\" }) ..., Game({...}) ] Returns: List [ Game ] \u2013 list[Game]: List of YFPY Game instances. Source code in yfpy/query.py 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 def get_user_games ( self ) -> List [ Game ]: \"\"\"Retrieve game history for current logged-in user sorted by season/year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_user_games() [ Game({ \"code\": \"nfl\", \"game_id\": \"359\", \"game_key\": \"359\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"2016\", \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2016\" }) ..., Game({...}) ] Returns: list[Game]: List of YFPY Game instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/games;codes= { self . game_code } /\" , [ \"users\" , \"0\" , \"user\" , \"games\" ], sort_function = lambda x : x . get ( \"game\" ) . season )","title":"get_user_games"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_user_leagues_by_game_key","text":"get_user_leagues_by_game_key ( game_key ) Retrieve league history for current logged-in user for specific game by game IDs/keys sorted by season/year. Parameters: game_key ( int | str ) \u2013 The game_id (int) or game_key (str) for a specific Yahoo Fantasy game. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_user_leagues_by_game_key ( 331 ) [ League({ \"allow_add_to_dl_extra_pos\": 0, \"current_week\": \"16\", \"draft_status\": \"postdraft\", \"edit_key\": \"16\", \"end_date\": \"2018-12-24\", \"end_week\": \"16\", \"game_code\": \"nfl\", \"iris_group_chat_id\": \"\", \"is_cash_league\": \"0\", \"is_finished\": 1, \"is_pro_league\": \"0\", \"league_id\": \"169896\", \"league_key\": \"380.l.169896\", \"league_type\": \"private\", \"league_update_timestamp\": \"1546498723\", \"logo_url\": \"\", \"name\": \"League Name\", \"num_teams\": 12, \"password\": null, \"renew\": \"371_52364\", \"renewed\": \"390_78725\", \"scoring_type\": \"head\", \"season\": \"2018\", \"short_invitation_url\": \"\", \"start_date\": \"2018-09-06\", \"start_week\": \"1\", \"url\": \"\", \"weekly_deadline\": null }), ..., League({...}) ] Returns: List [ League ] \u2013 list[League]: List of YFPY League instances. Source code in yfpy/query.py 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 def get_user_leagues_by_game_key ( self , game_key : Union [ int , str ]) -> List [ League ]: \"\"\"Retrieve league history for current logged-in user for specific game by game IDs/keys sorted by season/year. Args: game_key (int | str): The game_id (int) or game_key (str) for a specific Yahoo Fantasy game. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_user_leagues_by_game_key(331) [ League({ \"allow_add_to_dl_extra_pos\": 0, \"current_week\": \"16\", \"draft_status\": \"postdraft\", \"edit_key\": \"16\", \"end_date\": \"2018-12-24\", \"end_week\": \"16\", \"game_code\": \"nfl\", \"iris_group_chat_id\": \"\", \"is_cash_league\": \"0\", \"is_finished\": 1, \"is_pro_league\": \"0\", \"league_id\": \"169896\", \"league_key\": \"380.l.169896\", \"league_type\": \"private\", \"league_update_timestamp\": \"1546498723\", \"logo_url\": \"\", \"name\": \"League Name\", \"num_teams\": 12, \"password\": null, \"renew\": \"371_52364\", \"renewed\": \"390_78725\", \"scoring_type\": \"head\", \"season\": \"2018\", \"short_invitation_url\": \"\", \"start_date\": \"2018-09-06\", \"start_week\": \"1\", \"url\": \"\", \"weekly_deadline\": null }), ..., League({...}) ] Returns: list[League]: List of YFPY League instances. \"\"\" leagues = self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/games;game_keys= { game_key } /leagues/\" , [ \"users\" , \"0\" , \"user\" , \"games\" , \"0\" , \"game\" , \"leagues\" ], sort_function = lambda x : x . get ( \"league\" ) . season ) return leagues if isinstance ( leagues , list ) else [ leagues . get ( \"league\" )]","title":"get_user_leagues_by_game_key"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_user_teams","text":"get_user_teams () Retrieve teams for all leagues for current logged-in user for current game sorted by season/year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_user_teams () [ Game({ \"code\": \"nfl\", \"game_id\": \"359\", \"game_key\": \"359\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"2016\", \"teams\": [ { \"team\": { \"draft_grade\": \"A\", \"draft_position\": 9, \"draft_recap_url\": \"\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": [ { \"manager\": { \"email\": \"\", \"guid\": \"\", \"image_url\": \"\", \"is_comanager\": \"1\", \"manager_id\": \"14\", \"nickname\": \"\" } } ], \"name\": \"Legion\", \"number_of_moves\": \"48\", \"number_of_trades\": \"2\", \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"1\", \"team_key\": \"359.l.5521.t.1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"\" } }, \"url\": \"\", \"waiver_priority\": 11 } } ], \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2016\" }) ..., Game({...}) ] Returns: List [ Game ] \u2013 list[Game]: List of YFPY Game instances with \"teams\" attribute containing list of YFPY Team instances. Source code in yfpy/query.py 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 def get_user_teams ( self ) -> List [ Game ]: \"\"\"Retrieve teams for all leagues for current logged-in user for current game sorted by season/year. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_user_teams() [ Game({ \"code\": \"nfl\", \"game_id\": \"359\", \"game_key\": \"359\", \"is_game_over\": 1, \"is_offseason\": 1, \"is_registration_over\": 1, \"name\": \"Football\", \"season\": \"2016\", \"teams\": [ { \"team\": { \"draft_grade\": \"A\", \"draft_position\": 9, \"draft_recap_url\": \"\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": [ { \"manager\": { \"email\": \"\", \"guid\": \"\", \"image_url\": \"\", \"is_comanager\": \"1\", \"manager_id\": \"14\", \"nickname\": \"\" } } ], \"name\": \"Legion\", \"number_of_moves\": \"48\", \"number_of_trades\": \"2\", \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"1\", \"team_key\": \"359.l.5521.t.1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"\" } }, \"url\": \"\", \"waiver_priority\": 11 } } ], \"type\": \"full\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2016\" }) ..., Game({...}) ] Returns: list[Game]: List of YFPY Game instances with \"teams\" attribute containing list of YFPY Team instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/games;codes= { self . game_code } /teams/\" , [ \"users\" , \"0\" , \"user\" , \"games\" ], sort_function = lambda x : x . get ( \"game\" ) . season )","title":"get_user_teams"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_league_info","text":"get_league_info () Retrieve info for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_league_info () League({ \"allow_add_to_dl_extra_pos\": 0, \"current_week\": \"16\", \"draft_status\": \"postdraft\", \"edit_key\": \"16\", \"end_date\": \"2014-12-22\", \"end_week\": \"16\", \"game_code\": \"nfl\", \"iris_group_chat_id\": null, \"is_cash_league\": \"0\", \"is_finished\": 1, \"is_pro_league\": \"1\", \"league_id\": \"729259\", \"league_key\": \"331.l.729259\", \"league_type\": \"public\", \"league_update_timestamp\": \"1420099793\", \"logo_url\": \"https://s.yimg.com/cv/api/default/20180206/default-league-logo@2x.png\", \"name\": \"Yahoo Public 729259\", \"num_teams\": 10, \"renew\": null, \"renewed\": null, \"scoreboard\": { \"week\": \"16\", \"matchups\": [ ... ] }, \"scoring_type\": \"head\", \"season\": \"2014\", \"settings\": { ... }, \"standings\": { \"teams\": [ ..., ... ], ... }, \"start_date\": \"2014-09-04\", \"start_week\": \"1\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259\", \"weekly_deadline\": null }) Returns: League ( League ) \u2013 YFPY League instance. Source code in yfpy/query.py 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 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 def get_league_info ( self ) -> League : \"\"\"Retrieve info for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_info() League({ \"allow_add_to_dl_extra_pos\": 0, \"current_week\": \"16\", \"draft_status\": \"postdraft\", \"edit_key\": \"16\", \"end_date\": \"2014-12-22\", \"end_week\": \"16\", \"game_code\": \"nfl\", \"iris_group_chat_id\": null, \"is_cash_league\": \"0\", \"is_finished\": 1, \"is_pro_league\": \"1\", \"league_id\": \"729259\", \"league_key\": \"331.l.729259\", \"league_type\": \"public\", \"league_update_timestamp\": \"1420099793\", \"logo_url\": \"https://s.yimg.com/cv/api/default/20180206/default-league-logo@2x.png\", \"name\": \"Yahoo Public 729259\", \"num_teams\": 10, \"renew\": null, \"renewed\": null, \"scoreboard\": { \"week\": \"16\", \"matchups\": [ ... ] }, \"scoring_type\": \"head\", \"season\": \"2014\", \"settings\": { ... }, \"standings\": { \"teams\": [ ..., ... ], ... }, \"start_date\": \"2014-09-04\", \"start_week\": \"1\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259\", \"weekly_deadline\": null }) Returns: League: YFPY League instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } ;\" f \"out=metadata,settings,standings,scoreboard,teams,players,draftresults,transactions\" , [ \"league\" ], League )","title":"get_league_info"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_league_metadata","text":"get_league_metadata () Retrieve metadata for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_league_metadata () League({ \"allow_add_to_dl_extra_pos\": 0, \"current_week\": \"16\", \"draft_status\": \"postdraft\", \"edit_key\": \"16\", \"end_date\": \"2014-12-22\", \"end_week\": \"16\", \"game_code\": \"nfl\", \"iris_group_chat_id\": null, \"is_cash_league\": \"0\", \"is_finished\": 1, \"is_pro_league\": \"1\", \"league_id\": \"729259\", \"league_key\": \"331.l.729259\", \"league_type\": \"public\", \"league_update_timestamp\": \"1420099793\", \"logo_url\": \"https://s.yimg.com/cv/api/default/20180206/default-league-logo@2x.png\", \"name\": \"Yahoo Public 729259\", \"num_teams\": 10, \"renew\": null, \"renewed\": null, \"scoring_type\": \"head\", \"season\": \"2014\", \"start_date\": \"2014-09-04\", \"start_week\": \"1\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259\", \"weekly_deadline\": null }) Returns: League ( League ) \u2013 YFPY League instance. Source code in yfpy/query.py 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 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 def get_league_metadata ( self ) -> League : \"\"\"Retrieve metadata for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_metadata() League({ \"allow_add_to_dl_extra_pos\": 0, \"current_week\": \"16\", \"draft_status\": \"postdraft\", \"edit_key\": \"16\", \"end_date\": \"2014-12-22\", \"end_week\": \"16\", \"game_code\": \"nfl\", \"iris_group_chat_id\": null, \"is_cash_league\": \"0\", \"is_finished\": 1, \"is_pro_league\": \"1\", \"league_id\": \"729259\", \"league_key\": \"331.l.729259\", \"league_type\": \"public\", \"league_update_timestamp\": \"1420099793\", \"logo_url\": \"https://s.yimg.com/cv/api/default/20180206/default-league-logo@2x.png\", \"name\": \"Yahoo Public 729259\", \"num_teams\": 10, \"renew\": null, \"renewed\": null, \"scoring_type\": \"head\", \"season\": \"2014\", \"start_date\": \"2014-09-04\", \"start_week\": \"1\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259\", \"weekly_deadline\": null }) Returns: League: YFPY League instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /metadata\" , [ \"league\" ], League )","title":"get_league_metadata"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_league_settings","text":"get_league_settings () Retrieve settings (rules) for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_league_settings () Settings({ \"cant_cut_list\": \"yahoo\", \"draft_time\": \"1408410000\", \"draft_type\": \"live\", \"has_multiweek_championship\": 0, \"has_playoff_consolation_games\": true, \"is_auction_draft\": \"0\", \"max_teams\": \"10\", \"num_playoff_consolation_teams\": 4, \"num_playoff_teams\": \"4\", \"pickem_enabled\": \"1\", \"player_pool\": \"ALL\", \"playoff_start_week\": \"15\", \"post_draft_players\": \"W\", \"roster_positions\": [ { \"roster_position\": { \"count\": 1, \"position\": \"QB\", \"position_type\": \"O\" } }, ... ], \"scoring_type\": \"head\", \"stat_categories\": { \"stats\": [ { \"stat\": { \"display_name\": \"Pass Yds\", \"enabled\": \"1\", \"name\": \"Passing Yards\", \"position_type\": \"O\", \"sort_order\": \"1\", \"stat_id\": 4, \"stat_position_types\": { \"stat_position_type\": { \"position_type\": \"O\" } } } }, ... ] }, \"stat_modifiers\": { \"stats\": [ { \"stat\": { \"stat_id\": 4, \"value\": \"0.04\" } }, ... ] }, \"trade_end_date\": \"2014-11-14\", \"trade_ratify_type\": \"yahoo\", \"trade_reject_time\": \"2\", \"uses_faab\": \"0\", \"uses_fractional_points\": \"1\", \"uses_lock_eliminated_teams\": 1, \"uses_negative_points\": \"1\", \"uses_playoff\": \"1\", \"uses_playoff_reseeding\": 0, \"waiver_rule\": \"gametime\", \"waiver_time\": \"2\", \"waiver_type\": \"R\" }) Returns: Settings ( Settings ) \u2013 YFPY Settings instance. Source code in yfpy/query.py 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 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 def get_league_settings ( self ) -> Settings : \"\"\"Retrieve settings (rules) for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_settings() Settings({ \"cant_cut_list\": \"yahoo\", \"draft_time\": \"1408410000\", \"draft_type\": \"live\", \"has_multiweek_championship\": 0, \"has_playoff_consolation_games\": true, \"is_auction_draft\": \"0\", \"max_teams\": \"10\", \"num_playoff_consolation_teams\": 4, \"num_playoff_teams\": \"4\", \"pickem_enabled\": \"1\", \"player_pool\": \"ALL\", \"playoff_start_week\": \"15\", \"post_draft_players\": \"W\", \"roster_positions\": [ { \"roster_position\": { \"count\": 1, \"position\": \"QB\", \"position_type\": \"O\" } }, ... ], \"scoring_type\": \"head\", \"stat_categories\": { \"stats\": [ { \"stat\": { \"display_name\": \"Pass Yds\", \"enabled\": \"1\", \"name\": \"Passing Yards\", \"position_type\": \"O\", \"sort_order\": \"1\", \"stat_id\": 4, \"stat_position_types\": { \"stat_position_type\": { \"position_type\": \"O\" } } } }, ... ] }, \"stat_modifiers\": { \"stats\": [ { \"stat\": { \"stat_id\": 4, \"value\": \"0.04\" } }, ... ] }, \"trade_end_date\": \"2014-11-14\", \"trade_ratify_type\": \"yahoo\", \"trade_reject_time\": \"2\", \"uses_faab\": \"0\", \"uses_fractional_points\": \"1\", \"uses_lock_eliminated_teams\": 1, \"uses_negative_points\": \"1\", \"uses_playoff\": \"1\", \"uses_playoff_reseeding\": 0, \"waiver_rule\": \"gametime\", \"waiver_time\": \"2\", \"waiver_type\": \"R\" }) Returns: Settings: YFPY Settings instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /settings\" , [ \"league\" , \"settings\" ], Settings )","title":"get_league_settings"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_league_standings","text":"get_league_standings () Retrieve standings for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_league_standings () Standings({ \"teams\": [ { \"team\": { \"clinched_playoffs\": 1, \"draft_grade\": \"C+\", \"draft_position\": 7, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/8/draftrecap\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"PMTCFWSK5U5LI4SKWREUR56B5A\", \"manager_id\": \"8\", \"nickname\": \"--hidden--\" } }, \"name\": \"clam dam\", \"number_of_moves\": \"27\", \"number_of_trades\": 0, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"8\", \"team_key\": \"331.l.729259.t.8\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://s.yimg.com/cv/apiv2/default/nfl/nfl_1.png\" } }, \"team_points\": { \"coverage_type\": \"season\", \"season\": \"2014\", \"total\": \"1507.06\" }, \"team_standings\": { \"outcome_totals\": { \"losses\": 2, \"percentage\": 0.857, \"ties\": 0, \"wins\": 12 }, \"playoff_seed\": \"1\", \"points_against\": 1263.78, \"points_for\": 1507.06, \"rank\": 1, \"streak\": { \"type\": \"win\", \"value\": \"2\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/8\", \"waiver_priority\": 10 } }, ... ] }) Returns: Standings ( Standings ) \u2013 YFPY Standings instance. Source code in yfpy/query.py 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 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 def get_league_standings ( self ) -> Standings : \"\"\"Retrieve standings for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_standings() Standings({ \"teams\": [ { \"team\": { \"clinched_playoffs\": 1, \"draft_grade\": \"C+\", \"draft_position\": 7, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/8/draftrecap\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"PMTCFWSK5U5LI4SKWREUR56B5A\", \"manager_id\": \"8\", \"nickname\": \"--hidden--\" } }, \"name\": \"clam dam\", \"number_of_moves\": \"27\", \"number_of_trades\": 0, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"8\", \"team_key\": \"331.l.729259.t.8\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://s.yimg.com/cv/apiv2/default/nfl/nfl_1.png\" } }, \"team_points\": { \"coverage_type\": \"season\", \"season\": \"2014\", \"total\": \"1507.06\" }, \"team_standings\": { \"outcome_totals\": { \"losses\": 2, \"percentage\": 0.857, \"ties\": 0, \"wins\": 12 }, \"playoff_seed\": \"1\", \"points_against\": 1263.78, \"points_for\": 1507.06, \"rank\": 1, \"streak\": { \"type\": \"win\", \"value\": \"2\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/8\", \"waiver_priority\": 10 } }, ... ] }) Returns: Standings: YFPY Standings instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /standings\" , [ \"league\" , \"standings\" ], Standings )","title":"get_league_standings"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_league_teams","text":"get_league_teams () Retrieve teams for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_league_teams () [ Team({ \"clinched_playoffs\": 1, \"draft_grade\": \"B\", \"draft_position\": 4, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1/draftrecap\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"BMACD7S5UXV7JIQX4PGGUVQJAU\", \"manager_id\": \"1\", \"nickname\": \"--hidden--\" } }, \"name\": \"Hellacious Hill 12\", \"number_of_moves\": \"71\", \"number_of_trades\": 0, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"1\", \"team_key\": \"331.l.729259.t.1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1441/24935131299_a8242dab70_192sq.jpg?ct=fantasy\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1\", \"waiver_priority\": 9 }), ..., Team({...}) ] Returns: List [ Team ] \u2013 list[Team]: List of YFPY Team instances. Source code in yfpy/query.py 1506 1507 1508 1509 1510 1511 1512 1513 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 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 def get_league_teams ( self ) -> List [ Team ]: \"\"\"Retrieve teams for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_teams() [ Team({ \"clinched_playoffs\": 1, \"draft_grade\": \"B\", \"draft_position\": 4, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1/draftrecap\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"BMACD7S5UXV7JIQX4PGGUVQJAU\", \"manager_id\": \"1\", \"nickname\": \"--hidden--\" } }, \"name\": \"Hellacious Hill 12\", \"number_of_moves\": \"71\", \"number_of_trades\": 0, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"1\", \"team_key\": \"331.l.729259.t.1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1441/24935131299_a8242dab70_192sq.jpg?ct=fantasy\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1\", \"waiver_priority\": 9 }), ..., Team({...}) ] Returns: list[Team]: List of YFPY Team instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /teams\" , [ \"league\" , \"teams\" ] )","title":"get_league_teams"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_league_players","text":"get_league_players ( player_count_limit = None , player_count_start = 0 , is_retry = False , ) Retrieve valid players for chosen league. Parameters: player_count_limit ( int , default: None ) \u2013 Maximum number of players to retreive. player_count_start ( int , default: 0 ) \u2013 Index from which to retrieve all subsequent players. is_retry ( bool , default: False ) \u2013 Boolean to indicate whether the method is being retried during error handling. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_league_players ( 50 , 25 ) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"K\", \"editorial_player_key\": \"nfl.p.3727\", \"editorial_team_abbr\": \"Ind\", \"editorial_team_full_name\": \"Indianapolis Colts\", \"editorial_team_key\": \"nfl.t.11\", \"eligible_positions\": { \"position\": \"K\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/OpHvpCHjl_PQvkeQUgsjsA--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt 3PTQ2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08152019/3727.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Adam\", \"ascii_last\": \"Vinatieri\", \"first\": \"Adam\", \"full\": \"Adam Vinatieri\", \"last\": \"Vinatieri\" }, \"player_id\": \"3727\", \"player_key\": \"331.p.3727\", \"player_notes_last_timestamp\": 1568758320, \"position_type\": \"K\", \"primary_position\": \"K\", \"uniform_number\": \"4\" }), ..., Player({...}) ] Returns: List [ Player ] \u2013 list[Player]: List of YFPY Player instances. Source code in yfpy/query.py 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 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 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 def get_league_players ( self , player_count_limit : int = None , player_count_start : int = 0 , is_retry : bool = False ) -> List [ Player ]: \"\"\"Retrieve valid players for chosen league. Args: player_count_limit (int): Maximum number of players to retreive. player_count_start (int): Index from which to retrieve all subsequent players. is_retry (bool): Boolean to indicate whether the method is being retried during error handling. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_players(50, 25) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"K\", \"editorial_player_key\": \"nfl.p.3727\", \"editorial_team_abbr\": \"Ind\", \"editorial_team_full_name\": \"Indianapolis Colts\", \"editorial_team_key\": \"nfl.t.11\", \"eligible_positions\": { \"position\": \"K\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/OpHvpCHjl_PQvkeQUgsjsA--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt 3PTQ2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08152019/3727.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Adam\", \"ascii_last\": \"Vinatieri\", \"first\": \"Adam\", \"full\": \"Adam Vinatieri\", \"last\": \"Vinatieri\" }, \"player_id\": \"3727\", \"player_key\": \"331.p.3727\", \"player_notes_last_timestamp\": 1568758320, \"position_type\": \"K\", \"primary_position\": \"K\", \"uniform_number\": \"4\" }), ..., Player({...}) ] Returns: list[Player]: List of YFPY Player instances. \"\"\" league_player_count = player_count_start all_players_retrieved = False league_player_data = [] league_player_retrieval_limit = 25 while not all_players_retrieved : try : league_player_query_data = self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"start= { league_player_count } ;count= { league_player_retrieval_limit if not is_retry else 1 } \" , [ \"league\" , \"players\" ] ) league_players = ( league_player_query_data if isinstance ( league_player_query_data , list ) else [ league_player_query_data ]) league_player_count_from_query = len ( league_players ) if player_count_limit : if ( league_player_count + league_player_count_from_query ) < player_count_limit : league_player_count += league_player_count_from_query league_player_data . extend ( league_players ) else : for ndx in range ( player_count_limit - league_player_count ): league_player_data . append ( league_players [ ndx ]) league_player_count += ( player_count_limit - league_player_count ) all_players_retrieved = True else : league_player_count += league_player_count_from_query league_player_data . extend ( league_players ) except YahooFantasySportsDataNotFound as yfpy_err : if not is_retry : payload = yfpy_err . payload if payload : logger . debug ( \"No more league player data available.\" ) all_players_retrieved = True else : logger . warning ( f \"Error retrieving player batch: \" f \" { league_player_count } - { league_player_count + league_player_retrieval_limit - 1 } . \" f \"Attempting to retrieve individual players from batch.\" ) player_retrieval_successes = [] player_retrieval_failures = [] for i in range ( 25 ): try : player_data = self . get_league_players ( player_count_limit = league_player_count + 1 , player_count_start = league_player_count , is_retry = True ) player_retrieval_successes . extend ( player_data ) except YahooFantasySportsDataNotFound as nested_yfpy_err : player_retrieval_failures . append ( { \"failed_player_retrieval_index\" : league_player_count , \"failed_player_retrieval_url\" : nested_yfpy_err . url , \"failed_player_retrieval_message\" : nested_yfpy_err . message } ) league_player_count += 1 league_player_data . extend ( player_retrieval_successes ) logger . warning ( f \"Players retrieval failures: \\n { prettify_data ( player_retrieval_failures ) } \" ) else : raise yfpy_err logger . debug ( f \"League player count: { league_player_count } \" ) return league_player_data","title":"get_league_players"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_league_draft_results","text":"get_league_draft_results () Retrieve draft results for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_league_draft_results () [ DraftResult({ \"pick\": 1, \"round\": 1, \"team_key\": \"331.l.729259.t.4\", \"player_key\": \"331.p.9317\" }), ..., DraftResult({...}) ] Returns: List [ DraftResult ] \u2013 list[DraftResult]: List of YFPY DraftResult instances. Source code in yfpy/query.py 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 def get_league_draft_results ( self ) -> List [ DraftResult ]: \"\"\"Retrieve draft results for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_draft_results() [ DraftResult({ \"pick\": 1, \"round\": 1, \"team_key\": \"331.l.729259.t.4\", \"player_key\": \"331.p.9317\" }), ..., DraftResult({...}) ] Returns: list[DraftResult]: List of YFPY DraftResult instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /draftresults\" , [ \"league\" , \"draft_results\" ] )","title":"get_league_draft_results"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_league_transactions","text":"get_league_transactions () Retrieve transactions for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_league_transactions () [ Transaction({ \"players\": [ { \"player\": { \"display_position\": \"RB\", \"editorial_team_abbr\": \"NO\", \"name\": { \"ascii_first\": \"Kerwynn\", \"ascii_last\": \"Williams\", \"first\": \"Kerwynn\", \"full\": \"Kerwynn Williams\", \"last\": \"Williams\" }, \"player_id\": \"26853\", \"player_key\": \"331.p.26853\", \"position_type\": \"O\", \"transaction_data\": { \"destination_team_key\": \"331.l.729259.t.1\", \"destination_team_name\": \"Hellacious Hill 12\", \"destination_type\": \"team\", \"source_type\": \"freeagents\", \"type\": \"add\" } } } ], \"status\": \"successful\", \"timestamp\": \"1419188151\", \"transaction_id\": \"282\", \"transaction_key\": \"331.l.729259.tr.282\", \"type\": \"add/drop\" }), ..., Transaction({...}) ] Returns: List [ Transaction ] \u2013 list[Transaction]: List of YFPY Transaction instances. Source code in yfpy/query.py 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 def get_league_transactions ( self ) -> List [ Transaction ]: \"\"\"Retrieve transactions for chosen league. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_transactions() [ Transaction({ \"players\": [ { \"player\": { \"display_position\": \"RB\", \"editorial_team_abbr\": \"NO\", \"name\": { \"ascii_first\": \"Kerwynn\", \"ascii_last\": \"Williams\", \"first\": \"Kerwynn\", \"full\": \"Kerwynn Williams\", \"last\": \"Williams\" }, \"player_id\": \"26853\", \"player_key\": \"331.p.26853\", \"position_type\": \"O\", \"transaction_data\": { \"destination_team_key\": \"331.l.729259.t.1\", \"destination_team_name\": \"Hellacious Hill 12\", \"destination_type\": \"team\", \"source_type\": \"freeagents\", \"type\": \"add\" } } } ], \"status\": \"successful\", \"timestamp\": \"1419188151\", \"transaction_id\": \"282\", \"transaction_key\": \"331.l.729259.tr.282\", \"type\": \"add/drop\" }), ..., Transaction({...}) ] Returns: list[Transaction]: List of YFPY Transaction instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /transactions\" , [ \"league\" , \"transactions\" ] )","title":"get_league_transactions"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_league_scoreboard_by_week","text":"get_league_scoreboard_by_week ( chosen_week ) Retrieve scoreboard for chosen league by week. Parameters: chosen_week ( int ) \u2013 Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_league_scoreboard_by_week ( 1 ) Scoreboard({ \"week\": \"1\", \"matchups\": [ { \"matchup\": { \"is_consolation\": \"0\", \"is_matchup_recap_available\": 1, \"is_playoffs\": \"0\", \"is_tied\": 0, \"matchup_grades\": [ { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.1\" } }, { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.2\" } } ], \"matchup_recap_title\": \"Wax On Wax Off Gets Victory Against Hellacious Hill 12\", \"matchup_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/recap? week=1&mid1=1&mid2=2\", \"status\": \"postevent\", \"teams\": [ { \"team\": { } }, { \"team\": { } } ], \"week\": \"1\", \"week_end\": \"2014-09-08\", \"week_start\": \"2014-09-04\", \"winner_team_key\": \"331.l.729259.t.2\" } }, ... ] }) Returns: Scoreboard ( Scoreboard ) \u2013 YFPY Scoreboard instance. Source code in yfpy/query.py 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 def get_league_scoreboard_by_week ( self , chosen_week : int ) -> Scoreboard : \"\"\"Retrieve scoreboard for chosen league by week. Args: chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_scoreboard_by_week(1) Scoreboard({ \"week\": \"1\", \"matchups\": [ { \"matchup\": { \"is_consolation\": \"0\", \"is_matchup_recap_available\": 1, \"is_playoffs\": \"0\", \"is_tied\": 0, \"matchup_grades\": [ { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.1\" } }, { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.2\" } } ], \"matchup_recap_title\": \"Wax On Wax Off Gets Victory Against Hellacious Hill 12\", \"matchup_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/recap? week=1&mid1=1&mid2=2\", \"status\": \"postevent\", \"teams\": [ { \"team\": { } }, { \"team\": { } } ], \"week\": \"1\", \"week_end\": \"2014-09-08\", \"week_start\": \"2014-09-04\", \"winner_team_key\": \"331.l.729259.t.2\" } }, ... ] }) Returns: Scoreboard: YFPY Scoreboard instance. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /scoreboard;\" f \"week= { chosen_week } \" , [ \"league\" , \"scoreboard\" ], Scoreboard )","title":"get_league_scoreboard_by_week"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_league_matchups_by_week","text":"get_league_matchups_by_week ( chosen_week ) Retrieve matchups for chosen league by week. Parameters: chosen_week ( int ) \u2013 Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_league_matchups_by_week ( 1 ) [ Matchup({ \"is_consolation\": \"0\", \"is_matchup_recap_available\": 1, \"is_playoffs\": \"0\", \"is_tied\": 0, \"matchup_grades\": [ { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.1\" } }, { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.2\" } } ], \"matchup_recap_title\": \"Wax On Wax Off Gets Victory Against Hellacious Hill 12\", \"matchup_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/recap? week=1&mid1=1&mid2=2\", \"status\": \"postevent\", \"teams\": [ { \"team\": { } }, { \"team\": { } } ], \"week\": \"1\", \"week_end\": \"2014-09-08\", \"week_start\": \"2014-09-04\", \"winner_team_key\": \"331.l.729259.t.2\" }), ..., Matchup({...}) ] Returns: List [ Matchup ] \u2013 list[Matchup]: List of YFPY Matchup instances. Source code in yfpy/query.py 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 def get_league_matchups_by_week ( self , chosen_week : int ) -> List [ Matchup ]: \"\"\"Retrieve matchups for chosen league by week. Args: chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_league_matchups_by_week(1) [ Matchup({ \"is_consolation\": \"0\", \"is_matchup_recap_available\": 1, \"is_playoffs\": \"0\", \"is_tied\": 0, \"matchup_grades\": [ { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.1\" } }, { \"matchup_grade\": { \"grade\": \"B\", \"team_key\": \"331.l.729259.t.2\" } } ], \"matchup_recap_title\": \"Wax On Wax Off Gets Victory Against Hellacious Hill 12\", \"matchup_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/recap? week=1&mid1=1&mid2=2\", \"status\": \"postevent\", \"teams\": [ { \"team\": { } }, { \"team\": { } } ], \"week\": \"1\", \"week_end\": \"2014-09-08\", \"week_start\": \"2014-09-04\", \"winner_team_key\": \"331.l.729259.t.2\" }), ..., Matchup({...}) ] Returns: list[Matchup]: List of YFPY Matchup instances. \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /scoreboard;\" f \"week= { chosen_week } \" , [ \"league\" , \"scoreboard\" , \"0\" , \"matchups\" ] )","title":"get_league_matchups_by_week"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_team_info","text":"get_team_info ( team_id ) Retrieve info of specific team by team_id for chosen league. Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_team_info ( 1 ) Team({ \"clinched_playoffs\": 1, \"draft_grade\": \"B\", \"draft_position\": 4, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1/draftrecap\", \"draft_results\": [ ... ], \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"BMACD7S5UXV7JIQX4PGGUVQJAU\", \"manager_id\": \"1\", \"nickname\": \"--hidden--\" } }, \"matchups\": [ ... ], \"name\": \"Hellacious Hill 12\", \"number_of_moves\": \"71\", \"number_of_trades\": 0, \"roster\": { ... }, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"1\", \"team_key\": \"331.l.729259.t.1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1441/24935131299_a8242dab70_192sq.jpg?ct=fantasy\" } }, \"team_points\": { \"coverage_type\": \"season\", \"season\": \"2014\", \"total\": \"1409.24\" }, \"team_standings\": { \"outcome_totals\": { \"losses\": 5, \"percentage\": 0.643, \"ties\": 0, \"wins\": 9 }, \"playoff_seed\": \"2\", \"points_against\": 1266.6599999999999, \"points_for\": 1409.24, \"rank\": 2, \"streak\": { \"type\": \"win\", \"value\": \"1\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1\", \"waiver_priority\": 9 }) Returns: Team ( Team ) \u2013 YFPY Team instance. Source code in yfpy/query.py 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 def get_team_info ( self , team_id : Union [ str , int ]) -> Team : \"\"\"Retrieve info of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_info(1) Team({ \"clinched_playoffs\": 1, \"draft_grade\": \"B\", \"draft_position\": 4, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1/draftrecap\", \"draft_results\": [ ... ], \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"BMACD7S5UXV7JIQX4PGGUVQJAU\", \"manager_id\": \"1\", \"nickname\": \"--hidden--\" } }, \"matchups\": [ ... ], \"name\": \"Hellacious Hill 12\", \"number_of_moves\": \"71\", \"number_of_trades\": 0, \"roster\": { ... }, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"1\", \"team_key\": \"331.l.729259.t.1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1441/24935131299_a8242dab70_192sq.jpg?ct=fantasy\" } }, \"team_points\": { \"coverage_type\": \"season\", \"season\": \"2014\", \"total\": \"1409.24\" }, \"team_standings\": { \"outcome_totals\": { \"losses\": 5, \"percentage\": 0.643, \"ties\": 0, \"wins\": 9 }, \"playoff_seed\": \"2\", \"points_against\": 1266.6599999999999, \"points_for\": 1409.24, \"rank\": 2, \"streak\": { \"type\": \"win\", \"value\": \"1\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1\", \"waiver_priority\": 9 }) Returns: Team: YFPY Team instance. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } ;\" f \"out=metadata,stats,standings,roster,draftresults,matchups\" , [ \"team\" ], Team )","title":"get_team_info"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_team_metadata","text":"get_team_metadata ( team_id ) Retrieve metadata of specific team by team_id for chosen league. Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_team_metadata ( 1 ) Team({ \"team_key\": \"331.l.729259.t.1\", \"team_id\": \"1\", \"name\": \"Hellacious Hill 12\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1441/24935131299_a8242dab70_192sq.jpg?ct=fantasy\" } }, \"waiver_priority\": 9, \"number_of_moves\": \"71\", \"number_of_trades\": 0, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"clinched_playoffs\": 1, \"league_scoring_type\": \"head\", \"draft_position\": 4, \"has_draft_grade\": 1, \"draft_grade\": \"B\", \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1/draftrecap\", \"managers\": { \"manager\": { \"guid\": \"BMACD7S5UXV7JIQX4PGGUVQJAU\", \"manager_id\": \"1\", \"nickname\": \"--hidden--\" } } }) Returns: Team ( Team ) \u2013 YFPY Team instance. Source code in yfpy/query.py 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 def get_team_metadata ( self , team_id : Union [ str , int ]) -> Team : \"\"\"Retrieve metadata of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_metadata(1) Team({ \"team_key\": \"331.l.729259.t.1\", \"team_id\": \"1\", \"name\": \"Hellacious Hill 12\", \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1441/24935131299_a8242dab70_192sq.jpg?ct=fantasy\" } }, \"waiver_priority\": 9, \"number_of_moves\": \"71\", \"number_of_trades\": 0, \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"clinched_playoffs\": 1, \"league_scoring_type\": \"head\", \"draft_position\": 4, \"has_draft_grade\": 1, \"draft_grade\": \"B\", \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/1/draftrecap\", \"managers\": { \"manager\": { \"guid\": \"BMACD7S5UXV7JIQX4PGGUVQJAU\", \"manager_id\": \"1\", \"nickname\": \"--hidden--\" } } }) Returns: Team: YFPY Team instance. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /metadata\" , [ \"team\" ], Team )","title":"get_team_metadata"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_team_stats","text":"get_team_stats ( team_id ) Retrieve stats of specific team by team_id for chosen league. Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_team_stats ( 1 ) TeamPoints({ \"coverage_type\": \"season\", \"season\": \"2014\", \"total\": \"1409.24\" }) Returns: TeamPoints ( TeamPoints ) \u2013 YFPY TeamPoints instance. Source code in yfpy/query.py 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 def get_team_stats ( self , team_id : Union [ str , int ]) -> TeamPoints : \"\"\"Retrieve stats of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_stats(1) TeamPoints({ \"coverage_type\": \"season\", \"season\": \"2014\", \"total\": \"1409.24\" }) Returns: TeamPoints: YFPY TeamPoints instance. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /stats\" , [ \"team\" , \"team_points\" ], TeamPoints )","title":"get_team_stats"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_team_stats_by_week","text":"get_team_stats_by_week ( team_id , chosen_week = 'current' ) Retrieve stats of specific team by team_id and by week for chosen league. Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week ( int , default: 'current' ) \u2013 Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_team_stats_by_week ( 1 , 1 ) { \"team_points\": TeamPoints({ \"coverage_type\": \"week\", \"total\": \"95.06\", \"week\": \"1\" }), \"team_projected_points\": TeamProjectedPoints({ \"coverage_type\": \"week\", \"total\": \"78.85\", \"week\": \"1\" }) } Returns: Dict [ str , Union [ TeamPoints , TeamProjectedPoints ]] \u2013 dict[str, TeamPoints | TeamProjectedPoints]: Dictionary containing keys \"team_points\" and \"team_projected_points\" with respective values YFPY TeamPoints and YFPY TeamProjectedPoints instances. Source code in yfpy/query.py 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 def get_team_stats_by_week ( self , team_id : Union [ str , int ], chosen_week : Union [ int , str ] = \"current\" ) -> Dict [ str , Union [ TeamPoints , TeamProjectedPoints ]]: \"\"\"Retrieve stats of specific team by team_id and by week for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_stats_by_week(1, 1) { \"team_points\": TeamPoints({ \"coverage_type\": \"week\", \"total\": \"95.06\", \"week\": \"1\" }), \"team_projected_points\": TeamProjectedPoints({ \"coverage_type\": \"week\", \"total\": \"78.85\", \"week\": \"1\" }) } Returns: dict[str, TeamPoints | TeamProjectedPoints]: Dictionary containing keys \"team_points\" and \"team_projected_points\" with respective values YFPY TeamPoints and YFPY TeamProjectedPoints instances. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /stats;type=week;week= { chosen_week } \" , [ \"team\" , [ \"team_points\" , \"team_projected_points\" ]] )","title":"get_team_stats_by_week"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_team_standings","text":"get_team_standings ( team_id ) Retrieve standings of specific team by team_id for chosen league. Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_team_standings ( 1 ) TeamStandings({ \"rank\": 2, \"playoff_seed\": \"2\", \"outcome_totals\": { \"losses\": 5, \"percentage\": 0.643, \"ties\": 0, \"wins\": 9 }, \"streak\": { \"type\": \"win\", \"value\": \"1\" }, \"points_for\": \"1409.24\", \"points_against\": 1266.6599999999999 }) Returns: TeamStandings ( TeamStandings ) \u2013 YFPY TeamStandings instance. Source code in yfpy/query.py 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 def get_team_standings ( self , team_id : Union [ str , int ]) -> TeamStandings : \"\"\"Retrieve standings of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_standings(1) TeamStandings({ \"rank\": 2, \"playoff_seed\": \"2\", \"outcome_totals\": { \"losses\": 5, \"percentage\": 0.643, \"ties\": 0, \"wins\": 9 }, \"streak\": { \"type\": \"win\", \"value\": \"1\" }, \"points_for\": \"1409.24\", \"points_against\": 1266.6599999999999 }) Returns: TeamStandings: YFPY TeamStandings instance. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /standings\" , [ \"team\" , \"team_standings\" ], TeamStandings )","title":"get_team_standings"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_team_roster_by_week","text":"get_team_roster_by_week ( team_id , chosen_week = 'current' ) Retrieve roster of specific team by team_id and by week for chosen league. Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week ( int , default: 'current' ) \u2013 Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_team_roster_by_week ( 1 , 1 ) Roster({ \"coverage_type\": \"week\", \"week\": \"1\", \"is_editable\": 0, \"players\": [ { \"player\": { \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt 3PTQ2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"1\" }, \"uniform_number\": \"12\" } }, ... ] }) Returns: Roster ( Roster ) \u2013 YFPY Roster instance. Source code in yfpy/query.py 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 def get_team_roster_by_week ( self , team_id : Union [ str , int ], chosen_week : Union [ int , str ] = \"current\" ) -> Roster : \"\"\"Retrieve roster of specific team by team_id and by week for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_roster_by_week(1, 1) Roster({ \"coverage_type\": \"week\", \"week\": \"1\", \"is_editable\": 0, \"players\": [ { \"player\": { \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt 3PTQ2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"1\" }, \"uniform_number\": \"12\" } }, ... ] }) Returns: Roster: YFPY Roster instance. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /roster;week= { chosen_week } \" , [ \"team\" , \"roster\" ], Roster )","title":"get_team_roster_by_week"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_team_roster_player_info_by_week","text":"get_team_roster_player_info_by_week ( team_id , chosen_week = \"current\" ) Retrieve roster with ALL player info of specific team by team_id and by week for chosen league. Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week ( int , default: 'current' ) \u2013 Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_team_roster_player_info_by_week ( 1 , 1 ) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"draft_analysis\": { \"average_pick\": \"65.9\", \"average_round\": \"7.6\", \"average_cost\": \"5.0\", \"percent_drafted\": \"1.00\" }, \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/ https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"ownership\": { \"ownership_type\": \"team\", \"owner_team_key\": \"331.l.729259.t.1\", \"owner_team_name\": \"Hellacious Hill 12\" }, \"percent_owned\": { \"coverage_type\": \"week\", \"week\": \"17\", \"value\": 99, \"delta\": \"0\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"player_points\": { \"coverage_type\": \"week\", \"week\": \"1\", \"total\": 10.26 }, \"player_stats\": { \"coverage_type\": \"week\", \"week\": \"1\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"249\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"1\" }, \"uniform_number\": \"12\" }), ..., Player({...}) ] Returns: List [ Player ] \u2013 list[Player]: List of YFPY Player instances containing attributes \"draft_analysis\", \"ownership\", \"percent_owned\", and \"player_stats\". Source code in yfpy/query.py 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 def get_team_roster_player_info_by_week ( self , team_id : Union [ str , int ], chosen_week : Union [ int , str ] = \"current\" ) -> List [ Player ]: \"\"\"Retrieve roster with ALL player info of specific team by team_id and by week for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_roster_player_info_by_week(1, 1) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"draft_analysis\": { \"average_pick\": \"65.9\", \"average_round\": \"7.6\", \"average_cost\": \"5.0\", \"percent_drafted\": \"1.00\" }, \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/ https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"ownership\": { \"ownership_type\": \"team\", \"owner_team_key\": \"331.l.729259.t.1\", \"owner_team_name\": \"Hellacious Hill 12\" }, \"percent_owned\": { \"coverage_type\": \"week\", \"week\": \"17\", \"value\": 99, \"delta\": \"0\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"player_points\": { \"coverage_type\": \"week\", \"week\": \"1\", \"total\": 10.26 }, \"player_stats\": { \"coverage_type\": \"week\", \"week\": \"1\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"249\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"1\" }, \"uniform_number\": \"12\" }), ..., Player({...}) ] Returns: list[Player]: List of YFPY Player instances containing attributes \"draft_analysis\", \"ownership\", \"percent_owned\", and \"player_stats\". \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /roster;week= { chosen_week } /players;\" f \"out=metadata,stats,ownership,percent_owned,draft_analysis\" , [ \"team\" , \"roster\" , \"0\" , \"players\" ] )","title":"get_team_roster_player_info_by_week"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_team_roster_player_info_by_date","text":"get_team_roster_player_info_by_date ( team_id , chosen_date = None ) Retrieve roster with ALL player info of specific team by team_id and by date for chosen league. Note This applies to MLB, NBA, and NHL leagues, but does NOT apply to NFL leagues. This query will FAIL if you pass it an INVALID date string! Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_date ( str , default: None ) \u2013 Selected date for which to retrieve data. REQUIRED FORMAT: YYYY-MM-DD (Ex. 2011-05-01) Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nhl\" ) >>> query . get_team_roster_player_info_by_date ( 1 , \"2011-05-01\" ) [ Player({ \"display_position\": \"C\", \"draft_analysis\": { \"average_pick\": 33.2, \"average_round\": 3.5, \"average_cost\": 39.2, \"percent_drafted\": 1.0 }, \"editorial_player_key\": \"nhl.p.3981\", \"editorial_team_abbr\": \"Chi\", \"editorial_team_full_name\": \"Chicago Blackhawks\", \"editorial_team_key\": \"nhl.t.4\", \"eligible_positions\": [ \"C\", \"F\" ], \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/tz.KOMoEiBDch6AJAGaUtg--~C/ YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/ https://s.yimg.com/xe/i/us/sp/v/nhl_cutout/players_l/11032021/3981.png\" }, \"is_editable\": 0, \"is_undroppable\": 0, \"name\": { \"ascii_first\": \"Jonathan\", \"ascii_last\": \"Toews\", \"first\": \"Jonathan\", \"full\": \"Jonathan Toews\", \"last\": \"Toews\" }, \"ownership\": { \"ownership_type\": \"team\", \"owner_team_key\": \"303.l.69624.t.2\", \"owner_team_name\": \"The Bateleurs\" }, \"percent_owned\": { \"coverage_type\": \"week\", \"week\": 25, \"value\": 98, \"delta\": -1.0 }, \"player_id\": 3981, \"player_key\": \"303.p.3981\", \"player_notes_last_timestamp\": 1651606838, \"player_stats\": { \"coverage_type\": \"date\", \"stats\": [ { \"stat\": { \"stat_id\": 1, \"value\": 1.0 } }, ... ] }, \"position_type\": \"P\", \"primary_position\": \"C\", \"selected_position\": { \"coverage_type\": \"date\", \"is_flex\": 0, \"position\": \"C\" }, \"uniform_number\": 19 }), ..., Player({...}) ] Returns: List [ Player ] \u2013 list[Player]: List of YFPY Player instances containing attributes \"draft_analysis\", \"ownership\", \"percent_owned\", and \"player_stats\". Source code in yfpy/query.py 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 def get_team_roster_player_info_by_date ( self , team_id : Union [ str , int ], chosen_date : str = None ) -> List [ Player ]: \"\"\"Retrieve roster with ALL player info of specific team by team_id and by date for chosen league. Note: This applies to MLB, NBA, and NHL leagues, but does NOT apply to NFL leagues. This query will FAIL if you pass it an INVALID date string! Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_date (str): Selected date for which to retrieve data. REQUIRED FORMAT: YYYY-MM-DD (Ex. 2011-05-01) Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nhl\") >>> query.get_team_roster_player_info_by_date(1, \"2011-05-01\") [ Player({ \"display_position\": \"C\", \"draft_analysis\": { \"average_pick\": 33.2, \"average_round\": 3.5, \"average_cost\": 39.2, \"percent_drafted\": 1.0 }, \"editorial_player_key\": \"nhl.p.3981\", \"editorial_team_abbr\": \"Chi\", \"editorial_team_full_name\": \"Chicago Blackhawks\", \"editorial_team_key\": \"nhl.t.4\", \"eligible_positions\": [ \"C\", \"F\" ], \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/tz.KOMoEiBDch6AJAGaUtg--~C/ YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/ https://s.yimg.com/xe/i/us/sp/v/nhl_cutout/players_l/11032021/3981.png\" }, \"is_editable\": 0, \"is_undroppable\": 0, \"name\": { \"ascii_first\": \"Jonathan\", \"ascii_last\": \"Toews\", \"first\": \"Jonathan\", \"full\": \"Jonathan Toews\", \"last\": \"Toews\" }, \"ownership\": { \"ownership_type\": \"team\", \"owner_team_key\": \"303.l.69624.t.2\", \"owner_team_name\": \"The Bateleurs\" }, \"percent_owned\": { \"coverage_type\": \"week\", \"week\": 25, \"value\": 98, \"delta\": -1.0 }, \"player_id\": 3981, \"player_key\": \"303.p.3981\", \"player_notes_last_timestamp\": 1651606838, \"player_stats\": { \"coverage_type\": \"date\", \"stats\": [ { \"stat\": { \"stat_id\": 1, \"value\": 1.0 } }, ... ] }, \"position_type\": \"P\", \"primary_position\": \"C\", \"selected_position\": { \"coverage_type\": \"date\", \"is_flex\": 0, \"position\": \"C\" }, \"uniform_number\": 19 }), ..., Player({...}) ] Returns: list[Player]: List of YFPY Player instances containing attributes \"draft_analysis\", \"ownership\", \"percent_owned\", and \"player_stats\". \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /\" f \"roster { ';date=' + str ( chosen_date ) if chosen_date else '' } /players;\" f \"out=metadata,stats,ownership,percent_owned,draft_analysis\" , [ \"team\" , \"roster\" , \"0\" , \"players\" ] )","title":"get_team_roster_player_info_by_date"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_team_roster_player_stats","text":"get_team_roster_player_stats ( team_id ) Retrieve roster with ALL player info for the season of specific team by team_id and for chosen league. Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_team_roster_player_stats ( 1 ) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"draft_analysis\": { \"average_pick\": \"65.9\", \"average_round\": \"7.6\", \"average_cost\": \"5.0\", \"percent_drafted\": \"1.00\" }, \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"player_points\": { \"coverage_type\": \"season\", \"total\": 287.06 }, \"player_stats\": { \"coverage_type\": \"season\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"4109\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"16\" }, \"uniform_number\": \"12\" }), ..., Player({...}) ] Returns: List [ Player ] \u2013 list[Player]: List of YFPY Player instances containing attributes \"draft_analysis\", \"ownership\", \"percent_owned\", and \"player_stats\". Source code in yfpy/query.py 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 def get_team_roster_player_stats ( self , team_id : Union [ str , int ]) -> List [ Player ]: \"\"\"Retrieve roster with ALL player info for the season of specific team by team_id and for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_roster_player_stats(1) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"draft_analysis\": { \"average_pick\": \"65.9\", \"average_round\": \"7.6\", \"average_cost\": \"5.0\", \"percent_drafted\": \"1.00\" }, \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"player_points\": { \"coverage_type\": \"season\", \"total\": 287.06 }, \"player_stats\": { \"coverage_type\": \"season\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"4109\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"16\" }, \"uniform_number\": \"12\" }), ..., Player({...}) ] Returns: list[Player]: List of YFPY Player instances containing attributes \"draft_analysis\", \"ownership\", \"percent_owned\", and \"player_stats\". \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /roster/players/stats;type=season\" , [ \"team\" , \"roster\" , \"0\" , \"players\" ] )","title":"get_team_roster_player_stats"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_team_roster_player_stats_by_week","text":"get_team_roster_player_stats_by_week ( team_id , chosen_week = \"current\" ) Retrieve roster with player stats of specific team by team_id and by week for chosen league. Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week ( int , default: 'current' ) \u2013 Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_team_roster_player_stats_by_week ( 1 , 1 ) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt 3PTQ2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"player_points\": { \"coverage_type\": \"week\", \"week\": \"1\", \"total\": 10.26 }, \"player_stats\": { \"coverage_type\": \"week\", \"week\": \"1\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"249\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"1\" }, \"uniform_number\": \"12\" }), ..., Player({...}) ] Returns: List [ Player ] \u2013 list[Player]: List of YFPY Player instances containing attribute \"player_stats\". Source code in yfpy/query.py 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 def get_team_roster_player_stats_by_week ( self , team_id : Union [ str , int ], chosen_week : Union [ int , str ] = \"current\" ) -> List [ Player ]: \"\"\"Retrieve roster with player stats of specific team by team_id and by week for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_roster_player_stats_by_week(1, 1) [ Player({ \"bye_weeks\": { \"week\": \"10\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.5228\", \"editorial_team_abbr\": \"NE\", \"editorial_team_full_name\": \"New England Patriots\", \"editorial_team_key\": \"nfl.t.17\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/_U9UJlrYMsJ22DpA..S3zg--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt 3PTQ2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08212019/5228.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Tom\", \"ascii_last\": \"Brady\", \"first\": \"Tom\", \"full\": \"Tom Brady\", \"last\": \"Brady\" }, \"player_id\": \"5228\", \"player_key\": \"331.p.5228\", \"player_notes_last_timestamp\": 1568837880, \"player_points\": { \"coverage_type\": \"week\", \"week\": \"1\", \"total\": 10.26 }, \"player_stats\": { \"coverage_type\": \"week\", \"week\": \"1\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"249\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"selected_position\": { \"coverage_type\": \"week\", \"is_flex\": 0, \"position\": \"QB\", \"week\": \"1\" }, \"uniform_number\": \"12\" }), ..., Player({...}) ] Returns: list[Player]: List of YFPY Player instances containing attribute \"player_stats\". \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /roster;week= { chosen_week } /players/stats\" , [ \"team\" , \"roster\" , \"0\" , \"players\" ] )","title":"get_team_roster_player_stats_by_week"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_team_draft_results","text":"get_team_draft_results ( team_id ) Retrieve draft results of specific team by team_id for chosen league. Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_team_draft_results ( 1 ) [ DraftResult({ \"pick\": 4, \"round\": 1, \"team_key\": \"331.l.729259.t.1\", \"player_key\": \"331.p.8256\" }), ..., DraftResults({...}) ] Returns: List [ DraftResult ] \u2013 list[DraftResult]: List of YFPY DraftResult instances. Source code in yfpy/query.py 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 def get_team_draft_results ( self , team_id : Union [ str , int ]) -> List [ DraftResult ]: \"\"\"Retrieve draft results of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_draft_results(1) [ DraftResult({ \"pick\": 4, \"round\": 1, \"team_key\": \"331.l.729259.t.1\", \"player_key\": \"331.p.8256\" }), ..., DraftResults({...}) ] Returns: list[DraftResult]: List of YFPY DraftResult instances. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /draftresults\" , [ \"team\" , \"draft_results\" ] )","title":"get_team_draft_results"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_team_matchups","text":"get_team_matchups ( team_id ) Retrieve matchups of specific team by team_id for chosen league. Parameters: team_id ( str | int ) \u2013 Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_team_matchups ( 1 ) [ Matchup({ (see get_league_matchups_by_week docstring for matchup data example) }) ] Returns: List [ Matchup ] \u2013 list[Matchup]: List of YFPY Matchup instances. Source code in yfpy/query.py 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 def get_team_matchups ( self , team_id : Union [ str , int ]) -> List [ Matchup ]: \"\"\"Retrieve matchups of specific team by team_id for chosen league. Args: team_id (str | int): Selected team ID for which to retrieva data (can be integers 1 through n where n is the number of teams in the league). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_team_matchups(1) [ Matchup({ (see get_league_matchups_by_week docstring for matchup data example) }) ] Returns: list[Matchup]: List of YFPY Matchup instances. \"\"\" team_key = f \" { self . get_league_key () } .t. { team_id } \" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/team/ { team_key } /matchups\" , [ \"team\" , \"matchups\" ] )","title":"get_team_matchups"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_player_stats_for_season","text":"get_player_stats_for_season ( player_key , limit_to_league_stats = True ) Retrieve stats of specific player by player_key for the entire season for chosen league. Parameters: player_key ( str ) \u2013 The player key of chosen player (example: 331.p.7200 - .p. ). limit_to_league_stats ( bool , default: True ) \u2013 Boolean (default: True) to limit the retrieved player stats to those for the selected league. When set to False, query retrieves all player stats for the game (NFL, NHL, NBA, MLB). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_player_stats_for_season ( \"331.p.7200\" ) Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"player_points\": { \"coverage_type\": \"season\", \"total\": 359.14 }, \"player_stats\": { \"coverage_type\": \"season\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"4381\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player ( Player ) \u2013 YFPY Player instance. Source code in yfpy/query.py 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 def get_player_stats_for_season ( self , player_key : str , limit_to_league_stats : bool = True ) -> Player : \"\"\"Retrieve stats of specific player by player_key for the entire season for chosen league. Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). limit_to_league_stats (bool): Boolean (default: True) to limit the retrieved player stats to those for the selected league. When set to False, query retrieves all player stats for the game (NFL, NHL, NBA, MLB). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_player_stats_for_season(\"331.p.7200\") Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"player_points\": { \"coverage_type\": \"season\", \"total\": 359.14 }, \"player_stats\": { \"coverage_type\": \"season\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"4381\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player: YFPY Player instance. \"\"\" if limit_to_league_stats : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /stats\" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player ) else : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/players;\" f \"player_keys= { player_key } /stats\" , [ \"players\" , \"0\" , \"player\" ], Player )","title":"get_player_stats_for_season"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_player_stats_by_week","text":"get_player_stats_by_week ( player_key , chosen_week = \"current\" , limit_to_league_stats = True , ) Retrieve stats of specific player by player_key and by week for chosen league. Parameters: player_key ( str ) \u2013 The player key of chosen player (example: 331.p.7200 - .p. ). chosen_week ( int , default: 'current' ) \u2013 Selected week for which to retrieve data. limit_to_league_stats ( bool , default: True ) \u2013 Boolean (default: True) to limit the retrieved player stats to those for the selected league. When set to False, query retrieves all player stats for the game (NFL, NHL, NBA, MLB). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_player_stats_by_week ( \"331.p.7200\" , 1 ) Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"player_points\": { \"coverage_type\": \"week\", \"week\": \"1\", \"total\": 10.56 }, \"player_stats\": { \"coverage_type\": \"week\", \"week\": \"1\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"189\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player ( Player ) \u2013 YFPY Player instance containing attribute \"player_stats\". Source code in yfpy/query.py 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 def get_player_stats_by_week ( self , player_key : str , chosen_week : Union [ int , str ] = \"current\" , limit_to_league_stats : bool = True ) -> Player : \"\"\"Retrieve stats of specific player by player_key and by week for chosen league. Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). chosen_week (int): Selected week for which to retrieve data. limit_to_league_stats (bool): Boolean (default: True) to limit the retrieved player stats to those for the selected league. When set to False, query retrieves all player stats for the game (NFL, NHL, NBA, MLB). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_player_stats_by_week(\"331.p.7200\", 1) Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"player_points\": { \"coverage_type\": \"week\", \"week\": \"1\", \"total\": 10.56 }, \"player_stats\": { \"coverage_type\": \"week\", \"week\": \"1\", \"stats\": [ { \"stat\": { \"stat_id\": \"4\", \"value\": \"189\" } }, ... ] }, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player: YFPY Player instance containing attribute \"player_stats\". \"\"\" if limit_to_league_stats : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /stats;type=week;week= { chosen_week } \" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player ) else : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/players;\" f \"player_keys= { player_key } /stats;type=week;week= { chosen_week } \" , [ \"players\" , \"0\" , \"player\" ], Player )","title":"get_player_stats_by_week"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_player_stats_by_date","text":"get_player_stats_by_date ( player_key , chosen_date = None , limit_to_league_stats = True ) Retrieve player stats by player_key and by date for chosen league. Note This applies to MLB, NBA, and NHL leagues, but does NOT apply to NFL leagues. This query will FAIL if you pass it an INVALID date string! Parameters: player_key ( str ) \u2013 The player key of chosen player (example: 331.p.7200 - .p. ). chosen_date ( str , default: None ) \u2013 Selected date for which to retrieve data. REQUIRED FORMAT: YYYY-MM-DD (Ex. 2011-05-01) limit_to_league_stats ( bool , default: True ) \u2013 Boolean (default: True) to limit the retrieved player stats to those for the selected league. When set to False, query retrieves all player stats for the game (NFL, NHL, NBA, MLB). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nhl\" ) >>> query . get_player_stats_by_date ( \"nhl.p.4588\" , \"2011-05-01\" ) Player({ \"display_position\": \"G\", \"editorial_player_key\": \"nhl.p.4588\", \"editorial_team_abbr\": \"Was\", \"editorial_team_full_name\": \"Washington Capitals\", \"editorial_team_key\": \"nhl.t.23\", \"eligible_positions\": { \"position\": \"G\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/CzntDh_d59voTqU6fhQy3g--~C/YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2 NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/https://s.yimg.com/ xe/i/us/sp/v/nhl_cutout/players_l/10182019/4588.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Braden\", \"ascii_last\": \"Holtby\", \"first\": \"Braden\", \"full\": \"Braden Holtby\", \"last\": \"Holtby\" }, \"player_id\": \"4588\", \"player_key\": \"303.p.4588\", \"player_notes_last_timestamp\": 1574133600, \"player_stats\": { \"coverage_type\": \"date\", \"stats\": [ { \"stat\": { \"stat_id\": \"19\", \"value\": \"1\" } }, { \"stat\": { \"stat_id\": \"22\", \"value\": \"1\" } }, { \"stat\": { \"stat_id\": \"23\", \"value\": \"1.00\" } }, { \"stat\": { \"stat_id\": \"25\", \"value\": \"29\" } }, { \"stat\": { \"stat_id\": \"24\", \"value\": \"30\" } }, { \"stat\": { \"stat_id\": \"26\", \"value\": \".967\" } }, { \"stat\": { \"stat_id\": \"27\", \"value\": \"0\" } } ] }, \"position_type\": \"G\", \"primary_position\": \"G\", \"uniform_number\": \"70\" }) Returns: Player ( Player ) \u2013 YFPY Player instnace containing attribute \"player_stats\". Source code in yfpy/query.py 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 def get_player_stats_by_date ( self , player_key : str , chosen_date : str = None , limit_to_league_stats : bool = True ) -> Player : \"\"\"Retrieve player stats by player_key and by date for chosen league. Note: This applies to MLB, NBA, and NHL leagues, but does NOT apply to NFL leagues. This query will FAIL if you pass it an INVALID date string! Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). chosen_date (str): Selected date for which to retrieve data. REQUIRED FORMAT: YYYY-MM-DD (Ex. 2011-05-01) limit_to_league_stats (bool): Boolean (default: True) to limit the retrieved player stats to those for the selected league. When set to False, query retrieves all player stats for the game (NFL, NHL, NBA, MLB). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nhl\") >>> query.get_player_stats_by_date(\"nhl.p.4588\", \"2011-05-01\") Player({ \"display_position\": \"G\", \"editorial_player_key\": \"nhl.p.4588\", \"editorial_team_abbr\": \"Was\", \"editorial_team_full_name\": \"Washington Capitals\", \"editorial_team_key\": \"nhl.t.23\", \"eligible_positions\": { \"position\": \"G\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/CzntDh_d59voTqU6fhQy3g--~C/YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2 NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/https://s.yimg.com/ xe/i/us/sp/v/nhl_cutout/players_l/10182019/4588.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Braden\", \"ascii_last\": \"Holtby\", \"first\": \"Braden\", \"full\": \"Braden Holtby\", \"last\": \"Holtby\" }, \"player_id\": \"4588\", \"player_key\": \"303.p.4588\", \"player_notes_last_timestamp\": 1574133600, \"player_stats\": { \"coverage_type\": \"date\", \"stats\": [ { \"stat\": { \"stat_id\": \"19\", \"value\": \"1\" } }, { \"stat\": { \"stat_id\": \"22\", \"value\": \"1\" } }, { \"stat\": { \"stat_id\": \"23\", \"value\": \"1.00\" } }, { \"stat\": { \"stat_id\": \"25\", \"value\": \"29\" } }, { \"stat\": { \"stat_id\": \"24\", \"value\": \"30\" } }, { \"stat\": { \"stat_id\": \"26\", \"value\": \".967\" } }, { \"stat\": { \"stat_id\": \"27\", \"value\": \"0\" } } ] }, \"position_type\": \"G\", \"primary_position\": \"G\", \"uniform_number\": \"70\" }) Returns: Player: YFPY Player instnace containing attribute \"player_stats\". \"\"\" if limit_to_league_stats : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /stats;type=date;date= { chosen_date } \" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player ) else : return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/players;\" f \"player_keys= { player_key } /stats;type=date;date= { chosen_date } \" , [ \"players\" , \"0\" , \"player\" ], Player )","title":"get_player_stats_by_date"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_player_ownership","text":"get_player_ownership ( player_key ) Retrieve ownership of specific player by player_key for chosen league. Parameters: player_key ( str ) \u2013 The player key of chosen player (example: 331.p.7200 - .p. ). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_player_ownership ( \"331.p.7200\" ) Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"ownership\": { \"ownership_type\": \"team\", \"owner_team_key\": \"331.l.729259.t.4\", \"owner_team_name\": \"hold my D\", \"teams\": { \"team\": { \"clinched_playoffs\": 1, \"draft_grade\": \"B-\", \"draft_position\": 1, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/4/draftrecap\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"5KLNXUYW5RP22UMRKUXHBCIITI\", \"manager_id\": \"4\", \"nickname\": \"--hidden--\" } }, \"name\": \"hold my D\", \"number_of_moves\": \"27\", \"number_of_trades\": \"1\", \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"4\", \"team_key\": \"331.l.729259.t.4\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1589/24677593583_68859308dd_192sq.jpg?ct=fantasy\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/4\", \"waiver_priority\": 7 } } }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player ( Player ) \u2013 YFPY Player instance containing attribute \"ownership\". Source code in yfpy/query.py 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 def get_player_ownership ( self , player_key : str ) -> Player : \"\"\"Retrieve ownership of specific player by player_key for chosen league. Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_player_ownership(\"331.p.7200\") Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"ownership\": { \"ownership_type\": \"team\", \"owner_team_key\": \"331.l.729259.t.4\", \"owner_team_name\": \"hold my D\", \"teams\": { \"team\": { \"clinched_playoffs\": 1, \"draft_grade\": \"B-\", \"draft_position\": 1, \"draft_recap_url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/4/draftrecap\", \"has_draft_grade\": 1, \"league_scoring_type\": \"head\", \"managers\": { \"manager\": { \"guid\": \"5KLNXUYW5RP22UMRKUXHBCIITI\", \"manager_id\": \"4\", \"nickname\": \"--hidden--\" } }, \"name\": \"hold my D\", \"number_of_moves\": \"27\", \"number_of_trades\": \"1\", \"roster_adds\": { \"coverage_type\": \"week\", \"coverage_value\": \"17\", \"value\": \"0\" }, \"team_id\": \"4\", \"team_key\": \"331.l.729259.t.4\", \"team_logos\": { \"team_logo\": { \"size\": \"large\", \"url\": \"https://ct.yimg.com/cy/1589/24677593583_68859308dd_192sq.jpg?ct=fantasy\" } }, \"url\": \"https://football.fantasysports.yahoo.com/archive/nfl/2014/729259/4\", \"waiver_priority\": 7 } } }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player: YFPY Player instance containing attribute \"ownership\". \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /ownership\" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player )","title":"get_player_ownership"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_player_percent_owned_by_week","text":"get_player_percent_owned_by_week ( player_key , chosen_week = \"current\" ) Retrieve percent-owned of specific player by player_key and by week for chosen league. Parameters: player_key ( str ) \u2013 The player key of chosen player (example: 331.p.7200 - .p. ). chosen_week ( int , default: 'current' ) \u2013 Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_player_percent_owned_by_week ( \"331.p.7200\" , 1 ) Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/ https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"percent_owned\": { \"coverage_type\": \"week\", \"week\": \"1\", \"value\": 100, \"delta\": \"0\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player ( Player ) \u2013 YFPY Player instance containing attribute \"percent_owned\". Source code in yfpy/query.py 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 def get_player_percent_owned_by_week ( self , player_key : str , chosen_week : Union [ int , str ] = \"current\" ) -> Player : \"\"\"Retrieve percent-owned of specific player by player_key and by week for chosen league. Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). chosen_week (int): Selected week for which to retrieve data. Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_player_percent_owned_by_week(\"331.p.7200\", 1) Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2/ https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"percent_owned\": { \"coverage_type\": \"week\", \"week\": \"1\", \"value\": 100, \"delta\": \"0\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player: YFPY Player instance containing attribute \"percent_owned\". \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /percent_owned;type=week;week= { chosen_week } \" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player )","title":"get_player_percent_owned_by_week"},{"location":"query/#yfpy.query.YahooFantasySportsQuery.get_player_draft_analysis","text":"get_player_draft_analysis ( player_key ) Retrieve draft analysis of specific player by player_key for chosen league. Parameters: player_key ( str ) \u2013 The player key of chosen player (example: 331.p.7200 - .p. ). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery ( league_id = \"######\" , game_code = \"nfl\" ) >>> query . get_player_draft_analysis ( \"331.p.7200\" ) Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"draft_analysis\": { \"average_pick\": \"19.9\", \"average_round\": \"2.8\", \"average_cost\": \"38.5\", \"percent_drafted\": \"1.00\" }, \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player ( Player ) \u2013 YFPY Player instance containing attribute \"draft_analysis\". Source code in yfpy/query.py 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 def get_player_draft_analysis ( self , player_key : str ) -> Player : \"\"\"Retrieve draft analysis of specific player by player_key for chosen league. Args: player_key (str): The player key of chosen player (example: 331.p.7200 - .p.). Examples: >>> from pathlib import Path >>> from yfpy.query import YahooFantasySportsQuery >>> query = YahooFantasySportsQuery(league_id=\"######\", game_code=\"nfl\") >>> query.get_player_draft_analysis(\"331.p.7200\") Player({ \"bye_weeks\": { \"week\": \"9\" }, \"display_position\": \"QB\", \"draft_analysis\": { \"average_pick\": \"19.9\", \"average_round\": \"2.8\", \"average_cost\": \"38.5\", \"percent_drafted\": \"1.00\" }, \"editorial_player_key\": \"nfl.p.7200\", \"editorial_team_abbr\": \"GB\", \"editorial_team_full_name\": \"Green Bay Packers\", \"editorial_team_key\": \"nfl.t.9\", \"eligible_positions\": { \"position\": \"QB\" }, \"has_player_notes\": 1, \"headshot\": { \"size\": \"small\", \"url\": \"https://s.yimg.com/iu/api/res/1.2/Xdm96BfVJw4WV_W7GA7xLw--~C /YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ 2/https://s.yimg.com/xe/i/us/sp/v/nfl_cutout/players_l/08202019/7200.2.png\" }, \"is_undroppable\": \"0\", \"name\": { \"ascii_first\": \"Aaron\", \"ascii_last\": \"Rodgers\", \"first\": \"Aaron\", \"full\": \"Aaron Rodgers\", \"last\": \"Rodgers\" }, \"player_id\": \"7200\", \"player_key\": \"331.p.7200\", \"player_notes_last_timestamp\": 1568581740, \"position_type\": \"O\", \"primary_position\": \"QB\", \"uniform_number\": \"12\" }) Returns: Player: YFPY Player instance containing attribute \"draft_analysis\". \"\"\" return self . query ( f \"https://fantasysports.yahooapis.com/fantasy/v2/league/ { self . get_league_key () } /players;\" f \"player_keys= { player_key } /draft_analysis\" , [ \"league\" , \"players\" , \"0\" , \"player\" ], Player )","title":"get_player_draft_analysis"},{"location":"quickstart/","text":"# -*- coding: utf-8 -*- \"\"\"YFPY demo. \"\"\" __author__ = \"Wren J. R. (uberfastman)\" __email__ = \"uberfastman@uberfastman.dev\" import os import sys from logging import DEBUG from pathlib import Path project_dir = Path ( __file__ ) . parent . parent sys . path . insert ( 0 , str ( project_dir )) from yfpy import Data # noqa: E402 from yfpy.logger import get_logger # noqa: E402 from yfpy.query import YahooFantasySportsQuery # noqa: E402 \"\"\" Example public Yahoo league URL: \"https://archive.fantasysports.yahoo.com/nfl/2014/729259\" Example vars using public Yahoo leagues still require auth through a personal Yahoo account: see README.md \"\"\" # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # ENVIRONMENT SETUP # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # set target directory for data output data_dir = Path ( __file__ ) . parent / \"output\" # create YFPY Data instance for saving/loading data data = Data ( data_dir ) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # VARIABLE SETUP # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # set desired season year def get_season (): # season = 2012 # season = 2013 # season = 2014 # season = 2015 # season = 2016 # season = 2017 # season = 2018 # season = 2019 # season = 2020 # season = 2021 # season = 2022 # season = 2023 season = 2024 return season test_season = get_season () # set desired week def get_chosen_week (): chosen_week = 1 return chosen_week test_chosen_week = get_chosen_week () # set desired date def get_chosen_date (): # HOCKEY # chosen_date = \"2013-04-15\" # NHL - 2013 (for 2012 season) chosen_date = \"2021-10-25\" # NHL - 2021 # BASEBALL # chosen_date = \"2021-04-01\" # MLB - 2021 # chosen_date = \"2022-04-10\" # MLB - 2022 # BASKETBALL # chosen_date = \"2023-11-26\" return chosen_date test_chosen_date = get_chosen_date () # set desired Yahoo Fantasy Sports game code def get_game_code (): # FOOTBALL game_code = \"nfl\" # NFL # HOCKEY # game_code = \"nhl\" # NHL # BASEBALL # game_code = \"mlb\" # MLB # BASKETBALL # game_code = \"nba\" # NBA return game_code test_game_code = get_game_code () # set desired Yahoo Fantasy Sports game ID (see the get_all_yahoo_fantasy_game_keys query to retrieve values) def get_game_id (): # FOOTBALL # game_id = 331 # NFL - 2014 # game_id = 348 # NFL - 2015 (divisions) # game_id = 359 # NFL - 2016 # game_id = 371 # NFL - 2017 # game_id = 380 # NFL - 2018 # game_id = 390 # NFL - 2019 # game_id = 399 # NFL - 2020 # game_id = 406 # NFL - 2021 # game_id = 414 # NFL - 2022 (divisions) # game_id = 423 # NFL - 2023 game_id = 449 # NFL - 2024 # HOCKEY # game_id = 303 # NHL - 2012 # game_id = 411 # NHL - 2021 # game_id = 427 # NHL - 2023 # BASEBALL # game_id = 404 # MLB - 2021 # game_id = 412 # MLB - 2022 # BASKETBALL # game_id = 428 # NBA - 2023 return game_id test_game_id = get_game_id () # set desired Yahoo Fantasy Sports game key (see the get_all_yahoo_fantasy_game_keys query to retrieve values) def get_game_key (): # FOOTBALL # game_key = \"331\" # NFL - 2014 # game_key = \"348\" # NFL - 2015 (divisions) # game_key = \"359\" # NFL - 2016 # game_key = \"371\" # NFL - 2017 # game_key = \"380\" # NFL - 2018 # game_key = \"390\" # NFL - 2019 # game_key = \"399\" # NFL - 2020 # game_key = \"406\" # NFL - 2021 # game_key = \"414\" # NFL - 2022 (divisions) # game_key = \"423\" # NFL - 2023 game_key = \"449\" # NFL - 2024 # HOCKEY # game_key = \"303\" # NHL - 2012 # game_key = \"411\" # NHL - 2021 # game_key = \"427\" # NHL - 2023 # BASEBALL # game_key = \"404\" # MLB - 2021 # game_key = \"412\" # MLB - 2022 # BASKETBALL # game_key = \"428\" # NBA - 2023 return game_key test_game_key = get_game_key () # set desired league ID (see README.md for finding value) def get_league_id (): # FOOTBALL # league_id = \"907359\" # NFL - 2015 (divisions) # league_id = \"79230\" # NFL - 2019 # league_id = \"655434\" # NFL - 2020 # league_id = \"413954\" # NFL - 2021 # league_id = \"791337\" # NFL - 2022 (divisions) # league_id = \"321958\" # NFL - 2023 league_id = \"365083\" # NFL - 2024 # HOCKEY # league_id = \"69624\" # NHL - 2012 # league_id = \"101592\" # NHL - 2021 # league_id = \"6546\" # NHL - 2021 (draft pick trading) # league_id = \"22827\" # NHL - 2023 # league_id = \"1031\" # NHL - 2023 (FAAB) # BASEBALL # league_id = \"40134\" # MLB - 2021 # BASKETBALL # league_id = \"969\" # NBA - 2023 # league_id = \"122731\" # NBA - 2023 return league_id test_league_id = get_league_id () # set desired team ID within desired league def get_team_id (): # FOOTBALL team_id = 1 # NFL # HOCKEY # team_id = 2 # NHL (2012) return team_id test_team_id = get_team_id () # set desired team name within desired league def get_team_name (): # FOOTBALL team_name = \"Let Baker Bake\" # NFL # HOCKEY # team_name = \"The Bateleurs\" # NHL (2012) return team_name test_team_name = get_team_name () # set desired team ID within desired league def get_player_id (): # FOOTBALL player_id = 30123 # NFL: Patrick Mahomes - 2020/2021/2023/2024 # HOCKEY # player_id = 4588 # NHL: Braden Holtby - 2012 # player_id = 8205 # NHL: Jeffrey Viel - 2021 # player_id = 3637 # NHL: Alex Ovechkin - 2021 # BASEBALL # player_id = 9897 # MLB: Tim Anderson - 2021/2022 # BASKETBALL # player_id = 3704 # NBA: LeBron James - 2023 return player_id test_player_id = get_player_id () # set the maximum number players you wish the get_league_players query to retrieve def get_league_player_limit (): league_player_limit = 101 return league_player_limit test_league_player_limit = get_league_player_limit () # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # QUERY SETUP # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # configure the Yahoo Fantasy Sports query (change all_output_as_json_str=True if you want to output JSON strings) query = YahooFantasySportsQuery ( test_league_id , test_game_code , game_id = test_game_id , yahoo_consumer_key = os . environ . get ( \"YAHOO_CONSUMER_KEY\" ), yahoo_consumer_secret = os . environ . get ( \"YAHOO_CONSUMER_SECRET\" ), # yahoo_access_token_json=os.environ.get(\"YAHOO_ACCESS_TOKEN_JSON\"), env_file_location = project_dir , save_token_data_to_env_file = True ) # query.save_access_token_data_to_env_file(project_dir, save_json_to_var_only=True) # Manually override league key for example code to work query . league_key = f \" { test_game_id } .l. { test_league_id } \" # Manually override player key for example code to work test_player_key = f \" { test_game_id } .p. { test_player_id } \" # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # RUN QUERIES # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # print(repr(query.get_all_yahoo_fantasy_game_keys())) # print(repr(query.get_game_key_by_season(test_season))) # print(repr(query.get_current_game_info())) # print(repr(query.get_current_game_metadata())) # print(repr(query.get_game_info_by_game_id(test_game_id))) # print(repr(query.get_game_metadata_by_game_id(test_game_id))) # print(repr(query.get_game_weeks_by_game_id(test_game_id))) # print(repr(query.get_game_stat_categories_by_game_id(test_game_id))) # print(repr(query.get_game_position_types_by_game_id(test_game_id))) # print(repr(query.get_game_roster_positions_by_game_id(test_game_id))) # print(repr(query.get_league_key(test_season))) # print(repr(query.get_current_user())) # print(repr(query.get_user_games())) # print(repr(query.get_user_leagues_by_game_key(test_game_key))) # print(repr(query.get_user_teams())) # print(repr(query.get_league_info())) # print(repr(query.get_league_metadata())) # print(repr(query.get_league_settings())) # print(repr(query.get_league_standings())) # print(repr(query.get_league_teams())) # print(repr(query.get_league_players(player_count_limit=10, player_count_start=0))) # print(repr(query.get_league_draft_results())) # print(repr(query.get_league_transactions())) # print(repr(query.get_league_scoreboard_by_week(test_chosen_week))) # print(repr(query.get_league_matchups_by_week(test_chosen_week))) # print(repr(query.get_team_info(test_team_id))) # print(repr(query.get_team_metadata(test_team_id))) # print(repr(query.get_team_stats(test_team_id))) # print(repr(query.get_team_stats_by_week(test_team_id, test_chosen_week))) # print(repr(query.get_team_standings(test_team_id))) # print(repr(query.get_team_roster_by_week(test_team_id, test_chosen_week))) # print(repr(query.get_team_roster_player_info_by_week(test_team_id, test_chosen_week))) # # print(repr(query.get_team_roster_player_info_by_date(test_team_id, test_chosen_date))) # NHL/MLB/NBA # print(repr(query.get_team_roster_player_stats(test_team_id))) # print(repr(query.get_team_roster_player_stats_by_week(test_team_id, test_chosen_week))) # print(repr(query.get_team_draft_results(test_team_id))) # print(repr(query.get_team_matchups(test_team_id))) # print(repr(query.get_player_stats_for_season(test_player_key))) # print(repr(query.get_player_stats_for_season(test_player_key, limit_to_league_stats=False))) # print(repr(query.get_player_stats_by_week(test_player_key, test_chosen_week))) # print(repr(query.get_player_stats_by_week(test_player_key, test_chosen_week, limit_to_league_stats=False))) # print(repr(query.get_player_stats_by_date(test_player_key, test_chosen_date))) # NHL/MLB/NBA # print(repr(query.get_player_stats_by_date(test_player_key, test_chosen_date, limit_to_league_stats=False))) # NHL/MLB/NBA # noqa: E501 # print(repr(query.get_player_ownership(test_player_key))) # print(repr(query.get_player_percent_owned_by_week(test_player_key, test_chosen_week))) # print(repr(query.get_player_draft_analysis(test_player_key))) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # CHECK FOR MISSING DATA FIELDS # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # logger = get_logger ( \"yfpy.models\" , DEBUG ) # query.get_all_yahoo_fantasy_game_keys() # query.get_game_key_by_season(test_season) # query.get_current_game_info() # query.get_current_game_metadata() # query.get_game_info_by_game_id(test_game_id) # query.get_game_metadata_by_game_id(test_game_id) # query.get_game_weeks_by_game_id(test_game_id) # query.get_game_stat_categories_by_game_id(test_game_id) # query.get_game_position_types_by_game_id(test_game_id) # query.get_game_roster_positions_by_game_id(test_game_id) # query.get_league_key(test_season) # query.get_current_user() # query.get_user_games() # query.get_user_leagues_by_game_key(test_game_key) # query.get_user_teams() # query.get_league_info() # query.get_league_metadata() # query.get_league_settings() # query.get_league_standings() # query.get_league_teams() # query.get_league_players(player_count_limit=10, player_count_start=0) # query.get_league_draft_results() # query.get_league_transactions() # query.get_league_scoreboard_by_week(test_chosen_week) # query.get_league_matchups_by_week(test_chosen_week) # query.get_team_info(test_team_id) # query.get_team_metadata(test_team_id) # query.get_team_stats(test_team_id) # query.get_team_stats_by_week(test_team_id, test_chosen_week) # query.get_team_standings(test_team_id) # query.get_team_roster_by_week(test_team_id, test_chosen_week) # query.get_team_roster_player_info_by_week(test_team_id, test_chosen_week) # # query.get_team_roster_player_info_by_date(test_team_id, test_chosen_date) # NHL/MLB/NBA # query.get_team_roster_player_stats(test_team_id) # query.get_team_roster_player_stats_by_week(test_team_id, test_chosen_week) # query.get_team_draft_results(test_team_id) # query.get_team_matchups(test_team_id) # query.get_player_stats_for_season(test_player_key) # query.get_player_stats_for_season(test_player_key, limit_to_league_stats=False) # query.get_player_stats_by_week(test_player_key, test_chosen_week) # query.get_player_stats_by_week(test_player_key, test_chosen_week, limit_to_league_stats=False) # query.get_player_stats_by_date(test_player_key, test_chosen_date) # NHL/MLB/NBA # query.get_player_stats_by_date(test_player_key, test_chosen_date, limit_to_league_stats=False) # NHL/MLB/NBA # query.get_player_ownership(test_player_key) # query.get_player_percent_owned_by_week(test_player_key, test_chosen_week) # query.get_player_draft_analysis(test_player_key)","title":"Quickstart"},{"location":"readme/","text":"YFPY - Yahoo Fantasy Sports API Wrapper \u00b6 Python API wrapper for the Yahoo Fantasy Sports public API Author: Wren J. R. (uberfastman) Do you like the YFPY API wrapper? Star the repository on GitHub and please consider helping support its ongoing development: Cryptocurrency Address Bitcoin (BTC) bc1qataspvklhewtswm357m0677q4raag5new2xt3e Ethereum (ETH) 0x5eAa522e66a90577D49e9E72f253EC952CDB4059 READ THE DOCS HERE! Detailed documentation on YFPY can be found at https://yfpy.uberfastman.com . Table of Contents \u00b6 About Installation Pip Manual Setup Yahoo Developer Network App Environment Variables Usage Authentication Programmatic Persistent Authentication Persistent Authentication Using Access Token Fields Persistent Authentication Using Access Token JSON Querying the Yahoo Fantasy Sports API Docker Docker Development Docker Image Deployment Testing Unit Tests Integration Tests Run Tests Dependencies Platform Python Development Troubleshooting Yahoo Fantasy Sports API About \u00b6 YFPY is a comprehensive wrapper around the Yahoo Fantasy Sports API. It allows for easy retrieval and parsing of almost any data you might wish to extract and use from any Yahoo fantasy league to which your Yahoo account has access (or for public leagues). The primary focus of this wrapper is on fantasy football (NFL), but it also supports usage with fantasy hockey (NHL), fantasy baseball (MLB), and fantasy basketball (NBA). Installation \u00b6 Pip \u00b6 If you wish to use YFPY within another project, from within your project directory, run shell pip install yfpy or add yfpy to your project requirements.txt . Manual \u00b6 If you wish to download and use YFPY locally, clone the git repository: shell git clone git@github.com:uberfastman/yfpy.git Setup \u00b6 Yahoo Developer Network App \u00b6 In order to use YFPY with private fantasy leagues, you must set up an app on your Yahoo account to allow access. Follow the step-by-step guide below for instructions on how to do so, or see Getting Started in the Yahoo Developer Network docs for more details. Note: If you are only planning on using YFPY to pull \"read only\" data from public leagues, you do not need to do this. Log in to a Yahoo account with access to whatever fantasy leagues from which you wish to retrieve data. Go to https://developer.yahoo.com/apps/create/ and create an app (you must be logged into your Yahoo account as stated above). For the app, select the following options: Application Name ( Required ): yfpy (you can name your app whatever you want, but this is just an example). Application Type ( Required ): select the Installed Application radio button. Description ( Optional ): you may write a short description of what the app does. Home Page URL ( Optional ): if you have a web address related to your app you may add it here. Redirect URI(s) ( Required ): this field must contain a valid redirect address, so you can use https://localhost:8080 API Permissions ( Required ): check the Fantasy Sports checkbox. You can leave the Read option selected (appears in an accordion expansion underneath the Fantasy Sports checkbox once you select it). Click the Create App button. Once the app is created, it should redirect you to a page for your app, which will show both a Client ID and a Client Secret . Copy the Client ID and Client Secret and proceed with the steps in Environment Variables or Programmatic Persistent Authentication . Environment Variables \u00b6 YFPY now supports the usage of environment variables, either directly within the command line or using a .env file. Any environment variables exported to the same shell in which YFPY runs will automatically be read when a YahooFantasySportsQuery object is instantiated when env_var_fallback=True (default). If you wish to also use environment variables stored in a .env file, you can set up a .env file by making a copy of .env.template in the root project directory and renaming it .env (you can do this in the command line by running cp .env.template .env ). Paste the Client ID and Client Secret retrieved by following the steps in Yahoo Developer Network App into their respective environment variables in your .env file: YAHOO_CONSUMER_KEY= YAHOO_CONSUMER_SECRET= YFPY is configured by default to check for environment variables for authentication with Yahoo, so you will now be able to proceed directly to Authentication . Note : You can disable the fallback to environment variables behavior during instantiation of a YFPY query by passing the argument env_var_fallback=False to the object: from yfpy.query import YahooFantasySportsQuery query = YahooFantasySportsQuery ( league_id = \"\" , game_code = \"nfl\" , game_id = 449 , yahoo_consumer_key = \"\" , yahoo_consumer_secret = \"\" , env_var_fallback = False ) Usage \u00b6 Authentication \u00b6 Follow the instructions in the Installation and Setup sections. The first time you use YFPY, a browser window will open up asking you to allow your app to access your Yahoo fantasy sports data. You MUST hit allow, and then copy the verification code that pops up into the command line prompt where it will now be asking for verification, hit enter, and the OAuth2 three-legged handshake should be complete and your data should have been successfully retrieved. Note : If you are running YFPY in Docker, instead of opening a new browser window, YFPY will output a URL to the command line, which you must then copy to a browser window in order to log in to your Yahoo account, allow access to your app, and retrieve the required verification code. Programmatic Persistent Authentication \u00b6 YFPY supports programmatic authentication using yahoo_consumer_key and yahoo_consumer_secret arguments when instantiating a YahooFantasySportsQuery object. Additionally, you can pass in either a valid JSON string or a Python dictionary to yahoo_access_token_json containing all required fields of a Yahoo access token. Providing yahoo_consumer_key and yahoo_consumer_secret overrides any values provided in a .env file. Providing a value to yahoo_access_token_json overrides yahoo_consumer_key / yahoo_consumer_secret values and any values provided in a .env file for Yahoo access token individual fields. Required fields (either in a JSON string with escaped double quotes or a Python dictionary) for the value of yahoo_access_token_json are the following: access_token consumer_key consumer_secret guid refresh_token token_time token_type The consumer_key and consumer_secret fields in yahoo_access_token_json override any values provided in yahoo_consumer_key / yahoo_consumer_secret . Example of Using yahoo_access_token_json : from yfpy.query import YahooFantasySportsQuery query = YahooFantasySportsQuery ( league_id = \"\" , game_code = \"nfl\" , game_id = 449 , yahoo_access_token_json = { \"access_token\" : \"\" , \"consumer_key\" : \"\" , \"consumer_secret\" : \"\" , \"guid\" : \"\" , \"refresh_token\" : \"\" , \"token_time\" : 1234567890.123456 , \"token_type\" : \"bearer\" } ) Persistent Authentication Using Access Token Fields \u00b6 YFPY no longer uses JSON files to store Yahoo credentials or access tokens. However, if you wish to preserve your access token in order to remain verified, you can now instantiate a YFPY query with save_token_data_to_env_file=True , which will write all required Yahoo access token fields an .env file located in the provided env_file_location directory. For all subsequent runs of your app, you should be able to keep retrieving Yahoo fantasy sports data using YFPY without re-verifying, since the generated refresh token should now just renew whenever you use the same .env file to authenticate your app. Note : You MUST provide a value for env_file_location or else NO Yahoo access token data will be saved! Persistent Authentication Using Access Token JSON \u00b6 YFPY also supports the use of a single environment variable by providing a valid JSON string in YAHOO_ACCESS_TOKEN_JSON . This environment variable is only used if env_var_fallback=True (default) when instantiating a YFPY query. You can save the Yahoo access token fields as valid JSON with escaped double quotes ( \" ) by invoking YahooFantasySportsQuery.save_access_token_data_to_env_file with save_json_to_var_only=True (instead of saving the Yahoo access token fields to individual environment variables as described in Persistent Authentication Using Access Token Fields ) like below: from pathlib import Path from yfpy.query import YahooFantasySportsQuery query = YahooFantasySportsQuery ( league_id = \"\" , game_code = \"nfl\" , game_id = 449 , yahoo_consumer_key = \"\" , yahoo_consumer_secret = \"\" , env_file_location = Path ( \".env\" ) ) query . save_access_token_data_to_env_file ( env_file_location = Path ( \".env\" ), save_json_to_var_only = True ) Querying the Yahoo Fantasy Sports API \u00b6 See the documentation on the yfpy.query.YahooFantasySportsQuery class for example usage of all available queries. See quickstart/quickstart.py for example usage output. Uncomment/comment out whichever configuration values in their respective functions with which you wish to experiment. Uncomment/comment out whichever query lines in the RUN QUERIES section you wish to run. Uncomment/comment out whichever query lines in the CHECK FOR MISSING DATA FIELDS section you wish to check for any new/missing data fields returned by the Yahoo Sports Fantasy Football API. Docker \u00b6 YFPY can be used within Docker for a more seamless, platform-agnostic experience. Run the Docker container (pulls the YFPY Docker image from GitHub Package Registry): shell docker compose up You can then run commands in the Docker container in two different ways: Connect to the running container and run commands from within it: shell docker exec -it yfpy-package-1 bash Then: shell python quickstart/quickstart.py Send commands to the running container from your host machine: shell docker exec -i yfpy-package-1 bash -c \"python quickstart/quickstart.py\" Docker Development \u00b6 Run the Docker container for local development (mount all local code into container): shell docker compose -f compose.yaml -f compose.dev.yaml up Docker Image Deployment \u00b6 See DEPLOYMENT.md for Docker image deployment. Testing \u00b6 YFPY has a collection of fully functional code snippets that can be run using pytest . These snippets demonstrate how to use YFPY to retrieve your Yahoo Fantasy Sports data. Unit Tests \u00b6 See the test/unit directory for example code snippets using pytest. Integration Tests \u00b6 See the test/integration directory for example code snippets using pytest. Before running any integration tests, make a copy of auth/.env.template in the auth/ directory and rename it to .env . Copy your Yahoo Client ID and Client Secret into the environment variables in .env so that pytest can use them when hitting the Yahoo Fantasy Sports API. If this is the first time running pytest with your Yahoo API credentials, you MUST allow interactive prompts within pytest by using the -s flag. The fixture values in test/integration/conftest.py are defined in quickstart/quickstart.py , and can be changed for testing by uncommenting/commenting out the values inside each respective function. Run Tests \u00b6 You can invoke all pytest tests (both integration test and unit tests) by running the below from the root directory: pytest -v -s If you want to run only the unit tests, you can run: pytest -v -s -m unit If you want to run only the integration tests, you can run: pytest -v -s -m integration Dependencies \u00b6 Platform \u00b6 YFPY has only been tested extensively on macOS, but is written to be platform-agnostic, and seems to work without issue on Windows and Linux. Python \u00b6 YFPY requires Python 3.10 or later, and has been tested through Python 3.12. Development \u00b6 Direct project dependencies can be viewed in requirements.txt , and additional development and build dependencies ( not including transitive dependencies) can be viewed in requirements-dev.txt . Troubleshooting \u00b6 Yahoo Fantasy Sports API \u00b6 Occasionally when you use the Yahoo Fantasy Sports API, there are hangups on the other end that can cause data not to transmit, and you might encounter an error similar to this: Traceback ( most recent call last ) : File \"yfpy-app.py\" , line 114 , in var = app.run () File \"/Users/your_username/PATH/T0/LOCAL/PROJECT/yfpy-app.py\" , line 429 , in run for team in team_standings: IndexError: list index out of range Typically, when the above error (or a similar error) occurs, it simply means that one of the Yahoo Fantasy Sports API calls failed and so no data was retrieved. This can be fixed by simply re-running data query.","title":"YFPY - Yahoo Fantasy Sports API Wrapper"},{"location":"readme/#yfpy-yahoo-fantasy-sports-api-wrapper","text":"Python API wrapper for the Yahoo Fantasy Sports public API Author: Wren J. R. (uberfastman) Do you like the YFPY API wrapper? Star the repository on GitHub and please consider helping support its ongoing development: Cryptocurrency Address Bitcoin (BTC) bc1qataspvklhewtswm357m0677q4raag5new2xt3e Ethereum (ETH) 0x5eAa522e66a90577D49e9E72f253EC952CDB4059 READ THE DOCS HERE! Detailed documentation on YFPY can be found at https://yfpy.uberfastman.com .","title":"YFPY - Yahoo Fantasy Sports API Wrapper"},{"location":"readme/#table-of-contents","text":"About Installation Pip Manual Setup Yahoo Developer Network App Environment Variables Usage Authentication Programmatic Persistent Authentication Persistent Authentication Using Access Token Fields Persistent Authentication Using Access Token JSON Querying the Yahoo Fantasy Sports API Docker Docker Development Docker Image Deployment Testing Unit Tests Integration Tests Run Tests Dependencies Platform Python Development Troubleshooting Yahoo Fantasy Sports API","title":"Table of Contents"},{"location":"readme/#about","text":"YFPY is a comprehensive wrapper around the Yahoo Fantasy Sports API. It allows for easy retrieval and parsing of almost any data you might wish to extract and use from any Yahoo fantasy league to which your Yahoo account has access (or for public leagues). The primary focus of this wrapper is on fantasy football (NFL), but it also supports usage with fantasy hockey (NHL), fantasy baseball (MLB), and fantasy basketball (NBA).","title":"About"},{"location":"readme/#installation","text":"","title":"Installation"},{"location":"readme/#pip","text":"If you wish to use YFPY within another project, from within your project directory, run shell pip install yfpy or add yfpy to your project requirements.txt .","title":"Pip"},{"location":"readme/#manual","text":"If you wish to download and use YFPY locally, clone the git repository: shell git clone git@github.com:uberfastman/yfpy.git","title":"Manual"},{"location":"readme/#setup","text":"","title":"Setup"},{"location":"readme/#yahoo-developer-network-app","text":"In order to use YFPY with private fantasy leagues, you must set up an app on your Yahoo account to allow access. Follow the step-by-step guide below for instructions on how to do so, or see Getting Started in the Yahoo Developer Network docs for more details. Note: If you are only planning on using YFPY to pull \"read only\" data from public leagues, you do not need to do this. Log in to a Yahoo account with access to whatever fantasy leagues from which you wish to retrieve data. Go to https://developer.yahoo.com/apps/create/ and create an app (you must be logged into your Yahoo account as stated above). For the app, select the following options: Application Name ( Required ): yfpy (you can name your app whatever you want, but this is just an example). Application Type ( Required ): select the Installed Application radio button. Description ( Optional ): you may write a short description of what the app does. Home Page URL ( Optional ): if you have a web address related to your app you may add it here. Redirect URI(s) ( Required ): this field must contain a valid redirect address, so you can use https://localhost:8080 API Permissions ( Required ): check the Fantasy Sports checkbox. You can leave the Read option selected (appears in an accordion expansion underneath the Fantasy Sports checkbox once you select it). Click the Create App button. Once the app is created, it should redirect you to a page for your app, which will show both a Client ID and a Client Secret . Copy the Client ID and Client Secret and proceed with the steps in Environment Variables or Programmatic Persistent Authentication .","title":"Yahoo Developer Network App"},{"location":"readme/#environment-variables","text":"YFPY now supports the usage of environment variables, either directly within the command line or using a .env file. Any environment variables exported to the same shell in which YFPY runs will automatically be read when a YahooFantasySportsQuery object is instantiated when env_var_fallback=True (default). If you wish to also use environment variables stored in a .env file, you can set up a .env file by making a copy of .env.template in the root project directory and renaming it .env (you can do this in the command line by running cp .env.template .env ). Paste the Client ID and Client Secret retrieved by following the steps in Yahoo Developer Network App into their respective environment variables in your .env file: YAHOO_CONSUMER_KEY= YAHOO_CONSUMER_SECRET= YFPY is configured by default to check for environment variables for authentication with Yahoo, so you will now be able to proceed directly to Authentication . Note : You can disable the fallback to environment variables behavior during instantiation of a YFPY query by passing the argument env_var_fallback=False to the object: from yfpy.query import YahooFantasySportsQuery query = YahooFantasySportsQuery ( league_id = \"\" , game_code = \"nfl\" , game_id = 449 , yahoo_consumer_key = \"\" , yahoo_consumer_secret = \"\" , env_var_fallback = False )","title":"Environment Variables"},{"location":"readme/#usage","text":"","title":"Usage"},{"location":"readme/#authentication","text":"Follow the instructions in the Installation and Setup sections. The first time you use YFPY, a browser window will open up asking you to allow your app to access your Yahoo fantasy sports data. You MUST hit allow, and then copy the verification code that pops up into the command line prompt where it will now be asking for verification, hit enter, and the OAuth2 three-legged handshake should be complete and your data should have been successfully retrieved. Note : If you are running YFPY in Docker, instead of opening a new browser window, YFPY will output a URL to the command line, which you must then copy to a browser window in order to log in to your Yahoo account, allow access to your app, and retrieve the required verification code.","title":"Authentication"},{"location":"readme/#programmatic-persistent-authentication","text":"YFPY supports programmatic authentication using yahoo_consumer_key and yahoo_consumer_secret arguments when instantiating a YahooFantasySportsQuery object. Additionally, you can pass in either a valid JSON string or a Python dictionary to yahoo_access_token_json containing all required fields of a Yahoo access token. Providing yahoo_consumer_key and yahoo_consumer_secret overrides any values provided in a .env file. Providing a value to yahoo_access_token_json overrides yahoo_consumer_key / yahoo_consumer_secret values and any values provided in a .env file for Yahoo access token individual fields. Required fields (either in a JSON string with escaped double quotes or a Python dictionary) for the value of yahoo_access_token_json are the following: access_token consumer_key consumer_secret guid refresh_token token_time token_type The consumer_key and consumer_secret fields in yahoo_access_token_json override any values provided in yahoo_consumer_key / yahoo_consumer_secret . Example of Using yahoo_access_token_json : from yfpy.query import YahooFantasySportsQuery query = YahooFantasySportsQuery ( league_id = \"\" , game_code = \"nfl\" , game_id = 449 , yahoo_access_token_json = { \"access_token\" : \"\" , \"consumer_key\" : \"\" , \"consumer_secret\" : \"\" , \"guid\" : \"\" , \"refresh_token\" : \"\" , \"token_time\" : 1234567890.123456 , \"token_type\" : \"bearer\" } )","title":"Programmatic Persistent Authentication"},{"location":"readme/#persistent-authentication-using-access-token-fields","text":"YFPY no longer uses JSON files to store Yahoo credentials or access tokens. However, if you wish to preserve your access token in order to remain verified, you can now instantiate a YFPY query with save_token_data_to_env_file=True , which will write all required Yahoo access token fields an .env file located in the provided env_file_location directory. For all subsequent runs of your app, you should be able to keep retrieving Yahoo fantasy sports data using YFPY without re-verifying, since the generated refresh token should now just renew whenever you use the same .env file to authenticate your app. Note : You MUST provide a value for env_file_location or else NO Yahoo access token data will be saved!","title":"Persistent Authentication Using Access Token Fields"},{"location":"readme/#persistent-authentication-using-access-token-json","text":"YFPY also supports the use of a single environment variable by providing a valid JSON string in YAHOO_ACCESS_TOKEN_JSON . This environment variable is only used if env_var_fallback=True (default) when instantiating a YFPY query. You can save the Yahoo access token fields as valid JSON with escaped double quotes ( \" ) by invoking YahooFantasySportsQuery.save_access_token_data_to_env_file with save_json_to_var_only=True (instead of saving the Yahoo access token fields to individual environment variables as described in Persistent Authentication Using Access Token Fields ) like below: from pathlib import Path from yfpy.query import YahooFantasySportsQuery query = YahooFantasySportsQuery ( league_id = \"\" , game_code = \"nfl\" , game_id = 449 , yahoo_consumer_key = \"\" , yahoo_consumer_secret = \"\" , env_file_location = Path ( \".env\" ) ) query . save_access_token_data_to_env_file ( env_file_location = Path ( \".env\" ), save_json_to_var_only = True )","title":"Persistent Authentication Using Access Token JSON"},{"location":"readme/#querying-the-yahoo-fantasy-sports-api","text":"See the documentation on the yfpy.query.YahooFantasySportsQuery class for example usage of all available queries. See quickstart/quickstart.py for example usage output. Uncomment/comment out whichever configuration values in their respective functions with which you wish to experiment. Uncomment/comment out whichever query lines in the RUN QUERIES section you wish to run. Uncomment/comment out whichever query lines in the CHECK FOR MISSING DATA FIELDS section you wish to check for any new/missing data fields returned by the Yahoo Sports Fantasy Football API.","title":"Querying the Yahoo Fantasy Sports API"},{"location":"readme/#docker","text":"YFPY can be used within Docker for a more seamless, platform-agnostic experience. Run the Docker container (pulls the YFPY Docker image from GitHub Package Registry): shell docker compose up You can then run commands in the Docker container in two different ways: Connect to the running container and run commands from within it: shell docker exec -it yfpy-package-1 bash Then: shell python quickstart/quickstart.py Send commands to the running container from your host machine: shell docker exec -i yfpy-package-1 bash -c \"python quickstart/quickstart.py\"","title":"Docker"},{"location":"readme/#docker-development","text":"Run the Docker container for local development (mount all local code into container): shell docker compose -f compose.yaml -f compose.dev.yaml up","title":"Docker Development"},{"location":"readme/#docker-image-deployment","text":"See DEPLOYMENT.md for Docker image deployment.","title":"Docker Image Deployment"},{"location":"readme/#testing","text":"YFPY has a collection of fully functional code snippets that can be run using pytest . These snippets demonstrate how to use YFPY to retrieve your Yahoo Fantasy Sports data.","title":"Testing"},{"location":"readme/#unit-tests","text":"See the test/unit directory for example code snippets using pytest.","title":"Unit Tests"},{"location":"readme/#integration-tests","text":"See the test/integration directory for example code snippets using pytest. Before running any integration tests, make a copy of auth/.env.template in the auth/ directory and rename it to .env . Copy your Yahoo Client ID and Client Secret into the environment variables in .env so that pytest can use them when hitting the Yahoo Fantasy Sports API. If this is the first time running pytest with your Yahoo API credentials, you MUST allow interactive prompts within pytest by using the -s flag. The fixture values in test/integration/conftest.py are defined in quickstart/quickstart.py , and can be changed for testing by uncommenting/commenting out the values inside each respective function.","title":"Integration Tests"},{"location":"readme/#run-tests","text":"You can invoke all pytest tests (both integration test and unit tests) by running the below from the root directory: pytest -v -s If you want to run only the unit tests, you can run: pytest -v -s -m unit If you want to run only the integration tests, you can run: pytest -v -s -m integration","title":"Run Tests"},{"location":"readme/#dependencies","text":"","title":"Dependencies"},{"location":"readme/#platform","text":"YFPY has only been tested extensively on macOS, but is written to be platform-agnostic, and seems to work without issue on Windows and Linux.","title":"Platform"},{"location":"readme/#python","text":"YFPY requires Python 3.10 or later, and has been tested through Python 3.12.","title":"Python"},{"location":"readme/#development","text":"Direct project dependencies can be viewed in requirements.txt , and additional development and build dependencies ( not including transitive dependencies) can be viewed in requirements-dev.txt .","title":"Development"},{"location":"readme/#troubleshooting","text":"","title":"Troubleshooting"},{"location":"readme/#yahoo-fantasy-sports-api","text":"Occasionally when you use the Yahoo Fantasy Sports API, there are hangups on the other end that can cause data not to transmit, and you might encounter an error similar to this: Traceback ( most recent call last ) : File \"yfpy-app.py\" , line 114 , in var = app.run () File \"/Users/your_username/PATH/T0/LOCAL/PROJECT/yfpy-app.py\" , line 429 , in run for team in team_standings: IndexError: list index out of range Typically, when the above error (or a similar error) occurs, it simply means that one of the Yahoo Fantasy Sports API calls failed and so no data was retrieved. This can be fixed by simply re-running data query.","title":"Yahoo Fantasy Sports API"},{"location":"test/","text":"PyTest \u00b6 conftest \u00b6 Pytest top-level conftest.py. show_log_output \u00b6 show_log_output () Turn on/off example code stdout logging output. Returns: bool ( bool ) \u2013 Boolean value representing if log output is turned on or off. Source code in test/conftest.py 11 12 13 14 15 16 17 18 19 20 @pytest . fixture def show_log_output () -> bool : \"\"\"Turn on/off example code stdout logging output. Returns: bool: Boolean value representing if log output is turned on or off. \"\"\" log_output = False return log_output integration \u00b6 Pytest integration tests for YFPY. conftest \u00b6 Pytest integration test conftest.py. data_dir \u00b6 data_dir () Code tests will output data to this directory. Source code in test/integration/conftest.py 25 26 27 28 @pytest . fixture def data_dir () -> Path : \"\"\"Code tests will output data to this directory.\"\"\" return Path ( __file__ ) . parent / \"test_output\" yahoo_data \u00b6 yahoo_data ( data_dir ) Instantiate yfpy Data object. Source code in test/integration/conftest.py 31 32 33 34 @pytest . fixture def yahoo_data ( data_dir : Union [ Path , str ]) -> Data : \"\"\"Instantiate yfpy Data object.\"\"\" return Data ( data_dir ) yahoo_query \u00b6 yahoo_query ( league_id , game_code , game_id , browser_callback ) Instantiate yfpy YahooFantasySportsQuery object and override league key. Source code in test/integration/conftest.py 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 @pytest . fixture def yahoo_query ( league_id : str , game_code : str , game_id : int , browser_callback : bool ) -> YahooFantasySportsQuery : \"\"\"Instantiate yfpy YahooFantasySportsQuery object and override league key.\"\"\" yahoo_query = YahooFantasySportsQuery ( league_id , game_code , game_id = game_id , yahoo_consumer_key = os . environ . get ( \"YFPY_CONSUMER_KEY\" ), yahoo_consumer_secret = os . environ . get ( \"YFPY_CONSUMER_SECRET\" ), env_file_location = Path ( __file__ ) . parent . parent . parent / \"env\" , all_output_as_json_str = False , browser_callback = browser_callback , offline = False , ) # Manually override league key for example code to work yahoo_query . league_key = f \" { game_id } .l. { league_id } \" return yahoo_query browser_callback \u00b6 browser_callback () Turn on/off automatic opening of browser window for OAuth. Source code in test/integration/conftest.py 58 59 60 61 62 @pytest . fixture def browser_callback () -> bool : \"\"\"Turn on/off automatic opening of browser window for OAuth.\"\"\" browser_callback = True return browser_callback season \u00b6 season () Set Yahoo Fantasy Sports season for testing. Source code in test/integration/conftest.py 65 66 67 68 @pytest . fixture def season () -> int : \"\"\"Set Yahoo Fantasy Sports season for testing.\"\"\" return quickstart . get_season () chosen_week \u00b6 chosen_week () Set Yahoo Fantasy Sports chosen week for testing. Source code in test/integration/conftest.py 71 72 73 74 @pytest . fixture def chosen_week () -> int : \"\"\"Set Yahoo Fantasy Sports chosen week for testing.\"\"\" return quickstart . get_chosen_week () chosen_date \u00b6 chosen_date () Set Yahoo Fantasy Sports chosen date for testing. Source code in test/integration/conftest.py 77 78 79 80 @pytest . fixture def chosen_date () -> str : \"\"\"Set Yahoo Fantasy Sports chosen date for testing.\"\"\" return quickstart . get_chosen_date () game_code \u00b6 game_code () Set Yahoo Fantasy Sports game code for testing. Source code in test/integration/conftest.py 83 84 85 86 @pytest . fixture def game_code () -> str : \"\"\"Set Yahoo Fantasy Sports game code for testing.\"\"\" return quickstart . get_game_code () game_id \u00b6 game_id () Set Yahoo Fantasy Sports game ID for testing. Source code in test/integration/conftest.py 89 90 91 92 @pytest . fixture def game_id () -> int : \"\"\"Set Yahoo Fantasy Sports game ID for testing.\"\"\" return quickstart . get_game_id () game_key \u00b6 game_key () Set Yahoo Fantasy Sports game key for testing. Source code in test/integration/conftest.py 95 96 97 98 @pytest . fixture def game_key () -> str : \"\"\"Set Yahoo Fantasy Sports game key for testing.\"\"\" return quickstart . get_game_key () league_id \u00b6 league_id () Set Yahoo Fantasy Sports league ID for testing. Source code in test/integration/conftest.py 101 102 103 104 @pytest . fixture def league_id () -> str : \"\"\"Set Yahoo Fantasy Sports league ID for testing.\"\"\" return quickstart . get_league_id () team_id \u00b6 team_id () Set Yahoo Fantasy Sports team ID for testing. Source code in test/integration/conftest.py 107 108 109 110 @pytest . fixture def team_id () -> int : \"\"\"Set Yahoo Fantasy Sports team ID for testing.\"\"\" return quickstart . get_team_id () team_name \u00b6 team_name () Set Yahoo Fantasy Sports team name for testing. Source code in test/integration/conftest.py 113 114 115 116 @pytest . fixture def team_name () -> str : \"\"\"Set Yahoo Fantasy Sports team name for testing.\"\"\" return quickstart . get_team_name () player_id \u00b6 player_id () Create and set Yahoo Fantasy Sports player ID for testing. Source code in test/integration/conftest.py 119 120 121 122 @pytest . fixture def player_id () -> int : \"\"\"Create and set Yahoo Fantasy Sports player ID for testing.\"\"\" return quickstart . get_player_id () player_key \u00b6 player_key ( game_id , player_id ) Create and set Yahoo Fantasy Sports player key for testing. Source code in test/integration/conftest.py 125 126 127 128 129 130 131 @pytest . fixture def player_key ( game_id , player_id ) -> str : \"\"\"Create and set Yahoo Fantasy Sports player key for testing.\"\"\" player_key = f \" { game_id } .p. { player_id } \" return player_key league_player_limit \u00b6 league_player_limit () Set Yahoo Fantasy Sports league player retrieval limit for testing. Source code in test/integration/conftest.py 134 135 136 137 @pytest . fixture def league_player_limit () -> int : \"\"\"Set Yahoo Fantasy Sports league player retrieval limit for testing.\"\"\" return quickstart . get_league_player_limit () test_api_game_data \u00b6 Pytest integration tests for Yahoo Fantasy Sports API game data. Note Tests saving and loading all Yahoo Fantasy Sports API game data. Attributes: logger ( Logger ) \u2013 Game data integration tests logger. test_get_all_yahoo_fantasy_game_keys \u00b6 test_get_all_yahoo_fantasy_game_keys ( yahoo_query , yahoo_data , game_code , game_id , show_log_output , ) Integration test for retrieval of all Yahoo fantasy football game keys. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_all_yahoo_fantasy_game_keys . Source code in test/integration/test_api_game_data.py 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 @pytest . mark . integration def test_get_all_yahoo_fantasy_game_keys ( yahoo_query , yahoo_data , game_code , game_id , show_log_output ): \"\"\"Integration test for retrieval of all Yahoo fantasy football game keys. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_all_yahoo_fantasy_game_keys`. \"\"\" query_result_data = yahoo_data . save ( f \" { game_code } -game_keys\" , yahoo_query . get_all_yahoo_fantasy_game_keys ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { game_code } -game_keys\" , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( f \" { prettify_data ( loaded_result_data ) } \\n ---------- \\n \" ) assert query_result_data == loaded_result_data test_get_game_key_by_season \u00b6 test_get_game_key_by_season ( yahoo_query , season , game_key , show_log_output ) Integration test for retrieval of specific game key by season. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_game_key_by_season . Source code in test/integration/test_api_game_data.py 57 58 59 60 61 62 63 64 65 66 67 68 69 @pytest . mark . integration def test_get_game_key_by_season ( yahoo_query , season , game_key , show_log_output ): \"\"\"Integration test for retrieval of specific game key by season. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_game_key_by_season`. \"\"\" query_result_data = yahoo_query . get_game_key_by_season ( season = season ) if show_log_output : logger . info ( prettify_data ( query_result_data )) assert query_result_data == game_key test_get_current_game_info \u00b6 test_get_current_game_info ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of game info for current fantasy season. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_current_game_info . Source code in test/integration/test_api_game_data.py 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 @pytest . mark . integration def test_get_current_game_info ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of game info for current fantasy season. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_current_game_info`. \"\"\" query_result_data = yahoo_data . save ( \"current-game-info\" , yahoo_query . get_current_game_info ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( \"current-game-info\" , Game , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_current_game_metadata \u00b6 test_get_current_game_metadata ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of game metadata for current fantasy season. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_current_game_metadata . Source code in test/integration/test_api_game_data.py 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 @pytest . mark . integration def test_get_current_game_metadata ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of game metadata for current fantasy season. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_current_game_metadata`. \"\"\" query_result_data = yahoo_data . save ( \"current-game-metadata\" , yahoo_query . get_current_game_metadata ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( \"current-game-metadata\" , Game , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_game_info_by_game_id \u00b6 test_get_game_info_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of game info for specific game by id. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_game_info_by_game_id . Source code in test/integration/test_api_game_data.py 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 @pytest . mark . integration def test_get_game_info_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of game info for specific game by id. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_game_info_by_game_id`. \"\"\" new_data_dir = data_dir / str ( season ) query_result_data = yahoo_data . save ( f \" { game_id } -game-info\" , yahoo_query . get_game_info_by_game_id , params = { \"game_id\" : game_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { game_id } -game-info\" , Game , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_game_metadata_by_game_id \u00b6 test_get_game_metadata_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of game metadata for specific game by id. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_game_metadata_by_game_id . Source code in test/integration/test_api_game_data.py 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 @pytest . mark . integration def test_get_game_metadata_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of game metadata for specific game by id. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_game_metadata_by_game_id`. \"\"\" new_data_dir = data_dir / str ( season ) query_result_data = yahoo_data . save ( f \" { game_id } -game-metadata\" , yahoo_query . get_game_metadata_by_game_id , params = { \"game_id\" : game_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { game_id } -game-metadata\" , Game , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_league_key \u00b6 test_get_league_key ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output , ) Integration test for retrieval of league key for selected league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_key . Source code in test/integration/test_api_game_data.py 184 185 186 187 188 189 190 191 192 193 194 195 196 @pytest . mark . integration def test_get_league_key ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output ): \"\"\"Integration test for retrieval of league key for selected league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_key`. \"\"\" query_result_data = yahoo_query . get_league_key () if show_log_output : logger . info ( prettify_data ( query_result_data )) assert query_result_data == f \" { game_id } .l. { league_id } \" test_get_game_weeks_by_game_id \u00b6 test_get_game_weeks_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of all valid weeks of a specific game by id. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_game_weeks_by_game_id . Source code in test/integration/test_api_game_data.py 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 @pytest . mark . integration def test_get_game_weeks_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of all valid weeks of a specific game by id. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_game_weeks_by_game_id`. \"\"\" new_data_dir = data_dir / str ( season ) query_result_data = yahoo_data . save ( f \" { game_id } -game-weeks\" , yahoo_query . get_game_weeks_by_game_id , params = { \"game_id\" : game_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { game_id } -game-weeks\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_game_stat_categories_by_game_id \u00b6 test_get_game_stat_categories_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of all valid stat categories of a specific game by id. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_game_stat_categories_by_game_id . Source code in test/integration/test_api_game_data.py 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 @pytest . mark . integration def test_get_game_stat_categories_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of all valid stat categories of a specific game by id. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_game_stat_categories_by_game_id`. \"\"\" new_data_dir = data_dir / str ( season ) query_result_data = yahoo_data . save ( f \" { game_id } -game-stat_categories\" , yahoo_query . get_game_stat_categories_by_game_id , params = { \"game_id\" : game_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { game_id } -game-stat_categories\" , StatCategories , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( query_result_data )) assert query_result_data == loaded_result_data test_get_game_position_types_by_game_id \u00b6 test_get_game_position_types_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of all valid position types for specific game by id. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_game_position_types_by_game_id . Source code in test/integration/test_api_game_data.py 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 @pytest . mark . integration def test_get_game_position_types_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of all valid position types for specific game by id. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_game_position_types_by_game_id`. \"\"\" new_data_dir = data_dir / str ( season ) query_result_data = yahoo_data . save ( f \" { game_id } -game-position_types\" , yahoo_query . get_game_position_types_by_game_id , params = { \"game_id\" : game_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { game_id } -game-position_types\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_game_roster_positions_by_game_id \u00b6 test_get_game_roster_positions_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of all valid roster positions for specific game by id. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_game_roster_positions_by_game_id . Source code in test/integration/test_api_game_data.py 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 @pytest . mark . integration def test_get_game_roster_positions_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of all valid roster positions for specific game by id. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_game_roster_positions_by_game_id`. \"\"\" new_data_dir = data_dir / str ( season ) query_result_data = yahoo_data . save ( f \" { game_id } -game-roster_positions\" , yahoo_query . get_game_roster_positions_by_game_id , params = { \"game_id\" : game_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { game_id } -game-roster_positions\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_api_league_data \u00b6 Pytest integration tests for Yahoo Fantasy Sports API league data. Note Tests saving and loading all Yahoo Fantasy Sports API league data. Attributes: logger ( Logger ) \u2013 Game data integration tests logger. test_get_league_info \u00b6 test_get_league_info ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output , ) Integration test for retrieval of info for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_info . Source code in test/integration/test_api_league_data.py 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 @pytest . mark . integration def test_get_league_info ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output ): \"\"\"Integration test for retrieval of info for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_info`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" query_result_data = yahoo_data . save ( f \" { league_id } -league-info\" , yahoo_query . get_league_info , new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { league_id } -league-info\" , League , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_league_metadata \u00b6 test_get_league_metadata ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output , ) Integration test for retrieval of metadata for chosen Yahoo fantasy league.. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_metadata . Source code in test/integration/test_api_league_data.py 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 @pytest . mark . integration def test_get_league_metadata ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output ): \"\"\"Integration test for retrieval of metadata for chosen Yahoo fantasy league.. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_metadata`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" query_result_data = yahoo_data . save ( f \" { league_id } -league-metadata\" , yahoo_query . get_league_metadata , new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { league_id } -league-metadata\" , League , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_league_settings \u00b6 test_get_league_settings ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output , ) Integration test for retrieval of settings for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_settings . Source code in test/integration/test_api_league_data.py 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 @pytest . mark . integration def test_get_league_settings ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output ): \"\"\"Integration test for retrieval of settings for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_settings`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" query_result_data = yahoo_data . save ( f \" { league_id } -league-settings\" , yahoo_query . get_league_settings , new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { league_id } -league-settings\" , Settings , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_league_standings \u00b6 test_get_league_standings ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output , ) Integration test for retrieval of standings for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_standings . Source code in test/integration/test_api_league_data.py 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 @pytest . mark . integration def test_get_league_standings ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output ): \"\"\"Integration test for retrieval of standings for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_standings`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" query_result_data = yahoo_data . save ( f \" { league_id } -league-standings\" , yahoo_query . get_league_standings , new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { league_id } -league-standings\" , Standings , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_league_teams \u00b6 test_get_league_teams ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output , ) Integration test for retrieval of all teams in chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_teams . Source code in test/integration/test_api_league_data.py 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 @pytest . mark . integration def test_get_league_teams ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output ): \"\"\"Integration test for retrieval of all teams in chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_teams`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" query_result_data = yahoo_data . save ( f \" { league_id } -league-teams\" , yahoo_query . get_league_teams , new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { league_id } -league-teams\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_league_players \u00b6 test_get_league_players ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output , ) Integration test for retrieval of players in chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_players . Source code in test/integration/test_api_league_data.py 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 @pytest . mark . skip ( reason = \"Skipping test_get_league_players: high player volume slows down tests. Run this test separately.\" ) @pytest . mark . integration def test_get_league_players ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output ): \"\"\"Integration test for retrieval of players in chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_players`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" query_result_data = yahoo_data . save ( f \" { league_id } -league-players\" , yahoo_query . get_league_players , # params={\"player_count_start\": 1400, \"player_count_limit\": 1475}, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { league_id } -league-players\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_league_players_with_limit \u00b6 test_get_league_players_with_limit ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , league_player_limit , show_log_output , ) Integration test for retrieval of a specified maximum of players in chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_players . Source code in test/integration/test_api_league_data.py 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 @pytest . mark . integration def test_get_league_players_with_limit ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , league_player_limit , show_log_output ): \"\"\"Integration test for retrieval of a specified maximum of players in chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_players`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" query_result_data = yahoo_data . save ( f \" { league_id } -league-players\" , yahoo_query . get_league_players , params = { \"player_count_limit\" : league_player_limit }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { league_id } -league-players\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_league_draft_results \u00b6 test_get_league_draft_results ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output , ) Integration test for retrieval of draft results for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_draft_results . Source code in test/integration/test_api_league_data.py 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 @pytest . mark . integration def test_get_league_draft_results ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output ): \"\"\"Integration test for retrieval of draft results for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_draft_results`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" query_result_data = yahoo_data . save ( f \" { league_id } -league-draft_results\" , yahoo_query . get_league_draft_results , new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { league_id } -league-draft_results\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_league_transactions \u00b6 test_get_league_transactions ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output , ) Integration test for retrieval of transactions for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_transactions . Source code in test/integration/test_api_league_data.py 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 @pytest . mark . integration def test_get_league_transactions ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output ): \"\"\"Integration test for retrieval of transactions for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_transactions`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" query_result_data = yahoo_data . save ( f \" { league_id } -league-transactions\" , yahoo_query . get_league_transactions , new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { league_id } -league-transactions\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_league_scoreboard_by_week \u00b6 test_get_league_scoreboard_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , show_log_output , ) Integration test for retrieval of scoreboard by week for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_scoreboard_by_week . Source code in test/integration/test_api_league_data.py 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 @pytest . mark . integration def test_get_league_scoreboard_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , show_log_output ): \"\"\"Integration test for retrieval of scoreboard by week for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_scoreboard_by_week`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / f \"week_ { chosen_week } \" query_result_data = yahoo_data . save ( f \"week_ { chosen_week } -scoreboard\" , yahoo_query . get_league_scoreboard_by_week , params = { \"chosen_week\" : chosen_week }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \"week_ { chosen_week } -scoreboard\" , Scoreboard , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_league_matchups_by_week \u00b6 test_get_league_matchups_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , show_log_output , ) Integration test for retrieval of matchups by week for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_matchups_by_week . Source code in test/integration/test_api_league_data.py 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 @pytest . mark . integration def test_get_league_matchups_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , show_log_output ): \"\"\"Integration test for retrieval of matchups by week for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_matchups_by_week`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / f \"week_ { chosen_week } \" query_result_data = yahoo_data . save ( f \"week_ { chosen_week } -matchups\" , yahoo_query . get_league_matchups_by_week , params = { \"chosen_week\" : chosen_week }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \"week_ { chosen_week } -matchups\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_api_player_data \u00b6 Pytest integration tests for Yahoo Fantasy Sports API player data. Note Tests saving and loading all Yahoo Fantasy Sports API player data. Attributes: logger ( Logger ) \u2013 Game data integration tests logger. test_get_player_stats_for_season \u00b6 test_get_player_stats_for_season ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , player_id , player_key , show_log_output , ) Integration test for retrieval of player stats by season for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_player_stats_for_season . Source code in test/integration/test_api_player_data.py 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 @pytest . mark . integration def test_get_player_stats_for_season ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , player_id , player_key , show_log_output ): \"\"\"Integration test for retrieval of player stats by season for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_player_stats_for_season`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / \"players\" query_result_data = yahoo_data . save ( f \" { player_id } -player-season-stats\" , yahoo_query . get_player_stats_for_season , params = { \"player_key\" : str ( player_key )}, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { player_id } -player-season-stats\" , Player , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_player_stats_by_week \u00b6 test_get_player_stats_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , player_id , player_key , show_log_output , ) Integration test for retrieval of player stats by week for chosen Yahoo fantasy league.. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_player_stats_by_week . Source code in test/integration/test_api_player_data.py 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 @pytest . mark . integration def test_get_player_stats_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , player_id , player_key , show_log_output ): \"\"\"Integration test for retrieval of player stats by week for chosen Yahoo fantasy league.. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_player_stats_by_week`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / f \"week_ { chosen_week } \" / \"players\" query_result_data = yahoo_data . save ( f \" { player_id } -player-stats\" , yahoo_query . get_player_stats_by_week , params = { \"player_key\" : str ( player_key ), \"chosen_week\" : str ( chosen_week )}, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { player_id } -player-stats\" , Player , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_player_stats_by_date \u00b6 test_get_player_stats_by_date ( yahoo_query , yahoo_data , data_dir , season , chosen_date , game_id , league_id , player_id , player_key , show_log_output , ) Integration test for retrieval of player stats by date for Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_player_stats_by_date . Source code in test/integration/test_api_player_data.py 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 @pytest . mark . skip ( reason = \"Skipping test_get_player_stats_by_date: retrieval by date supported by NHL/NBA/MLB, not NFL.\" ) @pytest . mark . integration def test_get_player_stats_by_date ( yahoo_query , yahoo_data , data_dir , season , chosen_date , game_id , league_id , player_id , player_key , show_log_output ): \"\"\"Integration test for retrieval of player stats by date for Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_player_stats_by_date`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / str ( chosen_date ) / \"players\" query_result_data = yahoo_data . save ( f \" { player_id } -player-stats\" , yahoo_query . get_player_stats_by_date , params = { \"player_key\" : str ( player_key ), \"chosen_date\" : chosen_date }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { player_id } -player-stats\" , Player , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_player_ownership \u00b6 test_get_player_ownership ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , player_id , player_key , show_log_output , ) Integration test for retrieval of ownership of chosen player for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_player_ownership . Source code in test/integration/test_api_player_data.py 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 @pytest . mark . integration def test_get_player_ownership ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , player_id , player_key , show_log_output ): \"\"\"Integration test for retrieval of ownership of chosen player for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_player_ownership`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / \"players\" query_result_data = yahoo_data . save ( f \" { player_id } -player-ownership\" , yahoo_query . get_player_ownership , params = { \"player_key\" : str ( player_key )}, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { player_id } -player-ownership\" , Player , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_player_percent_owned_by_week \u00b6 test_get_player_percent_owned_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , player_id , player_key , show_log_output , ) Integration test for retrieval of percent ownership by week of chosen player for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_player_percent_owned_by_week . Source code in test/integration/test_api_player_data.py 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 @pytest . mark . integration def test_get_player_percent_owned_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , player_id , player_key , show_log_output ): \"\"\"Integration test for retrieval of percent ownership by week of chosen player for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_player_percent_owned_by_week`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / f \"week_ { chosen_week } \" / \"players\" query_result_data = yahoo_data . save ( f \" { player_id } -player-percent_owned\" , yahoo_query . get_player_percent_owned_by_week , params = { \"player_key\" : str ( player_key ), \"chosen_week\" : str ( chosen_week )}, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { player_id } -player-percent_owned\" , Player , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_player_draft_analysis \u00b6 test_get_player_draft_analysis ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , player_id , player_key , show_log_output , ) Integration test for retrieval of player draft analysis of chosen player for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_player_draft_analysis . Source code in test/integration/test_api_player_data.py 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 @pytest . mark . integration def test_get_player_draft_analysis ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , player_id , player_key , show_log_output ): \"\"\"Integration test for retrieval of player draft analysis of chosen player for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_player_draft_analysis`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / \"players\" query_result_data = yahoo_data . save ( f \" { player_id } -player-draft_analysis\" , yahoo_query . get_player_draft_analysis , params = { \"player_key\" : str ( player_key )}, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { player_id } -player-draft_analysis\" , Player , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_api_team_data \u00b6 Pytest integration tests for Yahoo Fantasy Sports API team data. Note Tests saving and loading all Yahoo Fantasy Sports API team data. Attributes: logger ( Logger ) \u2013 Game data integration tests logger. test_get_team_info \u00b6 test_get_team_info ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of info for chosen team by team ID for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_info . Source code in test/integration/test_api_team_data.py 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 @pytest . mark . integration def test_get_team_info ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of info for chosen team by team ID for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_info`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / \"teams\" / f \" { team_id } - { team_name } \" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -info\" , yahoo_query . get_team_info , params = { \"team_id\" : team_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -info\" , Team , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_team_metadata \u00b6 test_get_team_metadata ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of metadata for chosen team by team ID for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_metadata . Source code in test/integration/test_api_team_data.py 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 @pytest . mark . integration def test_get_team_metadata ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of metadata for chosen team by team ID for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_metadata`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / \"teams\" / f \" { team_id } - { team_name } \" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -metadata\" , yahoo_query . get_team_metadata , params = { \"team_id\" : team_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -metadata\" , Team , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_team_stats \u00b6 test_get_team_stats ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of stats for chosen team by team ID for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_stats . Source code in test/integration/test_api_team_data.py 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 @pytest . mark . integration def test_get_team_stats ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of stats for chosen team by team ID for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_stats`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / \"teams\" / f \" { team_id } - { team_name } \" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -stats\" , yahoo_query . get_team_stats , params = { \"team_id\" : team_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -stats\" , TeamPoints , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_team_stats_by_week \u00b6 test_get_team_stats_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of stats for chosen team by team ID and by week for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_stats_by_week . Source code in test/integration/test_api_team_data.py 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 @pytest . mark . integration def test_get_team_stats_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of stats for chosen team by team ID and by week for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_stats_by_week`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / f \"week_ { chosen_week } \" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -stats\" , yahoo_query . get_team_stats_by_week , params = { \"team_id\" : team_id , \"chosen_week\" : chosen_week }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -stats\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_team_standings \u00b6 test_get_team_standings ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of standings for chosen team by team ID for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_standings . Source code in test/integration/test_api_team_data.py 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 @pytest . mark . integration def test_get_team_standings ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of standings for chosen team by team ID for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_standings`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / \"teams\" / f \" { team_id } - { team_name } \" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -standings\" , yahoo_query . get_team_standings , params = { \"team_id\" : team_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -standings\" , TeamStandings , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_team_roster_by_week \u00b6 test_get_team_roster_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of roster for chosen team by team ID and by week for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_roster_by_week . Source code in test/integration/test_api_team_data.py 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 @pytest . mark . integration def test_get_team_roster_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of roster for chosen team by team ID and by week for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_roster_by_week`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / f \"week_ { chosen_week } \" / \"rosters\" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -roster_by_week\" , yahoo_query . get_team_roster_by_week , params = { \"team_id\" : team_id , \"chosen_week\" : chosen_week }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -roster_by_week\" , Roster , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_team_roster_player_info_by_week \u00b6 test_get_team_roster_player_info_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of roster with player info for chosen team by team ID and by week for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_roster_player_info_by_week . Source code in test/integration/test_api_team_data.py 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 @pytest . mark . integration def test_get_team_roster_player_info_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of roster with player info for chosen team by team ID and by week for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_roster_player_info_by_week`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / f \"week_ { chosen_week } \" / \"rosters\" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -roster-player_info_by_week\" , yahoo_query . get_team_roster_player_info_by_week , params = { \"team_id\" : team_id , \"chosen_week\" : chosen_week }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -roster-player_info_by_week\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_team_roster_player_info_by_date \u00b6 test_get_team_roster_player_info_by_date ( yahoo_query , yahoo_data , data_dir , season , chosen_date , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of roster with player info for chosen team by team ID and by date for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_roster_player_info_by_date . Source code in test/integration/test_api_team_data.py 248 249 250 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 @pytest . mark . skip ( reason = \"Skipping test_get_team_roster_player_info_by_date: retrieval by date supported by NHL/NBA/MLB, not NFL.\" ) @pytest . mark . integration def test_get_team_roster_player_info_by_date ( yahoo_query , yahoo_data , data_dir , season , chosen_date , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of roster with player info for chosen team by team ID and by date for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_roster_player_info_by_date`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / str ( chosen_date ) / \"rosters\" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -roster-player_info_by_date\" , yahoo_query . get_team_roster_player_info_by_date , params = { \"team_id\" : team_id , \"chosen_date\" : chosen_date }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -roster-player_info_by_date\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_team_roster_player_stats \u00b6 test_get_team_roster_player_stats ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of roster with player info for chosen team by team ID and for chosen season for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_roster_player_stats . Source code in test/integration/test_api_team_data.py 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 @pytest . mark . integration def test_get_team_roster_player_stats ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of roster with player info for chosen team by team ID and for chosen season for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_roster_player_stats`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / \"rosters\" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -roster-player_stats\" , yahoo_query . get_team_roster_player_stats , params = { \"team_id\" : team_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -roster-player_stats\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_team_roster_player_stats_by_week \u00b6 test_get_team_roster_player_stats_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of roster with player info for chosen team by team ID and by week for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_roster_player_stats_by_week . Source code in test/integration/test_api_team_data.py 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 @pytest . mark . integration def test_get_team_roster_player_stats_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of roster with player info for chosen team by team ID and by week for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_roster_player_stats_by_week`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / f \"week_ { chosen_week } \" / \"rosters\" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -roster-player_stats_by_week\" , yahoo_query . get_team_roster_player_stats_by_week , params = { \"team_id\" : team_id , \"chosen_week\" : chosen_week }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -roster-player_stats_by_week\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_team_draft_results \u00b6 test_get_team_draft_results ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of draft results for chosen team by team ID for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_draft_results . Source code in test/integration/test_api_team_data.py 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 @pytest . mark . integration def test_get_team_draft_results ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of draft results for chosen team by team ID for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_draft_results`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / \"teams\" / f \" { team_id } - { team_name } \" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -draft_results\" , yahoo_query . get_team_draft_results , params = { \"team_id\" : team_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -draft_results\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_team_matchups \u00b6 test_get_team_matchups ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of matchups for chosen team by team ID for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_matchups . Source code in test/integration/test_api_team_data.py 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 @pytest . mark . integration def test_get_team_matchups ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of matchups for chosen team by team ID for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_matchups`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / \"teams\" / f \" { team_id } - { team_name } \" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -matchups\" , yahoo_query . get_team_matchups , params = { \"team_id\" : team_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -matchups\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_api_user_data \u00b6 Pytest integration tests for Yahoo Fantasy Sports API user data. Note Tests saving and loading all Yahoo Fantasy Sports API user data. Attributes: logger ( Logger ) \u2013 Game data integration tests logger. test_get_current_user \u00b6 test_get_current_user ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of metadata for current logged-in Yahoo user. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_current_user . Source code in test/integration/test_api_user_data.py 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 @pytest . mark . integration def test_get_current_user ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of metadata for current logged-in Yahoo user. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_current_user`. \"\"\" new_data_dir = data_dir query_result_data = yahoo_data . save ( \"user\" , yahoo_query . get_current_user , new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( \"user\" , User , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_user_games \u00b6 test_get_user_games ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of game history for current logged-in Yahoo user. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_user_games . Source code in test/integration/test_api_user_data.py 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 @pytest . mark . integration def test_get_user_games ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of game history for current logged-in Yahoo user. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_user_games`. \"\"\" new_data_dir = data_dir query_result_data = yahoo_data . save ( \"user-games\" , yahoo_query . get_user_games , new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( \"user-games\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_user_leagues_by_game_id \u00b6 test_get_user_leagues_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of league history by game ID for current logged-in Yahoo user. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_user_leagues_by_game_key . Source code in test/integration/test_api_user_data.py 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 @pytest . mark . skip ( reason = \"Skipping get_user_leagues_by_game_key: current logged-in user must have leagues from test season/year.\" ) @pytest . mark . integration def test_get_user_leagues_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of league history by game ID for current logged-in Yahoo user. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_user_leagues_by_game_key`. \"\"\" new_data_dir = data_dir query_result_data = yahoo_data . save ( \"user-leagues\" , yahoo_query . get_user_leagues_by_game_key , params = { \"game_key\" : game_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( \"user-leagues\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data test_get_user_teams \u00b6 test_get_user_teams ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of teams for the current game for the current logged-in Yahoo user. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_user_teams . Source code in test/integration/test_api_user_data.py 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 @pytest . mark . integration def test_get_user_teams ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of teams for the current game for the current logged-in Yahoo user. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_user_teams`. \"\"\" \"\"\"Retrieve teams for all leagues for current logged-in user for current game. \"\"\" new_data_dir = data_dir query_result_data = yahoo_data . save ( \"user-teams\" , yahoo_query . get_user_teams , new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( \"user-teams\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"PyTest"},{"location":"test/#pytest","text":"","title":"PyTest"},{"location":"test/#test.conftest","text":"Pytest top-level conftest.py.","title":"conftest"},{"location":"test/#test.conftest.show_log_output","text":"show_log_output () Turn on/off example code stdout logging output. Returns: bool ( bool ) \u2013 Boolean value representing if log output is turned on or off. Source code in test/conftest.py 11 12 13 14 15 16 17 18 19 20 @pytest . fixture def show_log_output () -> bool : \"\"\"Turn on/off example code stdout logging output. Returns: bool: Boolean value representing if log output is turned on or off. \"\"\" log_output = False return log_output","title":"show_log_output"},{"location":"test/#test.integration","text":"Pytest integration tests for YFPY.","title":"integration"},{"location":"test/#test.integration.conftest","text":"Pytest integration test conftest.py.","title":"conftest"},{"location":"test/#test.integration.conftest.data_dir","text":"data_dir () Code tests will output data to this directory. Source code in test/integration/conftest.py 25 26 27 28 @pytest . fixture def data_dir () -> Path : \"\"\"Code tests will output data to this directory.\"\"\" return Path ( __file__ ) . parent / \"test_output\"","title":"data_dir"},{"location":"test/#test.integration.conftest.yahoo_data","text":"yahoo_data ( data_dir ) Instantiate yfpy Data object. Source code in test/integration/conftest.py 31 32 33 34 @pytest . fixture def yahoo_data ( data_dir : Union [ Path , str ]) -> Data : \"\"\"Instantiate yfpy Data object.\"\"\" return Data ( data_dir )","title":"yahoo_data"},{"location":"test/#test.integration.conftest.yahoo_query","text":"yahoo_query ( league_id , game_code , game_id , browser_callback ) Instantiate yfpy YahooFantasySportsQuery object and override league key. Source code in test/integration/conftest.py 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 @pytest . fixture def yahoo_query ( league_id : str , game_code : str , game_id : int , browser_callback : bool ) -> YahooFantasySportsQuery : \"\"\"Instantiate yfpy YahooFantasySportsQuery object and override league key.\"\"\" yahoo_query = YahooFantasySportsQuery ( league_id , game_code , game_id = game_id , yahoo_consumer_key = os . environ . get ( \"YFPY_CONSUMER_KEY\" ), yahoo_consumer_secret = os . environ . get ( \"YFPY_CONSUMER_SECRET\" ), env_file_location = Path ( __file__ ) . parent . parent . parent / \"env\" , all_output_as_json_str = False , browser_callback = browser_callback , offline = False , ) # Manually override league key for example code to work yahoo_query . league_key = f \" { game_id } .l. { league_id } \" return yahoo_query","title":"yahoo_query"},{"location":"test/#test.integration.conftest.browser_callback","text":"browser_callback () Turn on/off automatic opening of browser window for OAuth. Source code in test/integration/conftest.py 58 59 60 61 62 @pytest . fixture def browser_callback () -> bool : \"\"\"Turn on/off automatic opening of browser window for OAuth.\"\"\" browser_callback = True return browser_callback","title":"browser_callback"},{"location":"test/#test.integration.conftest.season","text":"season () Set Yahoo Fantasy Sports season for testing. Source code in test/integration/conftest.py 65 66 67 68 @pytest . fixture def season () -> int : \"\"\"Set Yahoo Fantasy Sports season for testing.\"\"\" return quickstart . get_season ()","title":"season"},{"location":"test/#test.integration.conftest.chosen_week","text":"chosen_week () Set Yahoo Fantasy Sports chosen week for testing. Source code in test/integration/conftest.py 71 72 73 74 @pytest . fixture def chosen_week () -> int : \"\"\"Set Yahoo Fantasy Sports chosen week for testing.\"\"\" return quickstart . get_chosen_week ()","title":"chosen_week"},{"location":"test/#test.integration.conftest.chosen_date","text":"chosen_date () Set Yahoo Fantasy Sports chosen date for testing. Source code in test/integration/conftest.py 77 78 79 80 @pytest . fixture def chosen_date () -> str : \"\"\"Set Yahoo Fantasy Sports chosen date for testing.\"\"\" return quickstart . get_chosen_date ()","title":"chosen_date"},{"location":"test/#test.integration.conftest.game_code","text":"game_code () Set Yahoo Fantasy Sports game code for testing. Source code in test/integration/conftest.py 83 84 85 86 @pytest . fixture def game_code () -> str : \"\"\"Set Yahoo Fantasy Sports game code for testing.\"\"\" return quickstart . get_game_code ()","title":"game_code"},{"location":"test/#test.integration.conftest.game_id","text":"game_id () Set Yahoo Fantasy Sports game ID for testing. Source code in test/integration/conftest.py 89 90 91 92 @pytest . fixture def game_id () -> int : \"\"\"Set Yahoo Fantasy Sports game ID for testing.\"\"\" return quickstart . get_game_id ()","title":"game_id"},{"location":"test/#test.integration.conftest.game_key","text":"game_key () Set Yahoo Fantasy Sports game key for testing. Source code in test/integration/conftest.py 95 96 97 98 @pytest . fixture def game_key () -> str : \"\"\"Set Yahoo Fantasy Sports game key for testing.\"\"\" return quickstart . get_game_key ()","title":"game_key"},{"location":"test/#test.integration.conftest.league_id","text":"league_id () Set Yahoo Fantasy Sports league ID for testing. Source code in test/integration/conftest.py 101 102 103 104 @pytest . fixture def league_id () -> str : \"\"\"Set Yahoo Fantasy Sports league ID for testing.\"\"\" return quickstart . get_league_id ()","title":"league_id"},{"location":"test/#test.integration.conftest.team_id","text":"team_id () Set Yahoo Fantasy Sports team ID for testing. Source code in test/integration/conftest.py 107 108 109 110 @pytest . fixture def team_id () -> int : \"\"\"Set Yahoo Fantasy Sports team ID for testing.\"\"\" return quickstart . get_team_id ()","title":"team_id"},{"location":"test/#test.integration.conftest.team_name","text":"team_name () Set Yahoo Fantasy Sports team name for testing. Source code in test/integration/conftest.py 113 114 115 116 @pytest . fixture def team_name () -> str : \"\"\"Set Yahoo Fantasy Sports team name for testing.\"\"\" return quickstart . get_team_name ()","title":"team_name"},{"location":"test/#test.integration.conftest.player_id","text":"player_id () Create and set Yahoo Fantasy Sports player ID for testing. Source code in test/integration/conftest.py 119 120 121 122 @pytest . fixture def player_id () -> int : \"\"\"Create and set Yahoo Fantasy Sports player ID for testing.\"\"\" return quickstart . get_player_id ()","title":"player_id"},{"location":"test/#test.integration.conftest.player_key","text":"player_key ( game_id , player_id ) Create and set Yahoo Fantasy Sports player key for testing. Source code in test/integration/conftest.py 125 126 127 128 129 130 131 @pytest . fixture def player_key ( game_id , player_id ) -> str : \"\"\"Create and set Yahoo Fantasy Sports player key for testing.\"\"\" player_key = f \" { game_id } .p. { player_id } \" return player_key","title":"player_key"},{"location":"test/#test.integration.conftest.league_player_limit","text":"league_player_limit () Set Yahoo Fantasy Sports league player retrieval limit for testing. Source code in test/integration/conftest.py 134 135 136 137 @pytest . fixture def league_player_limit () -> int : \"\"\"Set Yahoo Fantasy Sports league player retrieval limit for testing.\"\"\" return quickstart . get_league_player_limit ()","title":"league_player_limit"},{"location":"test/#test.integration.test_api_game_data","text":"Pytest integration tests for Yahoo Fantasy Sports API game data. Note Tests saving and loading all Yahoo Fantasy Sports API game data. Attributes: logger ( Logger ) \u2013 Game data integration tests logger.","title":"test_api_game_data"},{"location":"test/#test.integration.test_api_game_data.test_get_all_yahoo_fantasy_game_keys","text":"test_get_all_yahoo_fantasy_game_keys ( yahoo_query , yahoo_data , game_code , game_id , show_log_output , ) Integration test for retrieval of all Yahoo fantasy football game keys. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_all_yahoo_fantasy_game_keys . Source code in test/integration/test_api_game_data.py 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 @pytest . mark . integration def test_get_all_yahoo_fantasy_game_keys ( yahoo_query , yahoo_data , game_code , game_id , show_log_output ): \"\"\"Integration test for retrieval of all Yahoo fantasy football game keys. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_all_yahoo_fantasy_game_keys`. \"\"\" query_result_data = yahoo_data . save ( f \" { game_code } -game_keys\" , yahoo_query . get_all_yahoo_fantasy_game_keys ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { game_code } -game_keys\" , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( f \" { prettify_data ( loaded_result_data ) } \\n ---------- \\n \" ) assert query_result_data == loaded_result_data","title":"test_get_all_yahoo_fantasy_game_keys"},{"location":"test/#test.integration.test_api_game_data.test_get_game_key_by_season","text":"test_get_game_key_by_season ( yahoo_query , season , game_key , show_log_output ) Integration test for retrieval of specific game key by season. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_game_key_by_season . Source code in test/integration/test_api_game_data.py 57 58 59 60 61 62 63 64 65 66 67 68 69 @pytest . mark . integration def test_get_game_key_by_season ( yahoo_query , season , game_key , show_log_output ): \"\"\"Integration test for retrieval of specific game key by season. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_game_key_by_season`. \"\"\" query_result_data = yahoo_query . get_game_key_by_season ( season = season ) if show_log_output : logger . info ( prettify_data ( query_result_data )) assert query_result_data == game_key","title":"test_get_game_key_by_season"},{"location":"test/#test.integration.test_api_game_data.test_get_current_game_info","text":"test_get_current_game_info ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of game info for current fantasy season. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_current_game_info . Source code in test/integration/test_api_game_data.py 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 @pytest . mark . integration def test_get_current_game_info ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of game info for current fantasy season. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_current_game_info`. \"\"\" query_result_data = yahoo_data . save ( \"current-game-info\" , yahoo_query . get_current_game_info ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( \"current-game-info\" , Game , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_current_game_info"},{"location":"test/#test.integration.test_api_game_data.test_get_current_game_metadata","text":"test_get_current_game_metadata ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of game metadata for current fantasy season. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_current_game_metadata . Source code in test/integration/test_api_game_data.py 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 @pytest . mark . integration def test_get_current_game_metadata ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of game metadata for current fantasy season. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_current_game_metadata`. \"\"\" query_result_data = yahoo_data . save ( \"current-game-metadata\" , yahoo_query . get_current_game_metadata ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( \"current-game-metadata\" , Game , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_current_game_metadata"},{"location":"test/#test.integration.test_api_game_data.test_get_game_info_by_game_id","text":"test_get_game_info_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of game info for specific game by id. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_game_info_by_game_id . Source code in test/integration/test_api_game_data.py 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 @pytest . mark . integration def test_get_game_info_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of game info for specific game by id. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_game_info_by_game_id`. \"\"\" new_data_dir = data_dir / str ( season ) query_result_data = yahoo_data . save ( f \" { game_id } -game-info\" , yahoo_query . get_game_info_by_game_id , params = { \"game_id\" : game_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { game_id } -game-info\" , Game , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_game_info_by_game_id"},{"location":"test/#test.integration.test_api_game_data.test_get_game_metadata_by_game_id","text":"test_get_game_metadata_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of game metadata for specific game by id. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_game_metadata_by_game_id . Source code in test/integration/test_api_game_data.py 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 @pytest . mark . integration def test_get_game_metadata_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of game metadata for specific game by id. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_game_metadata_by_game_id`. \"\"\" new_data_dir = data_dir / str ( season ) query_result_data = yahoo_data . save ( f \" { game_id } -game-metadata\" , yahoo_query . get_game_metadata_by_game_id , params = { \"game_id\" : game_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { game_id } -game-metadata\" , Game , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_game_metadata_by_game_id"},{"location":"test/#test.integration.test_api_game_data.test_get_league_key","text":"test_get_league_key ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output , ) Integration test for retrieval of league key for selected league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_key . Source code in test/integration/test_api_game_data.py 184 185 186 187 188 189 190 191 192 193 194 195 196 @pytest . mark . integration def test_get_league_key ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output ): \"\"\"Integration test for retrieval of league key for selected league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_key`. \"\"\" query_result_data = yahoo_query . get_league_key () if show_log_output : logger . info ( prettify_data ( query_result_data )) assert query_result_data == f \" { game_id } .l. { league_id } \"","title":"test_get_league_key"},{"location":"test/#test.integration.test_api_game_data.test_get_game_weeks_by_game_id","text":"test_get_game_weeks_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of all valid weeks of a specific game by id. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_game_weeks_by_game_id . Source code in test/integration/test_api_game_data.py 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 @pytest . mark . integration def test_get_game_weeks_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of all valid weeks of a specific game by id. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_game_weeks_by_game_id`. \"\"\" new_data_dir = data_dir / str ( season ) query_result_data = yahoo_data . save ( f \" { game_id } -game-weeks\" , yahoo_query . get_game_weeks_by_game_id , params = { \"game_id\" : game_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { game_id } -game-weeks\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_game_weeks_by_game_id"},{"location":"test/#test.integration.test_api_game_data.test_get_game_stat_categories_by_game_id","text":"test_get_game_stat_categories_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of all valid stat categories of a specific game by id. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_game_stat_categories_by_game_id . Source code in test/integration/test_api_game_data.py 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 @pytest . mark . integration def test_get_game_stat_categories_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of all valid stat categories of a specific game by id. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_game_stat_categories_by_game_id`. \"\"\" new_data_dir = data_dir / str ( season ) query_result_data = yahoo_data . save ( f \" { game_id } -game-stat_categories\" , yahoo_query . get_game_stat_categories_by_game_id , params = { \"game_id\" : game_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { game_id } -game-stat_categories\" , StatCategories , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( query_result_data )) assert query_result_data == loaded_result_data","title":"test_get_game_stat_categories_by_game_id"},{"location":"test/#test.integration.test_api_game_data.test_get_game_position_types_by_game_id","text":"test_get_game_position_types_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of all valid position types for specific game by id. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_game_position_types_by_game_id . Source code in test/integration/test_api_game_data.py 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 @pytest . mark . integration def test_get_game_position_types_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of all valid position types for specific game by id. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_game_position_types_by_game_id`. \"\"\" new_data_dir = data_dir / str ( season ) query_result_data = yahoo_data . save ( f \" { game_id } -game-position_types\" , yahoo_query . get_game_position_types_by_game_id , params = { \"game_id\" : game_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { game_id } -game-position_types\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_game_position_types_by_game_id"},{"location":"test/#test.integration.test_api_game_data.test_get_game_roster_positions_by_game_id","text":"test_get_game_roster_positions_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of all valid roster positions for specific game by id. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_game_roster_positions_by_game_id . Source code in test/integration/test_api_game_data.py 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 @pytest . mark . integration def test_get_game_roster_positions_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of all valid roster positions for specific game by id. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_game_roster_positions_by_game_id`. \"\"\" new_data_dir = data_dir / str ( season ) query_result_data = yahoo_data . save ( f \" { game_id } -game-roster_positions\" , yahoo_query . get_game_roster_positions_by_game_id , params = { \"game_id\" : game_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { game_id } -game-roster_positions\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_game_roster_positions_by_game_id"},{"location":"test/#test.integration.test_api_league_data","text":"Pytest integration tests for Yahoo Fantasy Sports API league data. Note Tests saving and loading all Yahoo Fantasy Sports API league data. Attributes: logger ( Logger ) \u2013 Game data integration tests logger.","title":"test_api_league_data"},{"location":"test/#test.integration.test_api_league_data.test_get_league_info","text":"test_get_league_info ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output , ) Integration test for retrieval of info for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_info . Source code in test/integration/test_api_league_data.py 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 @pytest . mark . integration def test_get_league_info ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output ): \"\"\"Integration test for retrieval of info for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_info`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" query_result_data = yahoo_data . save ( f \" { league_id } -league-info\" , yahoo_query . get_league_info , new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { league_id } -league-info\" , League , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_league_info"},{"location":"test/#test.integration.test_api_league_data.test_get_league_metadata","text":"test_get_league_metadata ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output , ) Integration test for retrieval of metadata for chosen Yahoo fantasy league.. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_metadata . Source code in test/integration/test_api_league_data.py 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 @pytest . mark . integration def test_get_league_metadata ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output ): \"\"\"Integration test for retrieval of metadata for chosen Yahoo fantasy league.. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_metadata`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" query_result_data = yahoo_data . save ( f \" { league_id } -league-metadata\" , yahoo_query . get_league_metadata , new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { league_id } -league-metadata\" , League , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_league_metadata"},{"location":"test/#test.integration.test_api_league_data.test_get_league_settings","text":"test_get_league_settings ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output , ) Integration test for retrieval of settings for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_settings . Source code in test/integration/test_api_league_data.py 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 @pytest . mark . integration def test_get_league_settings ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output ): \"\"\"Integration test for retrieval of settings for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_settings`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" query_result_data = yahoo_data . save ( f \" { league_id } -league-settings\" , yahoo_query . get_league_settings , new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { league_id } -league-settings\" , Settings , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_league_settings"},{"location":"test/#test.integration.test_api_league_data.test_get_league_standings","text":"test_get_league_standings ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output , ) Integration test for retrieval of standings for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_standings . Source code in test/integration/test_api_league_data.py 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 @pytest . mark . integration def test_get_league_standings ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output ): \"\"\"Integration test for retrieval of standings for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_standings`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" query_result_data = yahoo_data . save ( f \" { league_id } -league-standings\" , yahoo_query . get_league_standings , new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { league_id } -league-standings\" , Standings , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_league_standings"},{"location":"test/#test.integration.test_api_league_data.test_get_league_teams","text":"test_get_league_teams ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output , ) Integration test for retrieval of all teams in chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_teams . Source code in test/integration/test_api_league_data.py 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 @pytest . mark . integration def test_get_league_teams ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output ): \"\"\"Integration test for retrieval of all teams in chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_teams`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" query_result_data = yahoo_data . save ( f \" { league_id } -league-teams\" , yahoo_query . get_league_teams , new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { league_id } -league-teams\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_league_teams"},{"location":"test/#test.integration.test_api_league_data.test_get_league_players","text":"test_get_league_players ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output , ) Integration test for retrieval of players in chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_players . Source code in test/integration/test_api_league_data.py 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 @pytest . mark . skip ( reason = \"Skipping test_get_league_players: high player volume slows down tests. Run this test separately.\" ) @pytest . mark . integration def test_get_league_players ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output ): \"\"\"Integration test for retrieval of players in chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_players`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" query_result_data = yahoo_data . save ( f \" { league_id } -league-players\" , yahoo_query . get_league_players , # params={\"player_count_start\": 1400, \"player_count_limit\": 1475}, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { league_id } -league-players\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_league_players"},{"location":"test/#test.integration.test_api_league_data.test_get_league_players_with_limit","text":"test_get_league_players_with_limit ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , league_player_limit , show_log_output , ) Integration test for retrieval of a specified maximum of players in chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_players . Source code in test/integration/test_api_league_data.py 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 @pytest . mark . integration def test_get_league_players_with_limit ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , league_player_limit , show_log_output ): \"\"\"Integration test for retrieval of a specified maximum of players in chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_players`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" query_result_data = yahoo_data . save ( f \" { league_id } -league-players\" , yahoo_query . get_league_players , params = { \"player_count_limit\" : league_player_limit }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { league_id } -league-players\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_league_players_with_limit"},{"location":"test/#test.integration.test_api_league_data.test_get_league_draft_results","text":"test_get_league_draft_results ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output , ) Integration test for retrieval of draft results for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_draft_results . Source code in test/integration/test_api_league_data.py 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 @pytest . mark . integration def test_get_league_draft_results ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output ): \"\"\"Integration test for retrieval of draft results for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_draft_results`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" query_result_data = yahoo_data . save ( f \" { league_id } -league-draft_results\" , yahoo_query . get_league_draft_results , new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { league_id } -league-draft_results\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_league_draft_results"},{"location":"test/#test.integration.test_api_league_data.test_get_league_transactions","text":"test_get_league_transactions ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output , ) Integration test for retrieval of transactions for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_transactions . Source code in test/integration/test_api_league_data.py 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 @pytest . mark . integration def test_get_league_transactions ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , show_log_output ): \"\"\"Integration test for retrieval of transactions for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_transactions`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" query_result_data = yahoo_data . save ( f \" { league_id } -league-transactions\" , yahoo_query . get_league_transactions , new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { league_id } -league-transactions\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_league_transactions"},{"location":"test/#test.integration.test_api_league_data.test_get_league_scoreboard_by_week","text":"test_get_league_scoreboard_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , show_log_output , ) Integration test for retrieval of scoreboard by week for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_scoreboard_by_week . Source code in test/integration/test_api_league_data.py 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 @pytest . mark . integration def test_get_league_scoreboard_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , show_log_output ): \"\"\"Integration test for retrieval of scoreboard by week for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_scoreboard_by_week`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / f \"week_ { chosen_week } \" query_result_data = yahoo_data . save ( f \"week_ { chosen_week } -scoreboard\" , yahoo_query . get_league_scoreboard_by_week , params = { \"chosen_week\" : chosen_week }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \"week_ { chosen_week } -scoreboard\" , Scoreboard , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_league_scoreboard_by_week"},{"location":"test/#test.integration.test_api_league_data.test_get_league_matchups_by_week","text":"test_get_league_matchups_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , show_log_output , ) Integration test for retrieval of matchups by week for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_league_matchups_by_week . Source code in test/integration/test_api_league_data.py 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 @pytest . mark . integration def test_get_league_matchups_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , show_log_output ): \"\"\"Integration test for retrieval of matchups by week for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_league_matchups_by_week`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / f \"week_ { chosen_week } \" query_result_data = yahoo_data . save ( f \"week_ { chosen_week } -matchups\" , yahoo_query . get_league_matchups_by_week , params = { \"chosen_week\" : chosen_week }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \"week_ { chosen_week } -matchups\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_league_matchups_by_week"},{"location":"test/#test.integration.test_api_player_data","text":"Pytest integration tests for Yahoo Fantasy Sports API player data. Note Tests saving and loading all Yahoo Fantasy Sports API player data. Attributes: logger ( Logger ) \u2013 Game data integration tests logger.","title":"test_api_player_data"},{"location":"test/#test.integration.test_api_player_data.test_get_player_stats_for_season","text":"test_get_player_stats_for_season ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , player_id , player_key , show_log_output , ) Integration test for retrieval of player stats by season for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_player_stats_for_season . Source code in test/integration/test_api_player_data.py 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 @pytest . mark . integration def test_get_player_stats_for_season ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , player_id , player_key , show_log_output ): \"\"\"Integration test for retrieval of player stats by season for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_player_stats_for_season`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / \"players\" query_result_data = yahoo_data . save ( f \" { player_id } -player-season-stats\" , yahoo_query . get_player_stats_for_season , params = { \"player_key\" : str ( player_key )}, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { player_id } -player-season-stats\" , Player , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_player_stats_for_season"},{"location":"test/#test.integration.test_api_player_data.test_get_player_stats_by_week","text":"test_get_player_stats_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , player_id , player_key , show_log_output , ) Integration test for retrieval of player stats by week for chosen Yahoo fantasy league.. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_player_stats_by_week . Source code in test/integration/test_api_player_data.py 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 @pytest . mark . integration def test_get_player_stats_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , player_id , player_key , show_log_output ): \"\"\"Integration test for retrieval of player stats by week for chosen Yahoo fantasy league.. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_player_stats_by_week`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / f \"week_ { chosen_week } \" / \"players\" query_result_data = yahoo_data . save ( f \" { player_id } -player-stats\" , yahoo_query . get_player_stats_by_week , params = { \"player_key\" : str ( player_key ), \"chosen_week\" : str ( chosen_week )}, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { player_id } -player-stats\" , Player , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_player_stats_by_week"},{"location":"test/#test.integration.test_api_player_data.test_get_player_stats_by_date","text":"test_get_player_stats_by_date ( yahoo_query , yahoo_data , data_dir , season , chosen_date , game_id , league_id , player_id , player_key , show_log_output , ) Integration test for retrieval of player stats by date for Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_player_stats_by_date . Source code in test/integration/test_api_player_data.py 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 @pytest . mark . skip ( reason = \"Skipping test_get_player_stats_by_date: retrieval by date supported by NHL/NBA/MLB, not NFL.\" ) @pytest . mark . integration def test_get_player_stats_by_date ( yahoo_query , yahoo_data , data_dir , season , chosen_date , game_id , league_id , player_id , player_key , show_log_output ): \"\"\"Integration test for retrieval of player stats by date for Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_player_stats_by_date`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / str ( chosen_date ) / \"players\" query_result_data = yahoo_data . save ( f \" { player_id } -player-stats\" , yahoo_query . get_player_stats_by_date , params = { \"player_key\" : str ( player_key ), \"chosen_date\" : chosen_date }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { player_id } -player-stats\" , Player , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_player_stats_by_date"},{"location":"test/#test.integration.test_api_player_data.test_get_player_ownership","text":"test_get_player_ownership ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , player_id , player_key , show_log_output , ) Integration test for retrieval of ownership of chosen player for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_player_ownership . Source code in test/integration/test_api_player_data.py 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 @pytest . mark . integration def test_get_player_ownership ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , player_id , player_key , show_log_output ): \"\"\"Integration test for retrieval of ownership of chosen player for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_player_ownership`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / \"players\" query_result_data = yahoo_data . save ( f \" { player_id } -player-ownership\" , yahoo_query . get_player_ownership , params = { \"player_key\" : str ( player_key )}, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { player_id } -player-ownership\" , Player , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_player_ownership"},{"location":"test/#test.integration.test_api_player_data.test_get_player_percent_owned_by_week","text":"test_get_player_percent_owned_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , player_id , player_key , show_log_output , ) Integration test for retrieval of percent ownership by week of chosen player for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_player_percent_owned_by_week . Source code in test/integration/test_api_player_data.py 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 @pytest . mark . integration def test_get_player_percent_owned_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , player_id , player_key , show_log_output ): \"\"\"Integration test for retrieval of percent ownership by week of chosen player for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_player_percent_owned_by_week`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / f \"week_ { chosen_week } \" / \"players\" query_result_data = yahoo_data . save ( f \" { player_id } -player-percent_owned\" , yahoo_query . get_player_percent_owned_by_week , params = { \"player_key\" : str ( player_key ), \"chosen_week\" : str ( chosen_week )}, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { player_id } -player-percent_owned\" , Player , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_player_percent_owned_by_week"},{"location":"test/#test.integration.test_api_player_data.test_get_player_draft_analysis","text":"test_get_player_draft_analysis ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , player_id , player_key , show_log_output , ) Integration test for retrieval of player draft analysis of chosen player for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_player_draft_analysis . Source code in test/integration/test_api_player_data.py 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 @pytest . mark . integration def test_get_player_draft_analysis ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , player_id , player_key , show_log_output ): \"\"\"Integration test for retrieval of player draft analysis of chosen player for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_player_draft_analysis`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / \"players\" query_result_data = yahoo_data . save ( f \" { player_id } -player-draft_analysis\" , yahoo_query . get_player_draft_analysis , params = { \"player_key\" : str ( player_key )}, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { player_id } -player-draft_analysis\" , Player , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_player_draft_analysis"},{"location":"test/#test.integration.test_api_team_data","text":"Pytest integration tests for Yahoo Fantasy Sports API team data. Note Tests saving and loading all Yahoo Fantasy Sports API team data. Attributes: logger ( Logger ) \u2013 Game data integration tests logger.","title":"test_api_team_data"},{"location":"test/#test.integration.test_api_team_data.test_get_team_info","text":"test_get_team_info ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of info for chosen team by team ID for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_info . Source code in test/integration/test_api_team_data.py 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 @pytest . mark . integration def test_get_team_info ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of info for chosen team by team ID for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_info`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / \"teams\" / f \" { team_id } - { team_name } \" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -info\" , yahoo_query . get_team_info , params = { \"team_id\" : team_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -info\" , Team , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_team_info"},{"location":"test/#test.integration.test_api_team_data.test_get_team_metadata","text":"test_get_team_metadata ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of metadata for chosen team by team ID for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_metadata . Source code in test/integration/test_api_team_data.py 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 @pytest . mark . integration def test_get_team_metadata ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of metadata for chosen team by team ID for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_metadata`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / \"teams\" / f \" { team_id } - { team_name } \" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -metadata\" , yahoo_query . get_team_metadata , params = { \"team_id\" : team_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -metadata\" , Team , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_team_metadata"},{"location":"test/#test.integration.test_api_team_data.test_get_team_stats","text":"test_get_team_stats ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of stats for chosen team by team ID for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_stats . Source code in test/integration/test_api_team_data.py 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 @pytest . mark . integration def test_get_team_stats ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of stats for chosen team by team ID for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_stats`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / \"teams\" / f \" { team_id } - { team_name } \" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -stats\" , yahoo_query . get_team_stats , params = { \"team_id\" : team_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -stats\" , TeamPoints , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_team_stats"},{"location":"test/#test.integration.test_api_team_data.test_get_team_stats_by_week","text":"test_get_team_stats_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of stats for chosen team by team ID and by week for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_stats_by_week . Source code in test/integration/test_api_team_data.py 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 @pytest . mark . integration def test_get_team_stats_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of stats for chosen team by team ID and by week for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_stats_by_week`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / f \"week_ { chosen_week } \" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -stats\" , yahoo_query . get_team_stats_by_week , params = { \"team_id\" : team_id , \"chosen_week\" : chosen_week }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -stats\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_team_stats_by_week"},{"location":"test/#test.integration.test_api_team_data.test_get_team_standings","text":"test_get_team_standings ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of standings for chosen team by team ID for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_standings . Source code in test/integration/test_api_team_data.py 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 @pytest . mark . integration def test_get_team_standings ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of standings for chosen team by team ID for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_standings`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / \"teams\" / f \" { team_id } - { team_name } \" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -standings\" , yahoo_query . get_team_standings , params = { \"team_id\" : team_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -standings\" , TeamStandings , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_team_standings"},{"location":"test/#test.integration.test_api_team_data.test_get_team_roster_by_week","text":"test_get_team_roster_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of roster for chosen team by team ID and by week for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_roster_by_week . Source code in test/integration/test_api_team_data.py 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 @pytest . mark . integration def test_get_team_roster_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of roster for chosen team by team ID and by week for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_roster_by_week`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / f \"week_ { chosen_week } \" / \"rosters\" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -roster_by_week\" , yahoo_query . get_team_roster_by_week , params = { \"team_id\" : team_id , \"chosen_week\" : chosen_week }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -roster_by_week\" , Roster , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_team_roster_by_week"},{"location":"test/#test.integration.test_api_team_data.test_get_team_roster_player_info_by_week","text":"test_get_team_roster_player_info_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of roster with player info for chosen team by team ID and by week for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_roster_player_info_by_week . Source code in test/integration/test_api_team_data.py 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 @pytest . mark . integration def test_get_team_roster_player_info_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of roster with player info for chosen team by team ID and by week for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_roster_player_info_by_week`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / f \"week_ { chosen_week } \" / \"rosters\" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -roster-player_info_by_week\" , yahoo_query . get_team_roster_player_info_by_week , params = { \"team_id\" : team_id , \"chosen_week\" : chosen_week }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -roster-player_info_by_week\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_team_roster_player_info_by_week"},{"location":"test/#test.integration.test_api_team_data.test_get_team_roster_player_info_by_date","text":"test_get_team_roster_player_info_by_date ( yahoo_query , yahoo_data , data_dir , season , chosen_date , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of roster with player info for chosen team by team ID and by date for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_roster_player_info_by_date . Source code in test/integration/test_api_team_data.py 248 249 250 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 @pytest . mark . skip ( reason = \"Skipping test_get_team_roster_player_info_by_date: retrieval by date supported by NHL/NBA/MLB, not NFL.\" ) @pytest . mark . integration def test_get_team_roster_player_info_by_date ( yahoo_query , yahoo_data , data_dir , season , chosen_date , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of roster with player info for chosen team by team ID and by date for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_roster_player_info_by_date`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / str ( chosen_date ) / \"rosters\" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -roster-player_info_by_date\" , yahoo_query . get_team_roster_player_info_by_date , params = { \"team_id\" : team_id , \"chosen_date\" : chosen_date }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -roster-player_info_by_date\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_team_roster_player_info_by_date"},{"location":"test/#test.integration.test_api_team_data.test_get_team_roster_player_stats","text":"test_get_team_roster_player_stats ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of roster with player info for chosen team by team ID and for chosen season for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_roster_player_stats . Source code in test/integration/test_api_team_data.py 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 @pytest . mark . integration def test_get_team_roster_player_stats ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of roster with player info for chosen team by team ID and for chosen season for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_roster_player_stats`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / \"rosters\" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -roster-player_stats\" , yahoo_query . get_team_roster_player_stats , params = { \"team_id\" : team_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -roster-player_stats\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_team_roster_player_stats"},{"location":"test/#test.integration.test_api_team_data.test_get_team_roster_player_stats_by_week","text":"test_get_team_roster_player_stats_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of roster with player info for chosen team by team ID and by week for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_roster_player_stats_by_week . Source code in test/integration/test_api_team_data.py 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 @pytest . mark . integration def test_get_team_roster_player_stats_by_week ( yahoo_query , yahoo_data , data_dir , season , chosen_week , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of roster with player info for chosen team by team ID and by week for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_roster_player_stats_by_week`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / f \"week_ { chosen_week } \" / \"rosters\" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -roster-player_stats_by_week\" , yahoo_query . get_team_roster_player_stats_by_week , params = { \"team_id\" : team_id , \"chosen_week\" : chosen_week }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -roster-player_stats_by_week\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_team_roster_player_stats_by_week"},{"location":"test/#test.integration.test_api_team_data.test_get_team_draft_results","text":"test_get_team_draft_results ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of draft results for chosen team by team ID for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_draft_results . Source code in test/integration/test_api_team_data.py 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 @pytest . mark . integration def test_get_team_draft_results ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of draft results for chosen team by team ID for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_draft_results`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / \"teams\" / f \" { team_id } - { team_name } \" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -draft_results\" , yahoo_query . get_team_draft_results , params = { \"team_id\" : team_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -draft_results\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_team_draft_results"},{"location":"test/#test.integration.test_api_team_data.test_get_team_matchups","text":"test_get_team_matchups ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output , ) Integration test for retrieval of matchups for chosen team by team ID for chosen Yahoo fantasy league. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_team_matchups . Source code in test/integration/test_api_team_data.py 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 @pytest . mark . integration def test_get_team_matchups ( yahoo_query , yahoo_data , data_dir , season , game_id , league_id , team_id , team_name , show_log_output ): \"\"\"Integration test for retrieval of matchups for chosen team by team ID for chosen Yahoo fantasy league. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_team_matchups`. \"\"\" new_data_dir = data_dir / str ( season ) / f \" { game_id } .l. { league_id } \" / \"teams\" / f \" { team_id } - { team_name } \" query_result_data = yahoo_data . save ( f \" { team_id } - { team_name } -matchups\" , yahoo_query . get_team_matchups , params = { \"team_id\" : team_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( f \" { team_id } - { team_name } -matchups\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_team_matchups"},{"location":"test/#test.integration.test_api_user_data","text":"Pytest integration tests for Yahoo Fantasy Sports API user data. Note Tests saving and loading all Yahoo Fantasy Sports API user data. Attributes: logger ( Logger ) \u2013 Game data integration tests logger.","title":"test_api_user_data"},{"location":"test/#test.integration.test_api_user_data.test_get_current_user","text":"test_get_current_user ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of metadata for current logged-in Yahoo user. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_current_user . Source code in test/integration/test_api_user_data.py 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 @pytest . mark . integration def test_get_current_user ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of metadata for current logged-in Yahoo user. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_current_user`. \"\"\" new_data_dir = data_dir query_result_data = yahoo_data . save ( \"user\" , yahoo_query . get_current_user , new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( \"user\" , User , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_current_user"},{"location":"test/#test.integration.test_api_user_data.test_get_user_games","text":"test_get_user_games ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of game history for current logged-in Yahoo user. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_user_games . Source code in test/integration/test_api_user_data.py 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 @pytest . mark . integration def test_get_user_games ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of game history for current logged-in Yahoo user. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_user_games`. \"\"\" new_data_dir = data_dir query_result_data = yahoo_data . save ( \"user-games\" , yahoo_query . get_user_games , new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( \"user-games\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_user_games"},{"location":"test/#test.integration.test_api_user_data.test_get_user_leagues_by_game_id","text":"test_get_user_leagues_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of league history by game ID for current logged-in Yahoo user. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_user_leagues_by_game_key . Source code in test/integration/test_api_user_data.py 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 @pytest . mark . skip ( reason = \"Skipping get_user_leagues_by_game_key: current logged-in user must have leagues from test season/year.\" ) @pytest . mark . integration def test_get_user_leagues_by_game_id ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of league history by game ID for current logged-in Yahoo user. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_user_leagues_by_game_key`. \"\"\" new_data_dir = data_dir query_result_data = yahoo_data . save ( \"user-leagues\" , yahoo_query . get_user_leagues_by_game_key , params = { \"game_key\" : game_id }, new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( \"user-leagues\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_user_leagues_by_game_id"},{"location":"test/#test.integration.test_api_user_data.test_get_user_teams","text":"test_get_user_teams ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output , ) Integration test for retrieval of teams for the current game for the current logged-in Yahoo user. Note Tests :func: ~yfpy.query.YahooFantasySportsQuery.get_user_teams . Source code in test/integration/test_api_user_data.py 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 @pytest . mark . integration def test_get_user_teams ( yahoo_query , yahoo_data , data_dir , season , game_id , show_log_output ): \"\"\"Integration test for retrieval of teams for the current game for the current logged-in Yahoo user. Note: Tests :func:`~yfpy.query.YahooFantasySportsQuery.get_user_teams`. \"\"\" \"\"\"Retrieve teams for all leagues for current logged-in user for current game. \"\"\" new_data_dir = data_dir query_result_data = yahoo_data . save ( \"user-teams\" , yahoo_query . get_user_teams , new_data_dir = new_data_dir ) if show_log_output : logger . info ( prettify_data ( query_result_data )) loaded_result_data = yahoo_data . load ( \"user-teams\" , new_data_dir = new_data_dir , all_output_as_json_str = yahoo_query . all_output_as_json_str ) if show_log_output : logger . info ( prettify_data ( loaded_result_data )) assert query_result_data == loaded_result_data","title":"test_get_user_teams"},{"location":"utils/","text":"Utilities \u00b6 YFPY module for managing complex JSON data structures. Attributes: logger ( Logger ) \u2013 Module level logger for usage and debugging. retrieve_game_code_from_user \u00b6 retrieve_game_code_from_user () Recursive function to retrieve required Yahoo Fantasy Sports game code from user input. Returns: str ( str ) \u2013 Yahoo Fantasy Sports game code (\"nfl\", \"nhl\", \"mlb\", or \"nba\"). Source code in yfpy/utils.py 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 def retrieve_game_code_from_user () -> str : \"\"\"Recursive function to retrieve required Yahoo Fantasy Sports game code from user input. Returns: str: Yahoo Fantasy Sports game code (\"nfl\", \"nhl\", \"mlb\", or \"nba\"). \"\"\" game_code = input ( \"YFPY requires the use of a Yahoo Fantasy Sports game code in order to select the correct sport. Please enter \" \"NFL, NHL, MLB, or NBA (case does not matter) here -> \" ) game_code = game_code . strip () . lower () if game_code in yahoo_fantasy_sports_game_codes : return game_code else : logger . warning ( f \"Selection \\\" { game_code } \\\" is not a valid Yahoo Fantasy Sports game code. Please try again.\" ) sleep ( 0.25 ) return retrieve_game_code_from_user () complex_json_handler \u00b6 complex_json_handler ( obj ) Custom handler to allow custom YFPY objects to be serialized into JSON. Parameters: obj ( Any ) \u2013 Unserializable Python object to be serialized into JSON. Returns: Any ( Any ) \u2013 Serializable version of the Python object. Source code in yfpy/utils.py 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 def complex_json_handler ( obj : Any ) -> Any : \"\"\"Custom handler to allow custom YFPY objects to be serialized into JSON. Args: obj (Any): Unserializable Python object to be serialized into JSON. Returns: Any: Serializable version of the Python object. \"\"\" if hasattr ( obj , \"serialized\" ): return obj . serialized () else : try : return str ( obj , \"utf-8\" ) except TypeError : raise TypeError ( 'Object of type %s with value of %s is not JSON serializable' % ( type ( obj ), repr ( obj ))) jsonify_data \u00b6 jsonify_data ( data ) Function to serialize a YahooFantasyObject to a JSON string. Parameters: data ( object ) \u2013 YahooFantasyObject to be serialized to a JSON string. Returns: str ( str ) \u2013 JSON string serialized from YahooFantasyObject. Source code in yfpy/utils.py 65 66 67 68 69 70 71 72 73 74 75 def jsonify_data ( data : object ) -> str : \"\"\"Function to serialize a YahooFantasyObject to a JSON string. Args: data (object): YahooFantasyObject to be serialized to a JSON string. Returns: str: JSON string serialized from YahooFantasyObject. \"\"\" return json . dumps ( data , indent = 2 , ensure_ascii = False , default = complex_json_handler ) jsonify_data_to_file \u00b6 jsonify_data_to_file ( data , data_file ) Function to serialize a YahooFantasyObject to JSON and output it to a file. Parameters: data ( object ) \u2013 YahooFantasyObject to be serialized to JSON and output to a file. data_file ( IO [ str ] ) \u2013 Target filestream for writing the data. Source code in yfpy/utils.py 78 79 80 81 82 83 84 85 86 def jsonify_data_to_file ( data : object , data_file : IO [ str ]) -> None : \"\"\"Function to serialize a YahooFantasyObject to JSON and output it to a file. Args: data (object): YahooFantasyObject to be serialized to JSON and output to a file. data_file (IO[str]): Target filestream for writing the data. \"\"\" json . dump ( data , data_file , indent = 2 , ensure_ascii = False , default = complex_json_handler ) prettify_data \u00b6 prettify_data ( data ) Function to return pretty formatted JSON strings for easily readable output from objects. Parameters: data ( object ) \u2013 Data object to be printed as an easily readable JSON string. Returns: str ( str ) \u2013 JSON string that has been formatted with indents (two spaces). Source code in yfpy/utils.py 89 90 91 92 93 94 95 96 97 98 99 def prettify_data ( data : object ) -> str : \"\"\"Function to return pretty formatted JSON strings for easily readable output from objects. Args: data (object): Data object to be printed as an easily readable JSON string. Returns: str: JSON string that has been formatted with indents (two spaces). \"\"\" return f \" \\n { jsonify_data ( data ) } \\n \" unpack_data \u00b6 unpack_data ( json_obj , parent_class = None ) Recursive function to parse, clean, and assign custom data types to retrieved Yahoo Fantasy Sports data. Parameters: json_obj ( Any ) \u2013 JSON object for parsing (can be a dictionary, list, or primitive). parent_class ( Type , default: None ) \u2013 Parent class type used to extract custom subclass type options for casting. Returns: Any ( Any ) \u2013 Recursively returns JSON objects until data is completely parsed, cleaned, and typed (where applicable). Source code in yfpy/utils.py 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 def unpack_data ( json_obj : Any , parent_class : Type = None ) -> Any : \"\"\"Recursive function to parse, clean, and assign custom data types to retrieved Yahoo Fantasy Sports data. Args: json_obj (Any): JSON object for parsing (can be a dictionary, list, or primitive). parent_class (Type): Parent class type used to extract custom subclass type options for casting. Returns: Any: Recursively returns JSON objects until data is completely parsed, cleaned, and typed (where applicable). \"\"\" # extract subclasses from parent class for typing subclasses = {} if parent_class : subclasses = { stringcase . snakecase ( cls . __name__ ): cls for cls in parent_class . __subclasses__ ()} # discard empty lists and dictionaries and include when json value = 0 if json_obj == 0 or json_obj : # handle lists if isinstance ( json_obj , list ): json_obj = [ obj for obj in json_obj if ( obj == 0 or obj )] if len ( json_obj ) == 1 : return unpack_data ( json_obj [ 0 ], parent_class ) else : # flatten list of dicts if any objects in the list are dicts if any ( isinstance ( obj , dict ) for obj in json_obj ): return flatten_json_dict_list ( json_obj , parent_class ) return [ unpack_data ( obj , parent_class ) for obj in json_obj if ( obj == 0 or obj )] # handle dictionaries elif isinstance ( json_obj , dict ): # eliminate odd single-key Yahoo dicts with key = \"0\" and value = if \"0\" in json_obj . keys () and \"1\" not in json_obj . keys (): if len ( json_obj . keys ()) == 1 : return unpack_data ( json_obj . get ( \"0\" ), parent_class ) else : if isinstance ( json_obj . get ( \"0\" ), dict ): json_obj . update ( json_obj . pop ( \"0\" )) # eliminate data obj counts (except in player_position dicts, which have position counts in league settings) if \"count\" in json_obj . keys () and \"position\" in json_obj . keys (): # assign/cast data type where applicable # TODO: figure out how to do this without explicit object type keys return get_type ( { k : unpack_data ( v , parent_class ) for k , v in json_obj . items ()}, parent_class , subclasses ) else : # assign/cast data type where applicable # TODO: figure out how to do this without explicit object type keys json_obj = get_type ( { k : unpack_data ( v , parent_class ) for k , v in json_obj . items () if k != \"count\" }, parent_class , subclasses ) # flatten dicts with keys \"0\", \"1\",..., \"n\" to a list of objects if \"0\" in json_obj . keys () and \"1\" in json_obj . keys (): json_obj = flatten_to_list ( json_obj ) # TODO: figure out how to do this without breaking the above unpacking using explicit type keys # else: # # flatten dicts with redundant keys to a list of objects # if len(json_obj.keys()) == 1 and len(json_obj.values()) == 1: # key = list(json_obj.keys())[0] # value = list(json_obj.values())[0] # json_obj = value return json_obj else : return convert_strings_to_numeric_equivalents ( json_obj ) convert_strings_to_numeric_equivalents \u00b6 convert_strings_to_numeric_equivalents ( json_obj ) Convert JSON strings with integer or float numeric representations to their respective integer or float values. Parameters: json_obj ( Any ) \u2013 JSON object (typically a dictionary or list, but can also be a primitive). Returns: Union [ int , float , Any ] \u2013 int | float | Any: The numeric representation of any JSON strings that can be represented as integers or floats, Union [ int , float , Any ] \u2013 else the original JSON object. Source code in yfpy/utils.py 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 def convert_strings_to_numeric_equivalents ( json_obj : Any ) -> Union [ int , float , Any ]: \"\"\"Convert JSON strings with integer or float numeric representations to their respective integer or float values. Args: json_obj (Any): JSON object (typically a dictionary or list, but can also be a primitive). Returns: int | float | Any: The numeric representation of any JSON strings that can be represented as integers or floats, else the original JSON object. \"\"\" if isinstance ( json_obj , str ): if len ( json_obj ) > 1 and str . startswith ( json_obj , \"0\" ): return json_obj else : if str . isdigit ( json_obj ): return int ( json_obj ) elif str . isdigit ( re . sub ( \"[-]\" , \"\" , re . sub ( \"[.]\" , \"\" , json_obj , count = 1 ), count = 1 )): return float ( json_obj ) else : return json_obj else : return json_obj get_type \u00b6 get_type ( json_obj_dict , parent_class , subclasses ) Cast JSON object to custom subclass type extracted from parent class. Parameters: json_obj_dict ( dict of str ) \u2013 Any): JSON dictionary with strings of data type as keys and JSON objects as values. parent_class ( Type ) \u2013 Parent class from which to derive subclasses for casting. subclasses ( dict of str ) \u2013 Type): Dictionary of subclasses with strings that match the json dict keys as keys and classes for casting as values. Returns: object ( Dict [ str , Any ] ) \u2013 A Python object (representing the original JSON object) that has been cast to the specified type. Source code in yfpy/utils.py 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 def get_type ( json_obj_dict : Dict [ str , Any ], parent_class : Type , subclasses : Dict [ str , Type ]) -> Dict [ str , Any ]: \"\"\"Cast JSON object to custom subclass type extracted from parent class. Args: json_obj_dict (dict of str: Any): JSON dictionary with strings of data type as keys and JSON objects as values. parent_class (Type): Parent class from which to derive subclasses for casting. subclasses (dict of str: Type): Dictionary of subclasses with strings that match the json dict keys as keys and classes for casting as values. Returns: object: A Python object (representing the original JSON object) that has been cast to the specified type. \"\"\" for k , v in json_obj_dict . items (): # check if key is in the provided subclasses' dict, that the object isn't already cast if k in subclasses . keys () and isinstance ( v , dict ) and not isinstance ( v , subclasses . get ( k )): json_obj_dict [ k ] = subclasses [ k ]( unpack_data ( v , parent_class )) return json_obj_dict flatten_json_dict_list \u00b6 flatten_json_dict_list ( json_obj_dict_list , parent_class ) Recursive function to flatten JSON lists containing all disparate JSON dictionaries with no overlapping keys. Parameters: json_obj_dict_list ( list [ dict [ str , Any ]] ) \u2013 List of JSON dictionaries. parent_class ( Type ) \u2013 Parent class type used to extract custom subclass type options. Returns: Any \u2013 dict | list: Returns a dictionary if the list was flattened, else a cleaned list if no flattening was needed. Source code in yfpy/utils.py 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 def flatten_json_dict_list ( json_obj_dict_list : List [ Dict [ str , Any ]], parent_class : Type ) -> Any : \"\"\"Recursive function to flatten JSON lists containing all disparate JSON dictionaries with no overlapping keys. Args: json_obj_dict_list (list[dict[str, Any]]): List of JSON dictionaries. parent_class (Type): Parent class type used to extract custom subclass type options. Returns: dict | list: Returns a dictionary if the list was flattened, else a cleaned list if no flattening was needed. \"\"\" # filter out empty lists and dicts but include when value = 0 json_obj_dict_list = [ obj for obj in json_obj_dict_list if ( obj == 0 or obj )] item_keys = [] ndx = 0 for item in json_obj_dict_list : if isinstance ( item , list ): flattened_item = flatten_json_dict_list ( item , parent_class ) json_obj_dict_list [ ndx ] = flattened_item item_keys . extend ( list ( flattened_item . keys ())) else : item_keys . extend ( list ( item . keys ())) ndx += 1 if len ( item_keys ) == len ( set ( item_keys )): agg_dict = {} for dict_item in json_obj_dict_list : agg_dict . update ( dict_item ) return unpack_data ( agg_dict , parent_class ) else : return [ unpack_data ( obj , parent_class ) for obj in json_obj_dict_list if ( obj == 0 or obj )] flatten_to_list \u00b6 flatten_to_list ( json_obj ) Function to flatten JSON dictionaries with unnecessary keys to a list of objects. Parameters: json_obj ( Any ) \u2013 JSON object (typically a dictionary or list, but can also be a primitive). Returns: list ( Any ) \u2013 A list made from a flattened dictionary if json_obj was a dictionary, the original list if json_obj was a Any \u2013 list, or the original value if json_obj was a primitive. Source code in yfpy/utils.py 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 def flatten_to_list ( json_obj : Any ) -> Any : \"\"\"Function to flatten JSON dictionaries with unnecessary keys to a list of objects. Args: json_obj (Any): JSON object (typically a dictionary or list, but can also be a primitive). Returns: list: A list made from a flattened dictionary if json_obj was a dictionary, the original list if json_obj was a list, or the original value if json_obj was a primitive. \"\"\" if isinstance ( json_obj , dict ): out = [] for k , v in json_obj . items (): out . append ( v ) return out else : return json_obj flatten_to_objects \u00b6 flatten_to_objects ( json_obj ) Function to flatten a JSON dictionary (or a JSON dictionary in a list) to a dictionary of cast objects. Parameters: json_obj ( Any ) \u2013 JSON object (typically a dictionary or list, but can also be a primitive). Returns: Any \u2013 dict | list | int | float | str | bool: JSON dictionary/list/primitive with contents cast to Python objects. Source code in yfpy/utils.py 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 def flatten_to_objects ( json_obj : Any ) -> Any : \"\"\"Function to flatten a JSON dictionary (or a JSON dictionary in a list) to a dictionary of cast objects. Args: json_obj (Any): JSON object (typically a dictionary or list, but can also be a primitive). Returns: dict | list | int | float | str | bool: JSON dictionary/list/primitive with contents cast to Python objects. \"\"\" if isinstance ( json_obj , dict ): return dict_to_list ( json_obj ) elif isinstance ( json_obj , list ): if isinstance ( json_obj [ 0 ], dict ): return dict_to_list ( json_obj [ 0 ]) else : return json_obj dict_to_list \u00b6 dict_to_list ( json_dict ) Function to convert a JSON dictionary to a list. Parameters: json_dict ( dict [ str , Any ] ) \u2013 JSON dictionary. Returns: list ( Any ) \u2013 A list derived from a JSON dictionary, or the original dictionary if it does not contain dictionaries as Any \u2013 values. Source code in yfpy/utils.py 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 def dict_to_list ( json_dict : Dict [ str , Any ]) -> Any : \"\"\"Function to convert a JSON dictionary to a list. Args: json_dict (dict[str, Any]): JSON dictionary. Returns: list: A list derived from a JSON dictionary, or the original dictionary if it does not contain dictionaries as values. \"\"\" first_key = list ( json_dict . keys ())[ 0 ] if isinstance ( json_dict . get ( first_key ), dict ): first_val_key = list ( json_dict . get ( first_key ) . keys ())[ 0 ] if first_key [: - 1 ] == first_val_key : out = [] for k , v in json_dict . items (): out . append ( v . get ( first_val_key )) return out return json_dict reorganize_json_dict \u00b6 reorganize_json_dict ( json_dict , obj_key , val_to_key ) Function to reorganize a JSON dictionary of dictionaries. The reorganized JSON dictionary is an ordered dictionary sorted by a specific attribute of the value dictionaries. Parameters: json_dict ( dict of str ) \u2013 Any): JSON dictionary. obj_key ( str ) \u2013 Key to access the dictionaries contained in json_dict. val_to_key ( str ) \u2013 Key used to sort the dictionaries contained in json_dict. Returns: Dict [ str , Any ] \u2013 dict[str, Any]: An ordered dictionary of dictionaries sorted by val_to_key. Source code in yfpy/utils.py 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 def reorganize_json_dict ( json_dict : Dict [ str , Any ], obj_key : str , val_to_key : str ) -> Dict [ str , Any ]: \"\"\"Function to reorganize a JSON dictionary of dictionaries. The reorganized JSON dictionary is an ordered dictionary sorted by a specific attribute of the value dictionaries. Args: json_dict (dict of str: Any): JSON dictionary. obj_key (str): Key to access the dictionaries contained in json_dict. val_to_key (str): Key used to sort the dictionaries contained in json_dict. Returns: dict[str, Any]: An ordered dictionary of dictionaries sorted by val_to_key. \"\"\" out = {} for k , v in json_dict . items (): out [ str ( getattr ( v . get ( obj_key ), val_to_key ))] = v . get ( obj_key ) return OrderedDict ( ( str ( k ), out [ str ( k )]) for k in sorted ( [ int ( k_v ) if isinstance ( k_v , int ) else k_v for k_v in out . keys ()])) reformat_json_list \u00b6 reformat_json_list ( json_obj ) Function to clean and reformat JSON lists to eliminate empty values and unnecessarily nested lists. Parameters: json_obj ( Any ) \u2013 JSON object (typically a dictionary or list, but can also be a primitive) to be cleaned. Returns: Any ( Any ) \u2013 Reformatted JSON list derived from original JSON object. Source code in yfpy/utils.py 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 def reformat_json_list ( json_obj : Any ) -> Any : \"\"\"Function to clean and reformat JSON lists to eliminate empty values and unnecessarily nested lists. Args: json_obj (Any): JSON object (typically a dictionary or list, but can also be a primitive) to be cleaned. Returns: Any: Reformatted JSON list derived from original JSON object. \"\"\" if isinstance ( json_obj [ 0 ], list ): if len ( json_obj ) > 1 : return reformat_json_list ( [ reformat_json_list ( item ) if isinstance ( item , list ) else item for item in json_obj ]) else : return reformat_json_list ( json_obj [ 0 ]) else : # create chain map that filters out empty lists/dicts but leaves objects where value = 0 return ChainMap ( * [ value for value in json_obj if ( value == 0 or value )])","title":"Utilities"},{"location":"utils/#utilities","text":"YFPY module for managing complex JSON data structures. Attributes: logger ( Logger ) \u2013 Module level logger for usage and debugging.","title":"Utilities"},{"location":"utils/#yfpy.utils.retrieve_game_code_from_user","text":"retrieve_game_code_from_user () Recursive function to retrieve required Yahoo Fantasy Sports game code from user input. Returns: str ( str ) \u2013 Yahoo Fantasy Sports game code (\"nfl\", \"nhl\", \"mlb\", or \"nba\"). Source code in yfpy/utils.py 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 def retrieve_game_code_from_user () -> str : \"\"\"Recursive function to retrieve required Yahoo Fantasy Sports game code from user input. Returns: str: Yahoo Fantasy Sports game code (\"nfl\", \"nhl\", \"mlb\", or \"nba\"). \"\"\" game_code = input ( \"YFPY requires the use of a Yahoo Fantasy Sports game code in order to select the correct sport. Please enter \" \"NFL, NHL, MLB, or NBA (case does not matter) here -> \" ) game_code = game_code . strip () . lower () if game_code in yahoo_fantasy_sports_game_codes : return game_code else : logger . warning ( f \"Selection \\\" { game_code } \\\" is not a valid Yahoo Fantasy Sports game code. Please try again.\" ) sleep ( 0.25 ) return retrieve_game_code_from_user ()","title":"retrieve_game_code_from_user"},{"location":"utils/#yfpy.utils.complex_json_handler","text":"complex_json_handler ( obj ) Custom handler to allow custom YFPY objects to be serialized into JSON. Parameters: obj ( Any ) \u2013 Unserializable Python object to be serialized into JSON. Returns: Any ( Any ) \u2013 Serializable version of the Python object. Source code in yfpy/utils.py 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 def complex_json_handler ( obj : Any ) -> Any : \"\"\"Custom handler to allow custom YFPY objects to be serialized into JSON. Args: obj (Any): Unserializable Python object to be serialized into JSON. Returns: Any: Serializable version of the Python object. \"\"\" if hasattr ( obj , \"serialized\" ): return obj . serialized () else : try : return str ( obj , \"utf-8\" ) except TypeError : raise TypeError ( 'Object of type %s with value of %s is not JSON serializable' % ( type ( obj ), repr ( obj )))","title":"complex_json_handler"},{"location":"utils/#yfpy.utils.jsonify_data","text":"jsonify_data ( data ) Function to serialize a YahooFantasyObject to a JSON string. Parameters: data ( object ) \u2013 YahooFantasyObject to be serialized to a JSON string. Returns: str ( str ) \u2013 JSON string serialized from YahooFantasyObject. Source code in yfpy/utils.py 65 66 67 68 69 70 71 72 73 74 75 def jsonify_data ( data : object ) -> str : \"\"\"Function to serialize a YahooFantasyObject to a JSON string. Args: data (object): YahooFantasyObject to be serialized to a JSON string. Returns: str: JSON string serialized from YahooFantasyObject. \"\"\" return json . dumps ( data , indent = 2 , ensure_ascii = False , default = complex_json_handler )","title":"jsonify_data"},{"location":"utils/#yfpy.utils.jsonify_data_to_file","text":"jsonify_data_to_file ( data , data_file ) Function to serialize a YahooFantasyObject to JSON and output it to a file. Parameters: data ( object ) \u2013 YahooFantasyObject to be serialized to JSON and output to a file. data_file ( IO [ str ] ) \u2013 Target filestream for writing the data. Source code in yfpy/utils.py 78 79 80 81 82 83 84 85 86 def jsonify_data_to_file ( data : object , data_file : IO [ str ]) -> None : \"\"\"Function to serialize a YahooFantasyObject to JSON and output it to a file. Args: data (object): YahooFantasyObject to be serialized to JSON and output to a file. data_file (IO[str]): Target filestream for writing the data. \"\"\" json . dump ( data , data_file , indent = 2 , ensure_ascii = False , default = complex_json_handler )","title":"jsonify_data_to_file"},{"location":"utils/#yfpy.utils.prettify_data","text":"prettify_data ( data ) Function to return pretty formatted JSON strings for easily readable output from objects. Parameters: data ( object ) \u2013 Data object to be printed as an easily readable JSON string. Returns: str ( str ) \u2013 JSON string that has been formatted with indents (two spaces). Source code in yfpy/utils.py 89 90 91 92 93 94 95 96 97 98 99 def prettify_data ( data : object ) -> str : \"\"\"Function to return pretty formatted JSON strings for easily readable output from objects. Args: data (object): Data object to be printed as an easily readable JSON string. Returns: str: JSON string that has been formatted with indents (two spaces). \"\"\" return f \" \\n { jsonify_data ( data ) } \\n \"","title":"prettify_data"},{"location":"utils/#yfpy.utils.unpack_data","text":"unpack_data ( json_obj , parent_class = None ) Recursive function to parse, clean, and assign custom data types to retrieved Yahoo Fantasy Sports data. Parameters: json_obj ( Any ) \u2013 JSON object for parsing (can be a dictionary, list, or primitive). parent_class ( Type , default: None ) \u2013 Parent class type used to extract custom subclass type options for casting. Returns: Any ( Any ) \u2013 Recursively returns JSON objects until data is completely parsed, cleaned, and typed (where applicable). Source code in yfpy/utils.py 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 def unpack_data ( json_obj : Any , parent_class : Type = None ) -> Any : \"\"\"Recursive function to parse, clean, and assign custom data types to retrieved Yahoo Fantasy Sports data. Args: json_obj (Any): JSON object for parsing (can be a dictionary, list, or primitive). parent_class (Type): Parent class type used to extract custom subclass type options for casting. Returns: Any: Recursively returns JSON objects until data is completely parsed, cleaned, and typed (where applicable). \"\"\" # extract subclasses from parent class for typing subclasses = {} if parent_class : subclasses = { stringcase . snakecase ( cls . __name__ ): cls for cls in parent_class . __subclasses__ ()} # discard empty lists and dictionaries and include when json value = 0 if json_obj == 0 or json_obj : # handle lists if isinstance ( json_obj , list ): json_obj = [ obj for obj in json_obj if ( obj == 0 or obj )] if len ( json_obj ) == 1 : return unpack_data ( json_obj [ 0 ], parent_class ) else : # flatten list of dicts if any objects in the list are dicts if any ( isinstance ( obj , dict ) for obj in json_obj ): return flatten_json_dict_list ( json_obj , parent_class ) return [ unpack_data ( obj , parent_class ) for obj in json_obj if ( obj == 0 or obj )] # handle dictionaries elif isinstance ( json_obj , dict ): # eliminate odd single-key Yahoo dicts with key = \"0\" and value = if \"0\" in json_obj . keys () and \"1\" not in json_obj . keys (): if len ( json_obj . keys ()) == 1 : return unpack_data ( json_obj . get ( \"0\" ), parent_class ) else : if isinstance ( json_obj . get ( \"0\" ), dict ): json_obj . update ( json_obj . pop ( \"0\" )) # eliminate data obj counts (except in player_position dicts, which have position counts in league settings) if \"count\" in json_obj . keys () and \"position\" in json_obj . keys (): # assign/cast data type where applicable # TODO: figure out how to do this without explicit object type keys return get_type ( { k : unpack_data ( v , parent_class ) for k , v in json_obj . items ()}, parent_class , subclasses ) else : # assign/cast data type where applicable # TODO: figure out how to do this without explicit object type keys json_obj = get_type ( { k : unpack_data ( v , parent_class ) for k , v in json_obj . items () if k != \"count\" }, parent_class , subclasses ) # flatten dicts with keys \"0\", \"1\",..., \"n\" to a list of objects if \"0\" in json_obj . keys () and \"1\" in json_obj . keys (): json_obj = flatten_to_list ( json_obj ) # TODO: figure out how to do this without breaking the above unpacking using explicit type keys # else: # # flatten dicts with redundant keys to a list of objects # if len(json_obj.keys()) == 1 and len(json_obj.values()) == 1: # key = list(json_obj.keys())[0] # value = list(json_obj.values())[0] # json_obj = value return json_obj else : return convert_strings_to_numeric_equivalents ( json_obj )","title":"unpack_data"},{"location":"utils/#yfpy.utils.convert_strings_to_numeric_equivalents","text":"convert_strings_to_numeric_equivalents ( json_obj ) Convert JSON strings with integer or float numeric representations to their respective integer or float values. Parameters: json_obj ( Any ) \u2013 JSON object (typically a dictionary or list, but can also be a primitive). Returns: Union [ int , float , Any ] \u2013 int | float | Any: The numeric representation of any JSON strings that can be represented as integers or floats, Union [ int , float , Any ] \u2013 else the original JSON object. Source code in yfpy/utils.py 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 def convert_strings_to_numeric_equivalents ( json_obj : Any ) -> Union [ int , float , Any ]: \"\"\"Convert JSON strings with integer or float numeric representations to their respective integer or float values. Args: json_obj (Any): JSON object (typically a dictionary or list, but can also be a primitive). Returns: int | float | Any: The numeric representation of any JSON strings that can be represented as integers or floats, else the original JSON object. \"\"\" if isinstance ( json_obj , str ): if len ( json_obj ) > 1 and str . startswith ( json_obj , \"0\" ): return json_obj else : if str . isdigit ( json_obj ): return int ( json_obj ) elif str . isdigit ( re . sub ( \"[-]\" , \"\" , re . sub ( \"[.]\" , \"\" , json_obj , count = 1 ), count = 1 )): return float ( json_obj ) else : return json_obj else : return json_obj","title":"convert_strings_to_numeric_equivalents"},{"location":"utils/#yfpy.utils.get_type","text":"get_type ( json_obj_dict , parent_class , subclasses ) Cast JSON object to custom subclass type extracted from parent class. Parameters: json_obj_dict ( dict of str ) \u2013 Any): JSON dictionary with strings of data type as keys and JSON objects as values. parent_class ( Type ) \u2013 Parent class from which to derive subclasses for casting. subclasses ( dict of str ) \u2013 Type): Dictionary of subclasses with strings that match the json dict keys as keys and classes for casting as values. Returns: object ( Dict [ str , Any ] ) \u2013 A Python object (representing the original JSON object) that has been cast to the specified type. Source code in yfpy/utils.py 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 def get_type ( json_obj_dict : Dict [ str , Any ], parent_class : Type , subclasses : Dict [ str , Type ]) -> Dict [ str , Any ]: \"\"\"Cast JSON object to custom subclass type extracted from parent class. Args: json_obj_dict (dict of str: Any): JSON dictionary with strings of data type as keys and JSON objects as values. parent_class (Type): Parent class from which to derive subclasses for casting. subclasses (dict of str: Type): Dictionary of subclasses with strings that match the json dict keys as keys and classes for casting as values. Returns: object: A Python object (representing the original JSON object) that has been cast to the specified type. \"\"\" for k , v in json_obj_dict . items (): # check if key is in the provided subclasses' dict, that the object isn't already cast if k in subclasses . keys () and isinstance ( v , dict ) and not isinstance ( v , subclasses . get ( k )): json_obj_dict [ k ] = subclasses [ k ]( unpack_data ( v , parent_class )) return json_obj_dict","title":"get_type"},{"location":"utils/#yfpy.utils.flatten_json_dict_list","text":"flatten_json_dict_list ( json_obj_dict_list , parent_class ) Recursive function to flatten JSON lists containing all disparate JSON dictionaries with no overlapping keys. Parameters: json_obj_dict_list ( list [ dict [ str , Any ]] ) \u2013 List of JSON dictionaries. parent_class ( Type ) \u2013 Parent class type used to extract custom subclass type options. Returns: Any \u2013 dict | list: Returns a dictionary if the list was flattened, else a cleaned list if no flattening was needed. Source code in yfpy/utils.py 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 def flatten_json_dict_list ( json_obj_dict_list : List [ Dict [ str , Any ]], parent_class : Type ) -> Any : \"\"\"Recursive function to flatten JSON lists containing all disparate JSON dictionaries with no overlapping keys. Args: json_obj_dict_list (list[dict[str, Any]]): List of JSON dictionaries. parent_class (Type): Parent class type used to extract custom subclass type options. Returns: dict | list: Returns a dictionary if the list was flattened, else a cleaned list if no flattening was needed. \"\"\" # filter out empty lists and dicts but include when value = 0 json_obj_dict_list = [ obj for obj in json_obj_dict_list if ( obj == 0 or obj )] item_keys = [] ndx = 0 for item in json_obj_dict_list : if isinstance ( item , list ): flattened_item = flatten_json_dict_list ( item , parent_class ) json_obj_dict_list [ ndx ] = flattened_item item_keys . extend ( list ( flattened_item . keys ())) else : item_keys . extend ( list ( item . keys ())) ndx += 1 if len ( item_keys ) == len ( set ( item_keys )): agg_dict = {} for dict_item in json_obj_dict_list : agg_dict . update ( dict_item ) return unpack_data ( agg_dict , parent_class ) else : return [ unpack_data ( obj , parent_class ) for obj in json_obj_dict_list if ( obj == 0 or obj )]","title":"flatten_json_dict_list"},{"location":"utils/#yfpy.utils.flatten_to_list","text":"flatten_to_list ( json_obj ) Function to flatten JSON dictionaries with unnecessary keys to a list of objects. Parameters: json_obj ( Any ) \u2013 JSON object (typically a dictionary or list, but can also be a primitive). Returns: list ( Any ) \u2013 A list made from a flattened dictionary if json_obj was a dictionary, the original list if json_obj was a Any \u2013 list, or the original value if json_obj was a primitive. Source code in yfpy/utils.py 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 def flatten_to_list ( json_obj : Any ) -> Any : \"\"\"Function to flatten JSON dictionaries with unnecessary keys to a list of objects. Args: json_obj (Any): JSON object (typically a dictionary or list, but can also be a primitive). Returns: list: A list made from a flattened dictionary if json_obj was a dictionary, the original list if json_obj was a list, or the original value if json_obj was a primitive. \"\"\" if isinstance ( json_obj , dict ): out = [] for k , v in json_obj . items (): out . append ( v ) return out else : return json_obj","title":"flatten_to_list"},{"location":"utils/#yfpy.utils.flatten_to_objects","text":"flatten_to_objects ( json_obj ) Function to flatten a JSON dictionary (or a JSON dictionary in a list) to a dictionary of cast objects. Parameters: json_obj ( Any ) \u2013 JSON object (typically a dictionary or list, but can also be a primitive). Returns: Any \u2013 dict | list | int | float | str | bool: JSON dictionary/list/primitive with contents cast to Python objects. Source code in yfpy/utils.py 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 def flatten_to_objects ( json_obj : Any ) -> Any : \"\"\"Function to flatten a JSON dictionary (or a JSON dictionary in a list) to a dictionary of cast objects. Args: json_obj (Any): JSON object (typically a dictionary or list, but can also be a primitive). Returns: dict | list | int | float | str | bool: JSON dictionary/list/primitive with contents cast to Python objects. \"\"\" if isinstance ( json_obj , dict ): return dict_to_list ( json_obj ) elif isinstance ( json_obj , list ): if isinstance ( json_obj [ 0 ], dict ): return dict_to_list ( json_obj [ 0 ]) else : return json_obj","title":"flatten_to_objects"},{"location":"utils/#yfpy.utils.dict_to_list","text":"dict_to_list ( json_dict ) Function to convert a JSON dictionary to a list. Parameters: json_dict ( dict [ str , Any ] ) \u2013 JSON dictionary. Returns: list ( Any ) \u2013 A list derived from a JSON dictionary, or the original dictionary if it does not contain dictionaries as Any \u2013 values. Source code in yfpy/utils.py 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 def dict_to_list ( json_dict : Dict [ str , Any ]) -> Any : \"\"\"Function to convert a JSON dictionary to a list. Args: json_dict (dict[str, Any]): JSON dictionary. Returns: list: A list derived from a JSON dictionary, or the original dictionary if it does not contain dictionaries as values. \"\"\" first_key = list ( json_dict . keys ())[ 0 ] if isinstance ( json_dict . get ( first_key ), dict ): first_val_key = list ( json_dict . get ( first_key ) . keys ())[ 0 ] if first_key [: - 1 ] == first_val_key : out = [] for k , v in json_dict . items (): out . append ( v . get ( first_val_key )) return out return json_dict","title":"dict_to_list"},{"location":"utils/#yfpy.utils.reorganize_json_dict","text":"reorganize_json_dict ( json_dict , obj_key , val_to_key ) Function to reorganize a JSON dictionary of dictionaries. The reorganized JSON dictionary is an ordered dictionary sorted by a specific attribute of the value dictionaries. Parameters: json_dict ( dict of str ) \u2013 Any): JSON dictionary. obj_key ( str ) \u2013 Key to access the dictionaries contained in json_dict. val_to_key ( str ) \u2013 Key used to sort the dictionaries contained in json_dict. Returns: Dict [ str , Any ] \u2013 dict[str, Any]: An ordered dictionary of dictionaries sorted by val_to_key. Source code in yfpy/utils.py 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 def reorganize_json_dict ( json_dict : Dict [ str , Any ], obj_key : str , val_to_key : str ) -> Dict [ str , Any ]: \"\"\"Function to reorganize a JSON dictionary of dictionaries. The reorganized JSON dictionary is an ordered dictionary sorted by a specific attribute of the value dictionaries. Args: json_dict (dict of str: Any): JSON dictionary. obj_key (str): Key to access the dictionaries contained in json_dict. val_to_key (str): Key used to sort the dictionaries contained in json_dict. Returns: dict[str, Any]: An ordered dictionary of dictionaries sorted by val_to_key. \"\"\" out = {} for k , v in json_dict . items (): out [ str ( getattr ( v . get ( obj_key ), val_to_key ))] = v . get ( obj_key ) return OrderedDict ( ( str ( k ), out [ str ( k )]) for k in sorted ( [ int ( k_v ) if isinstance ( k_v , int ) else k_v for k_v in out . keys ()]))","title":"reorganize_json_dict"},{"location":"utils/#yfpy.utils.reformat_json_list","text":"reformat_json_list ( json_obj ) Function to clean and reformat JSON lists to eliminate empty values and unnecessarily nested lists. Parameters: json_obj ( Any ) \u2013 JSON object (typically a dictionary or list, but can also be a primitive) to be cleaned. Returns: Any ( Any ) \u2013 Reformatted JSON list derived from original JSON object. Source code in yfpy/utils.py 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 def reformat_json_list ( json_obj : Any ) -> Any : \"\"\"Function to clean and reformat JSON lists to eliminate empty values and unnecessarily nested lists. Args: json_obj (Any): JSON object (typically a dictionary or list, but can also be a primitive) to be cleaned. Returns: Any: Reformatted JSON list derived from original JSON object. \"\"\" if isinstance ( json_obj [ 0 ], list ): if len ( json_obj ) > 1 : return reformat_json_list ( [ reformat_json_list ( item ) if isinstance ( item , list ) else item for item in json_obj ]) else : return reformat_json_list ( json_obj [ 0 ]) else : # create chain map that filters out empty lists/dicts but leaves objects where value = 0 return ChainMap ( * [ value for value in json_obj if ( value == 0 or value )])","title":"reformat_json_list"}]} \ No newline at end of file diff --git a/quickstart/quickstart.py b/quickstart/quickstart.py index 5412b866..30f8a7ef 100644 --- a/quickstart/quickstart.py +++ b/quickstart/quickstart.py @@ -271,18 +271,15 @@ def get_league_player_limit(): query = YahooFantasySportsQuery( test_league_id, test_game_code, - test_game_id, + game_id=test_game_id, yahoo_consumer_key=os.environ.get("YAHOO_CONSUMER_KEY"), yahoo_consumer_secret=os.environ.get("YAHOO_CONSUMER_SECRET"), # yahoo_access_token_json=os.environ.get("YAHOO_ACCESS_TOKEN_JSON"), - env_var_fallback=True, - env_file_location=Path(__file__).parent.parent, - save_token_data_to_env_file=True, - all_output_as_json_str=False, - offline=False + env_file_location=project_dir, + save_token_data_to_env_file=True ) -# query.save_access_token_data_to_env_file(project_dir, save_json_to_var=True) +# query.save_access_token_data_to_env_file(project_dir, save_json_to_var_only=True) # Manually override league key for example code to work query.league_key = f"{test_game_id}.l.{test_league_id}" diff --git a/yfpy/query.py b/yfpy/query.py index 4b4d3d5c..15a4b533 100644 --- a/yfpy/query.py +++ b/yfpy/query.py @@ -371,23 +371,25 @@ def _retrieve_env_file_contents(env_file_path: Path) -> Dict[str, str]: return env_file_content - def save_access_token_data_to_env_file(self, env_file_directory: Path, env_file_name: str = ".env", - save_json_to_var: bool = False) -> None: + def save_access_token_data_to_env_file(self, env_file_location: Path, env_file_name: str = ".env", + save_json_to_var_only: bool = False) -> None: """Saves the fields and values of a Yahoo access token into a .env file. Args: - env_file_directory (Path): The path to the directory where the target .env file is/will be located. + env_file_location (:obj:`Path`, optional): Path to directory where existing .env file is located or new .env + file should be generated. env_file_name (:obj:`str`, optional): The name of the target .env file (defaults to ".env"). - save_json_to_var (:obj:`bool`, optional): Boolean to determine whether or not to write a JSON string of + save_json_to_var_only (:obj:`bool`, optional): Boolean to determine whether or not to write a JSON string of Yahoo access token fields to a YAHOO_ACCESS_TOKEN_JSON environment variable in the target .env file + instead of writing Yahoo access token fields to separate environment variables in the target .env file. (defaults to False). Returns: None """ - if env_file_directory: - env_file_path = env_file_directory / env_file_name + if env_file_location: + env_file_path = env_file_location / env_file_name else: logger.warning("Missing argument env_file_location. Yahoo access token will NOT be saved to .env file.") # exit method without saving Yahoo access token data when no env_file_location argument is provided @@ -395,14 +397,16 @@ def save_access_token_data_to_env_file(self, env_file_directory: Path, env_file_ env_file_content = self._retrieve_env_file_contents(env_file_path) - # replace values of any matching environment variables in .env file with values from Yahoo access token fields - for k, v in self._yahoo_access_token_dict.items(): - env_file_content[f"yahoo_{k}"] = v - - # generate a JSON string with escaped double quotes using nested json.dumps() and write it to a - # YAHOO_ACCESS_TOKEN_JSON environment variable if save_json_to_var is set to True - if save_json_to_var: + if save_json_to_var_only: + # generate a JSON string with escaped double quotes using nested json.dumps() and write it to a + # YAHOO_ACCESS_TOKEN_JSON environment variable if save_json_to_var_only is set to True instead of writing + # Yahoo access token fields to separate environment variables in target .env file env_file_content["yahoo_access_token_json"] = json.dumps(json.dumps(self._yahoo_access_token_dict)) + else: + # replace values of any matching environment variables in .env file with values from Yahoo access token + # fields or add new environment variables to .env file if any fields are missing + for k, v in self._yahoo_access_token_dict.items(): + env_file_content[f"yahoo_{k}"] = v # write contents to .env file (overwrites contents if file exists or creates a new file if not) with open(env_file_path, "w") as env_file: