-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include Total Points in player_stats return (#52)
I have updated the player_stats command to leverage the League resource from the Yahoo API instead of the Player resource. This allows us to return the total points and all the stats details. There are a few other benefits IMO: - Makes the library more predictable as the league class is now using the league resource instead of an edge case where it uses the player resource - We are only gaining data here the league /stats endpoint returns the same values as the players /stats endpoint - Allows us to simplify the mock for player_stats --------- Co-authored-by: DMcP89 <[email protected]>
- Loading branch information
Showing
11 changed files
with
283 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,4 @@ docs/_build | |
.vscode/ | ||
.envrc | ||
build/ | ||
.python-version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
249 changes: 249 additions & 0 deletions
249
yahoo_fantasy_api/tests/sample.player_stats.449.l.75178.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,249 @@ | ||
{ | ||
"fantasy_content": { | ||
"xml:lang": "en-US", | ||
"yahoo:uri": "\/fantasy\/v2\/league\/449.l.751781\/players;player_keys=449.p.7200\/stats;type=week;week=1", | ||
"league": [ | ||
{ | ||
"league_key": "449.l.751781", | ||
"league_id": "751781", | ||
"name": "Harambe Memorial League", | ||
"url": "https:\/\/football.fantasysports.yahoo.com\/f1\/751781", | ||
"logo_url": false, | ||
"draft_status": "postdraft", | ||
"num_teams": 12, | ||
"edit_key": "2", | ||
"weekly_deadline": "", | ||
"league_update_timestamp": "1726123385", | ||
"scoring_type": "head", | ||
"league_type": "private", | ||
"renew": "423_71785", | ||
"renewed": "", | ||
"felo_tier": "silver", | ||
"iris_group_chat_id": "", | ||
"allow_add_to_dl_extra_pos": 0, | ||
"is_pro_league": "0", | ||
"is_cash_league": "0", | ||
"current_week": 2, | ||
"start_week": "1", | ||
"start_date": "2024-09-05", | ||
"end_week": "17", | ||
"end_date": "2024-12-30", | ||
"is_plus_league": "0", | ||
"game_code": "nfl", | ||
"season": "2024" | ||
}, | ||
{ | ||
"players": { | ||
"0": { | ||
"player": [ | ||
[ | ||
{ | ||
"player_key": "449.p.7200" | ||
}, | ||
{ | ||
"player_id": "7200" | ||
}, | ||
{ | ||
"name": { | ||
"full": "Aaron Rodgers", | ||
"first": "Aaron", | ||
"last": "Rodgers", | ||
"ascii_first": "Aaron", | ||
"ascii_last": "Rodgers" | ||
} | ||
}, | ||
{ | ||
"url": "https:\/\/sports.yahoo.com\/nfl\/players\/7200" | ||
}, | ||
{ | ||
"editorial_player_key": "nfl.p.7200" | ||
}, | ||
{ | ||
"editorial_team_key": "nfl.t.20" | ||
}, | ||
{ | ||
"editorial_team_full_name": "New York Jets" | ||
}, | ||
{ | ||
"editorial_team_abbr": "NYJ" | ||
}, | ||
{ | ||
"editorial_team_url": "https:\/\/sports.yahoo.com\/nfl\/teams\/ny-jets\/" | ||
}, | ||
{ | ||
"bye_weeks": { | ||
"week": "12" | ||
} | ||
}, | ||
{ | ||
"is_keeper": { | ||
"status": false, | ||
"cost": false, | ||
"kept": false | ||
} | ||
}, | ||
{ | ||
"uniform_number": "8" | ||
}, | ||
{ | ||
"display_position": "QB" | ||
}, | ||
{ | ||
"headshot": { | ||
"url": "https:\/\/s.yimg.com\/iu\/api\/res\/1.2\/8MiUmLsQnH2U8RAK8U0goA--~C\/YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2\/https:\/\/s.yimg.com\/xe\/i\/us\/sp\/v\/nfl_cutout\/players_l\/09092024\/7200.png", | ||
"size": "small" | ||
}, | ||
"image_url": "https:\/\/s.yimg.com\/iu\/api\/res\/1.2\/8MiUmLsQnH2U8RAK8U0goA--~C\/YXBwaWQ9eXNwb3J0cztjaD0yMzM2O2NyPTE7Y3c9MTc5MDtkeD04NTc7ZHk9MDtmaT11bGNyb3A7aD02MDtxPTEwMDt3PTQ2\/https:\/\/s.yimg.com\/xe\/i\/us\/sp\/v\/nfl_cutout\/players_l\/09092024\/7200.png" | ||
}, | ||
{ | ||
"is_undroppable": "0" | ||
}, | ||
{ | ||
"position_type": "O" | ||
}, | ||
{ | ||
"primary_position": "QB" | ||
}, | ||
{ | ||
"eligible_positions": [ | ||
{ | ||
"position": "QB" | ||
} | ||
] | ||
}, | ||
{ | ||
"eligible_positions_to_add": [] | ||
}, | ||
[], | ||
{ | ||
"has_player_notes": 1 | ||
}, | ||
[], | ||
{ | ||
"player_notes_last_timestamp": 1725939762 | ||
} | ||
], | ||
{ | ||
"player_stats": { | ||
"0": { | ||
"coverage_type": "week", | ||
"week": "1" | ||
}, | ||
"stats": [ | ||
{ | ||
"stat": { | ||
"stat_id": "4", | ||
"value": "167" | ||
} | ||
}, | ||
{ | ||
"stat": { | ||
"stat_id": "5", | ||
"value": "1" | ||
} | ||
}, | ||
{ | ||
"stat": { | ||
"stat_id": "6", | ||
"value": "1" | ||
} | ||
}, | ||
{ | ||
"stat": { | ||
"stat_id": "8", | ||
"value": "1" | ||
} | ||
}, | ||
{ | ||
"stat": { | ||
"stat_id": "9", | ||
"value": "-1" | ||
} | ||
}, | ||
{ | ||
"stat": { | ||
"stat_id": "10", | ||
"value": "0" | ||
} | ||
}, | ||
{ | ||
"stat": { | ||
"stat_id": "11", | ||
"value": "0" | ||
} | ||
}, | ||
{ | ||
"stat": { | ||
"stat_id": "12", | ||
"value": "0" | ||
} | ||
}, | ||
{ | ||
"stat": { | ||
"stat_id": "13", | ||
"value": "0" | ||
} | ||
}, | ||
{ | ||
"stat": { | ||
"stat_id": "15", | ||
"value": "0" | ||
} | ||
}, | ||
{ | ||
"stat": { | ||
"stat_id": "16", | ||
"value": "0" | ||
} | ||
}, | ||
{ | ||
"stat": { | ||
"stat_id": "17", | ||
"value": "0" | ||
} | ||
}, | ||
{ | ||
"stat": { | ||
"stat_id": "18", | ||
"value": "0" | ||
} | ||
}, | ||
{ | ||
"stat": { | ||
"stat_id": "58", | ||
"value": "0" | ||
} | ||
}, | ||
{ | ||
"stat": { | ||
"stat_id": "78", | ||
"value": "0" | ||
} | ||
}, | ||
{ | ||
"stat": { | ||
"stat_id": "57", | ||
"value": "0" | ||
} | ||
} | ||
] | ||
}, | ||
"player_points": { | ||
"0": { | ||
"coverage_type": "week", | ||
"week": "1" | ||
}, | ||
"total": "8.58" | ||
} | ||
} | ||
] | ||
}, | ||
"count": 1 | ||
} | ||
} | ||
], | ||
"time": "22.672176361084ms", | ||
"copyright": "Certain Data by Sportradar, Stats Perform and Rotowire", | ||
"refresh_rate": "60" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.