Skip to content

A JSON API for football matches scores and fixtures built with Flask.

Notifications You must be signed in to change notification settings

MikhailWahib/football-scores-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Football Scores API

Description

This API provides data about upcoming and finished football matches. The data is scraped from BBC Sport using Python and Beautiful Soup.

The API uses Redis for caching results, It caches todays results for 30 seconds and the rest for 30 days.

The API is documented using Swagger UI.

Dependencies

Usage

Endpoints

  • [GET] /today
    • Optional query parameter: league - supported values: pl, sl, gl, sa, fl, cl, in
  • [GET] /{date} - date format: YYYY-MM-DD
    • Optional query parameter: league - supported values: pl, sl, gl, sa, fl, cl, in

Response example:

{
  "leagues": [
    {
      "title": "Premier League",
      "matches": [
        {
          "home_team": "Manchester United",
          "away_team": "Manchester United",
          "match_status": "finished | playing | not started",
          "home_team_score": "3",
          "away_team_score": "0",
          // or
          "start_time": "15:00"
        }
      ]
    }
  ]
}

Documentation

Open Swagger UI

  • Run your server and visit http://localhost:5000/docs in your browser.

Local Development

Clone repository

git clone https://github.com/MikhailWahib/football-scores-api.git

Create virtual environment

python3 -m venv venv
source venv/bin/activate

Install dependencies

pip install -r requirements.txt

Run

  • Install (if not) and run Redis server on default port 6379. (mandatory)
redis-server
  • Run the API with
flask run

About

A JSON API for football matches scores and fixtures built with Flask.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages