uberfastman / yfpy

Python API wrapper for the Yahoo Fantasy Sports public API (supports NFL, NHL, MLB, and NBA).
https://pypi.org/project/yfpy/
GNU General Public License v3.0
163 stars 44 forks source link

Support for retrieving complete player stats #40

Closed dingyiyi0226 closed 10 months ago

dingyiyi0226 commented 10 months ago

The method get_player_stats_by_date currently utilizes the URL {base_url}/league/{league_key}/players;. However, according to the official Yahoo Fantasy Sports API documentation, there's an alternative URL {base_url}/players; available.

The key distinction between the two is that the player stats fetched from the league resource only encompass limited categories defined in league metadata, while the alternative URL provides comprehensive statistics for the players.

Kindly consider adding support to use the latter URL to obtain a more detailed data.

uberfastman commented 10 months ago

Thanks so much for recommending this @dingyiyi0226, I don't think I ever realized that retrieving the players collection in a league context limited the stats to those applicable to that league, so this a great suggestion!

I've gone ahead and released YFPY v11.0.0, which includes the limit_to_league_stats parameter for yahoo_query.get_player_stats_for_season, yahoo_query.get_player_stats_by_week, and yahoo_query.get_player_stats_by_date. If you set that parameter to False, you can retrieve the player collection at the game level and ignore the league context, which from my testing appears to retrieve the additional statistics you wanted to pull.

Please let me know if you have any issues using the new functionality as desired!