def get_league_table(self): """Return the league table for this competition. Sends one request to api.football-data.org. :returns: LeagueTable: A LeagueTable object. """ r = requests.get(self._league_table_ep, headers=globals.headers) globals.update_prev_response(r, self._league_table_ep) r.raise_for_status() return LeagueTable(r.json())
def get_fixtures(self): """Return a list of Fixture objects representing the fixtures in this competition for the current season. Sends one request to api.football-data.org. :returns: fixture_list: A list of Fixture objects. """ r = requests.get(self._fixtures_ep, headers=globals.headers) globals.update_prev_response(r, self._fixtures_ep) r.raise_for_status() data = r.json() fixture_list = [] for fixture in data['fixtures']: fixture_list.append(Fixture(fixture)) return fixture_list
def get_teams(self): """Return a list of Team objects representing the teams in this competition for the current season. Sends one request to api.football-data.org. :returns: team_list: A list of Team objects. """ r = requests.get(self._teams_ep, headers=globals.headers) globals.update_prev_response(r, self._teams_ep) r.raise_for_status() data = r.json() team_list = [] for tm in data['teams']: team_list.append(Team(tm)) return team_list
def get_players(self): """Return a list of Player objects representing players on the current team. Sends one request to api.football-data.org. :returns: player_list: A list of Player objects. """ r = requests.get(self._players_ep, headers=globals.headers) globals.update_prev_response(r, self._players_ep) r.raise_for_status() data = r.json() player_list = [] for player in data['players']: player_list.append(Player(player)) return player_list