A command line interface to get information about various football competitions, teams and matches.
Clone this repo to your local machine:
git clone https://github.com/Ismail-Mahmoud/football-cli.gitGo to the project directory:
cd football-cli[Optional] Create a virtual environment and activate it:
python3 -m venv venv
source venv/bin/activateInstall the package:
pip3 install .First, you need to get your API key from https://www.football-data.org/client/register.
Then, set FOOTBALL_CLI_API_KEY in .env with the key you've got. Otherwise you'll need to pass it every time you run a command using --api-key.
In addition to API key, there are extra few environment variables to set in .env that are useful for debugging:
SHOW_ERROR_DETAILS: to show detailed error messages instead of just a brief message (1forTrue, any other value forFalse).SAVE_API_RESPONSE: to save API response inresponse.jsonunder football_cli/data (1forTrue, any other value forFalse).
This is an optional step where you enable shell completion to get suggestions for commands and options when pressing tab as you're typing.
To get completion enabled, run the following script with your shell name:
./scripts/shell_completion.sh <SHELL_NAME>This will generate a new script, save it to football_complete.<bash/zsh> and source it in your shell config file if you're using bash/zsh, or to ~/.config/fish/completions/football_complete.fish if you're using fish.
Note that completion is only supported for bash, zsh and fish. If you want to enable completion for a different shell, check Adding Support for a Shell.
Nothing to be done here, but this is just an illustration for the data directory football_cli/data.
This directory contains basic info about available competitions/teams (mainly IDs) to select from.
These files were generated using football_cli/data_preparation.py script. If this directory is lost for some reason, you'll need to run the script to regenerate data or just run this command: football_gen.
There are 3 main commands to use:
competition: to show competitions info.team: to show teams info.matches: to show past, live and upcoming matches.
football competition --allfootball competition <ID>football competition <ID> standings [OPTIONS]football competition <ID> scorers [OPTIONS]football competition <ID> matches [OPTIONS]football competition <ID> teams [OPTIONS]football competition --helpfootball team --allfootball team <ID>football team <ID> matches [OPTIONS]football team --helpfootball matches [OPTIONS]football matches --helpFor live demo, run scripts/demo.sh
Last/Next N matches for a team
You can specify whether to show only home matches (--home), away matches (--away) or both (no flag).
Matches within a time frame
Note that -3 means the last three days and 5 means the next five days (with today included).Alternatively, You can provide two valid dates.












