understatapi.endpoints.team module¶
Team endpoint
- class understatapi.endpoints.team.TeamEndpoint(team, session)[source]¶
Bases:
BaseEndpointUse this class to get data from a url of the form
https://understat.com/team/<team>/<season>- Example
>>> session = requests.Session() >>> team_names = ["Manchester_United", "Liverpool"] >>> for team in TeamEndpoint(team_names, session=session): ... print(team.team) Manchester_United Liverpool
- parser: BaseParser = <understatapi.parsers.team.TeamParser object>¶
- __init__(team, session)[source]¶
- Parameters
team (
Union[List[str],str]) – Name of the team(s) to get data forsession (
Session) – The current session
- property team: Union[List[str], str]¶
team name
- Return type
Union[List[str],str]
- _get_data(season, **kwargs)[source]¶
Get data on a per-team basis via AJAX endpoint.
- Parameters
season (
str) – Season to get data forkwargs (
Any) – Keyword argument to pass tounderstatapi.endpoints.base.BaseEndpoint._request_ajax()
- Return type
Dict[str,Any]- Returns
Dictionary with keys: dates, players, statistics
- get_player_data(season, **kwargs)[source]¶
Get data for all players on a given team in a given season
- Parameters
season (
str) – Season to get data forkwargs (
Any) – Keyword argument to pass tounderstatapi.endpoints.base.BaseEndpoint._request_ajax()
- Return type
List[Dict[str,Any]]
- get_match_data(season, **kwargs)[source]¶
Get data on a per match level for a given team in a given season
- Parameters
season (
str) – Season to get data forkwargs (
Any) – Keyword argument to pass tounderstatapi.endpoints.base.BaseEndpoint._request_ajax()
- Return type
List[Dict[str,Any]]
- get_context_data(season, **kwargs)[source]¶
Get data based on different contexts in the game
- Parameters
season (
str) – Season to get data forkwargs (
Any) – Keyword argument to pass tounderstatapi.endpoints.base.BaseEndpoint._request_ajax()
- Return type
Dict[str,Any]