understatapi.endpoints.league module

League endpoint

class understatapi.endpoints.league.LeagueEndpoint(league, session)[source]

Bases: understatapi.endpoints.base.BaseEndpoint

Endpoint for league data. Use this class to get data from a url of the form https://understat.com/league/<league>/<season>

Example

>>> session = requests.Session()
>>> leagues = ["EPL", "Bundesliga"]
>>> for league in LeagueEndpoint(leagues, session=session):
...     print(league.league)
EPL
Bundesliga
parser: understatapi.parsers.base.BaseParser = <understatapi.parsers.league.LeagueParser object>
__init__(league, session)[source]
Parameters
  • league (Union[List[str], str]) – Name of the league(s) to get data for, one of {EPL, La_Liga, Bundesliga, Serie_A, Ligue_1, RFPL}

  • session (Session) – The current session

property league

league name

Return type

Union[List[str], str]

_get_data(season, **kwargs)[source]

Get data on a league-wide basis

Parameters
Return type

Response

get_team_data(season, **kwargs)[source]

Get data for all teams in a given league and season

Parameters
  • season (str) – Season to get data for

  • kwargs (str) – Keyword argument to pass to understatapi.endpoints.base.BaseEndpoint._get_response()

Return type

Dict[str, Any]

get_match_data(season, **kwargs)[source]

Get data for all fixtures in a given league and season.

Parameters
  • season (str) – Season to get data for

  • kwargs (str) – Keyword argument to pass to understatapi.endpoints.base.BaseEndpoint._get_response()

Return type

Dict[str, Any]

get_player_data(season, **kwargs)[source]

Get data for all players in a given league and season

Parameters
  • season (str) – Season to get data for

  • kwargs (str) – Keyword argument to pass to understatapi.endpoints.base.BaseEndpoint._get_response()

Return type

Dict[str, Any]