cwendt94 / espn-api

ESPN Fantasy API! (Football, Basketball)
MIT License
544 stars 183 forks source link

Adding Team and Player Level Methods #420

Open jakebruemmer opened 1 year ago

jakebruemmer commented 1 year ago

Sport

Football

Summary

First of all, thank you for putting together this API wrapper/library. It's something I wish ESPN would just have a fully fledged product for already.

I used this library to put together a summary for one of the fantasy football leagues that I commission, and I think there's a few features that would add a lot of useful functionality to this library.

Right now, it seems like everything flows through the League class. It contains teams, schedules, box scores, and pretty much every other class. That works fine for getting data for teams during a season, but it's a little bit clunky I think. Instead, it would be good if there were methods on the Team and Player (either Player or BoxPlayer) classes that would let you do things like:

This is how I typically think of doing fantasy analysis - by the team and/or player level and working up, instead of getting league information and working down.

jakebruemmer commented 1 year ago

Looking at the classes a little more, I think the way this would need to be done would be to have the League data flow into the Team and Player classes, right? Most of what I'm talking about is contained in a BoxScore as the Matchup class has meta info (like points scored and who won) but no detailed info for a gameweek.

Unless there's an ESPN API that you can call specifically for a BoxScore or a Team, then it might be kind of complicated to do this.

cwendt94 commented 1 year ago

It seems like you are looking for the league.box_scores functionality. Check out the docs here but you can basically get boxscores for each week which contains the teams, their roster, player stats and the out come of that week/matchup.

In the league class Teams and Player represent the current state and the box score functionality allows you to get all the information you need for each week.

Is this what you are looking for?