amosbastian / football

A Python wrapper around the football-data API.
GNU Affero General Public License v3.0
7 stars 3 forks source link

football

PyPI PyPI - Python Version

A Python wrapper around the football-data API.

Installing

The recommended way to install football is with pip

pip install football

You can also use pip to install football directly from GitHub

pip install git+https://github.com/amosbastian/football.git

or you can install the project in "editable" mode like so

git clone https://github.com/amosbastian/football.git
cd football
pip install -e .

Usage

Currently the way to use football is to instantiate a Football class using your API key by either passing it directly or setting the environment variable FOOTBALL_API_KEY, which can be requested here

from football import Football
football = Football("your_api_key")

manchester_united = football.team("Manchester United FC")

The following (sub) resources are available

Get all available competitions

# This year
competitions = football.competitions()
# Given year
competitions = football.competitions(2015)

Get all teams in the given competition

teams = football.teams()

Get the league table / current standings on the given competition

# Get the Premier League table
table = football.table("PL")

Get all fixtures of the given competition

# Get the fixtures of the Premier League
fixtures = football.competition_fixtures("PL")

Get all fixtures across competitions

fixtures = football.fixtures()

Get a single fixture

fixture = football.fixture(159031)

Get all fixtures of a given team

# Get Manchester United's fixtures
fixtures = football.team_fixtures(66)
fixtures = football.team_fixtures("MUFC")

Get a team

# Get Manchester United
team = football.team(66)
team = football.team("Manchester United FC")

Get all players of the given team

# Get Manchester United's players
players = football.players(66)
players = football.players("ManU")

Contributing

Please read CONTRIBUTING.md for details on how to contribute to football and what the best way to go about this is!

Roadmap

Authors

See also the list of contributors who participated in this project.

Changelog

0.1.1 - 2018-05-14

Added

0.2.0 - 2018-06-10

Updated

License

This project is licensed under the AGPL-3.0 license - see the LICENSE file for details.

Acknowledgements