understatapi.endpoints.league module¶
League endpoint
-
class
understatapi.endpoints.league.LeagueEndpoint(league, session)[source]¶ Bases:
understatapi.endpoints.base.BaseEndpointEndpoint 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
season (
str) – Season to get data forkwargs (
str) – Keyword argument to pass tounderstatapi.endpoints.base.BaseEndpoint._request_url()
- 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 forkwargs (
str) – Keyword argument to pass tounderstatapi.endpoints.base.BaseEndpoint._get_response()
- Return type
Dict[str,Any]