Skip to content

League Class

Christian Wendt edited this page Oct 17, 2019 · 18 revisions

Documentation of all Variables and usable functions for League Class

League

The League Object is used for getting all of your ESPN Fantasy data including settings, teams, roster, players, free agents, box scores/match ups, and power rankings.

Usage

Set debug parameter to True if you want to see all of the ESPN API requests and responses print to the console

from ff_espn_api import League
league = League(league_id: int, year: int, espn_s2: str = None, swid: str = None, username: str = None, password: str = None, debug=False)

Links

Team Class, Pick Class, Settings Class

Variables

league_id: int
year: int
settings: Settings
teams: List[Team]
draft: List[Pick]
current_week: int # current fantasy football week
nfl_week: int # current nfl week

Functions

Returns basic information on a match up for a current week. This can be used for previous years
Check out Matchup Class!

def scoreboard(week: int = None) -> List[Matchup]

Returns more specific information on week match ups and can only be used with current season
Check out Box Score Class!

def box_scores(week: int = None) -> List[BoxScore]

Calculates week power rankings using two step dominance. Returns a list of tuples with first position being score and second the Team Class

def power_rankings(week: int=None) -> List[Tuples(str, Team)]

Returns a list of free agents
position inputs: 'QB', 'RB', 'WR', 'TE', 'D/ST', 'K', 'FLEX'
Check out Box Player Class!

def free_agents(week: int = None, size: int = 50, position: str = None) -> List[BoxPlayer]:

Helper functions

def standings() -> List[Team]:
def top_scorer() -> Team:
def least_scorer() -> Team:
def most_points_against() -> Team:
def top_scored_week() -> Tuple(Team, int):
def least_scored_week() -> Tuple(Team, int):
def get_team_data(team_id: int) -> Team: