footballdata package¶
Submodules¶
footballdata.connector module¶
footballdata.connector¶
This module contains utilities to connect to API.
| copyright: |
|
|---|---|
| license: | BSD 3-Clause |
-
class
footballdata.connector.Connector(api_key='', api_version='v1')¶ Bases:
objectClass to initialise connection to football-data.org
-
api_key¶ Returns API key given at the time of initiating the object
Returns: str - API key
-
api_version¶ Returns API version given at the time of initiating the object
Returns: str - API version
-
get_competitions(season='', force_update=False)¶ Fetches all competitions
Parameters: - force_update – Boolean, overrides cached results if True
- season – 4 digit integer representing a season, optional
Returns: DataSet of Competition objects
-
get_fixtures(force_update=False)¶ Fetches all fixtures
Parameters: force_update – Boolean, overrides cached results if True Returns: DataSet of Fixture objects
-
classmethod
supported_api_versions()¶ Returns the supported api versions as list
-
footballdata.datasets module¶
footballdata.datasets¶
This module implements the data structures used to represent the data returned from the API.
| copyright: |
|
|---|---|
| license: | BSD 3-Clause |
-
class
footballdata.datasets.Competition(**kwargs)¶ Bases:
footballdata.datasets.FootballDataObjectClass to represent a competition
-
get_fixtures(force_update=False)¶ Fetches all fixtures in a competition
Parameters: force_update – Boolean, overrides cached results if True Returns: DataSet of Fixture objects
-
get_league_table(force_update=False)¶ Fetches standing of all teams in competition
Parameters: force_update – Boolean, overrides cached results if True Returns: DataSet of Standing objects
-
get_teams(force_update=False)¶ Fetches all teams in a competition
Parameters: force_update – Boolean, overrides cached results if True Returns: DataSet of Team objects
-
-
class
footballdata.datasets.DataSet(klass, endpoint='', api_key='', options=None, data_list=None)¶ Bases:
objectClass to represent a sequence of football data objects
-
class
footballdata.datasets.Fixture(**kwargs)¶ Bases:
footballdata.datasets.FootballDataObjectClass to represent a fixture
-
class
footballdata.datasets.FootballDataObject(**kwargs)¶ Bases:
objectParent class for all football data components
-
class
footballdata.datasets.Player(**kwargs)¶ Bases:
footballdata.datasets.FootballDataObjectClass to represent a player
-
class
footballdata.datasets.Standing(**kwargs)¶ Bases:
footballdata.datasets.FootballDataObjectClass to represent a team’s standing in a competition
-
class
footballdata.datasets.Team(**kwargs)¶ Bases:
footballdata.datasets.FootballDataObjectClass to represent a team
-
get_fixtures(force_update=False)¶ Fetches all fixtures for a team
Parameters: force_update – Boolean, overrides cached results if True Returns: DataSet of Fixture objects
-
get_players(force_update=False)¶ Fetches all players in a team
Parameters: force_update – Boolean, overrides cached results if True Returns: DataSet of Player objects
-
footballdata.utils module¶
footballdata.utils¶
Implements various helpers.
| copyright: |
|
|---|---|
| license: | BSD 3-Clause |
-
footballdata.utils.camel_to_snake(name)¶ Takes a string in camel case and converts it to snake case
Parameters: name – String to convert to snake case Returns: String in snake case
-
footballdata.utils.clean_object(data)¶ Takes data from api and build data dictionary with proper keys
Parameters: data – Dict data from api Returns: Dict with proper keys and meta data removed
-
footballdata.utils.fetch_data_from_api(endpoint, api_key='', options=None)¶ Fetches data from the endpoint and returns it
Parameters: - endpoint – api endpoint to connect
- api_key – optional api key
- options – data to sent with api call
Returns: