Open brownmp opened 1 year ago
Have you checked out the player_info
call, that will fill out the players stats field for the whole year. Defined in the docs here.
If you want the raw json data you can do something like this
# initialize your league
import json
# get playerId
# for example I am going to use CMC
playerId = league.teams[0].roster[0].playerId
year = 2022
params = { 'view': 'kona_playercard' }
filters = {'players':{'filterIds':{'value': [playerId]}, 'filterStatsForTopScoringPeriodIds':{'value':17, "additionalValue":["00{}".format(year), "10{}".format(year)]}}}
headers = {'x-fantasy-filter': json.dumps(filters)}
league.espn_request.league_get(params=params, headers=headers)
Sport
Football
Summary
It would be great to provide more statistics for individual players. It's possible to look up players by their player id, then parse the json output that holds the statistics. The stats can be very general like number of receptions, targets, and more.
~brownmp