Skip to main content

FlashScore Football Library

Unofficial Python wrapper for flashscore.com

PyPI version PyPI - Python Version Coverage PyPI - License Downloads Ruff

Overview • Installation • Available Classes • Usage

This is a fork of progeroffline/fs-football

Table of Contents

Languages

Overview

This Python library allows you to easily fetch data about football matches from the FlashScore website (flashscore.com). It is designed for asynchronous operation, providing fast and efficient data retrieval. In some parts of the library, the grequests library is used to enhance performance.

Features

  • Asynchronous Data Retrieval: The library employs Python's asynchronous approach using the asyncio framework to make asynchronous HTTP requests, allowing for efficient data retrieval from FlashScore.

  • Historical Match Data: Access to historical data about past football matches, including match results, team statistics, and top scorers.

Installation

git clone https://github.com/progeroffline/fs-football
cd fs-football/
python3 -m venv venv
source venv/bin/activate
pip3 install -r requirements.txt

Usage

Here is a simple example of using the library to fetch historical match data:

from flashscore import FlashscoreApi

api = FlashscoreApi()
countries = api.get_countries()

for country in countries:
    leagues = country.get_leagues()

    for league in leagues:
        season = league.get_season()

        current_season = season[0]
        for match in current_season.get_matches():
            print(match)
            match.load_content()
            print(match)

Here is a simple example of using the library to fetch data about today's matches:

from flashscore import FlashscoreApi

api = FlashscoreApi()
today_matches = api.get_today_matches()

for i, match in enumerate(today_matches):
    match.load_content()

Available Classes

StatValue

Represents a statistical value in a match.

  • name: The name of the statistical value.
  • home: The value for the home team.
  • away: The value for the away team.

Event

Represents an event in a match, such as a goal or a card.

  • type: The event type.
  • player_name: The name of the player involved in the event.
  • player_url: The URL associated with the player.
  • time: The time when the event occurred (optional).
  • current_score: The current score of the match (optional).
  • second_player_name: The name of the second player involved in the event (optional).
  • second_player_url: The URL associated with the second player (optional).
  • description: Additional description of the event (optional).

HistoryMatch

Represents a historical match.

  • id: The unique identifier of the match.
  • timestamp: The timestamp of the match.
  • date: The date and time of the match.
  • home_team_name: The name of the home team.
  • home_team_score: The score of the home team.
  • away_team_name: The name of the away team.
  • away_team_score: The score of the away team.
  • league_name: The name of the league to which the match belongs.
  • country: The country in which the match took place.
  • final_total_score: The final total score of the match.
  • main_team: The main team in the match (optional).
  • result_for_main_team: The result for the main team (optional).

Match

Represents a match, including its details and statistics.

  • id: The unique identifier of the match.
  • country_name: The name of the country where the match took place (optional).
  • league_name: The name of the league to which the match belongs (optional).
  • timestamp: The timestamp of the match (optional).
  • date: The date and time of the match (optional).
  • tournament: The name of the tournament (optional).
  • home_team_name: The name of the home team (optional).
  • away_team_name: The name of the away team (optional).
  • home_team_score: The score of the home team (optional).
  • away_team_score: The score of the away team (optional).
  • final_total_score: The final total score of the match (optional).
  • status: The match status (optional).
  • stats_match: A list of statistical values for the entire match.
  • stats_first_half: A list of statistical values for the first half.
  • stats_second_half: A list of statistical values for the second half.
  • prematch_home_odds: Odds for the home team before the match (optional).
  • prematch_middle_odds: Average odds before the match (optional).
  • prematch_away_odds: Odds for the away team before the match (optional).
  • events: A list of events that occurred during the match.
  • home_matches: A list of historical matches for the home team.
  • away_matches: A list of historical matches for the away team.
  • head2head_matches: A list of historical matches between these two teams.

Release files for fs-football-fork 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fs-football-fork 0.1.0
File Size Uploaded
fs_football_fork-0.1.0.tar.gz 112.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fs-football-fork 0.1.0
File Interpreter ABI Platform
fs_football_fork-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 125.6 kB

Release files / fs_football_fork-0.1.0.tar.gz

Download URL fs_football_fork-0.1.0.tar.gz
Size 112.8 kB
Tags Source
SHA-256 checksum
How to use checksums
95c5ce9280bdc1e7bce02a1ea0afe52c7b888039b84a9ef1efb21b16a0b5a86d
BLAKE2b-256 checksum
How to use checksums
e35ec352808144dc5069ee4fb276d5f1028979edfc386bc9e4d2f1d24fe040a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.15

Release files / fs_football_fork-0.1.0-py3-none-any.whl

Download URL fs_football_fork-0.1.0-py3-none-any.whl
Size 12.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
011c7b3356ad6637e865147842930e3d1c1949edf95c27cc0b54569c1c9b1e44
BLAKE2b-256 checksum
How to use checksums
a85cd3b40b18826f1ec5f8fb0cd36eca22b7e7eb2ed3f9ef8c08cb99e547c4e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.15

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page