Skip to content

About

Command line interface to get information about various football competitions, teams and matches.

Resources

Stars

3 stars

Watchers

1 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

Football CLI

A command line interface to get information about various football competitions, teams and matches.

Installation

Clone this repo to your local machine:

git clone https://github.com/Ismail-Mahmoud/football-cli.git

Go to the project directory:

cd football-cli

[Optional] Create a virtual environment and activate it:

python3 -m venv venv
source venv/bin/activate

Install the package:

pip3 install .

Getting Started

1. Config

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 (1 for True, any other value for False).
  • SAVE_API_RESPONSE: to save API response in response.json under football_cli/data (1 for True, any other value for False).

2. Shell completion

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.

3. Data directory

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.

Usage

There are 3 main commands to use:

  1. competition: to show competitions info.
  2. team: to show teams info.
  3. matches: to show past, live and upcoming matches.

Competitions

List all available competitions with their IDs:

football competition --all

Champions of previous seasons:

football competition <ID>

Standings:

football competition <ID> standings [OPTIONS]

Top scorers:

football competition <ID> scorers [OPTIONS]

Competition matches:

football competition <ID> matches [OPTIONS]

Competition teams:

football competition <ID> teams [OPTIONS]

Show help:

football competition --help

Teams

List all available teams with their IDs:

football team --all

Team squad:

football team <ID>

Team matches:

football team <ID> matches [OPTIONS]

Show help:

football team --help

Matches

Show available matches:

football matches [OPTIONS]

Show help:

football matches --help

Demo

For live demo, run scripts/demo.sh

Premier League champions

PL champions

Premier League standings

PL standings

Premier League top 5 scorers

PL top scorers

Premier League matchday 38

PL matches

World Cup matches

WC matches

UEFA Champions League semi-final/final matches

CL matches

Team matches of the whole season

FCB matches

Last/Next N matches for a team You can specify whether to show only home matches (--home), away matches (--away) or both (no flag).

ARS matches

Team squad

FCB squad

Today's/Live matches

Matches today

Matches of the big 5 leagues at a specific date

Matches date/competitions

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.

Matches time frame

Head-to-head matches Note that you need to get match ID first using --show-id flag.

Matches H2H

About

Command line interface to get information about various football competitions, teams and matches.

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages