Skip to main content

grab soccer data and build databases

Project description

footystats

Install with:

pip install footystats

This package contains to major functions:
(1) build sources from www.worldfootball.net
(2) build database from the acquired sources

The soccer leagues available are listed in an Enum
This Enum is used as argument for a lot of functions
(1) PremierLeague (callable using Leagues.PREMIERLEAGUE)
(2) Liga (Leagues.LALIGA)
(3) Ligue 1 (Leagues.LIGUE1)
(4) Bundesliga (Leagues.BUNDESLIGA)
(5) Serie A (Leagues.SERIEA)
(6) Championship (Leagues.CHAMPIONSHIP)
(7) Liga2 (Leagues.LALIGA2)
(8) Ligue2 (Leagues.LIGUE2)
(9) Bundesliga (Leaguues.BUNDESLIGA2)
(10) Serie B (Leagues.SERIEB)
(11) PrimeiraLiga (Leagues.PRIMEIRALIGA)
(12) Eredivisie (Leagues.EREDIVISIE)
(13) Leagues.ALL

#################################################################
	(1) BUILD SOURCES webscrapping from online sites
#################################################################

To obtain the sources, prepare a folder to save the sources (json) and
use this path as argument as in the example below:

from footystats.leagues import Leagues
from footystats.sources import makeSources

sourcesRepertory="YOUR_PATH_TO_SOURCES"
makeSources(Leagues.LALIGA, sourcesRepertory) {for specific spanish laLiga)
makeSources(Leagues.ALL, sourcesRepertory) (for all leagues)

You can load the sources using 
from footystats.sources import loadSources

sources:dict = loadSources(Leagues.LALIGA,sourcesRepertory)

#if you want to enrich the sources with more recent data:
from footystats.sources import updateSources

updateSources(Leagues.LALIGA,sourcesRepertory)

To look the produced sources, you can use a debug function
that writes the json dict within.txt file (auto naming of the debug file)
The debug file is exported in the current working directory
from which the script is run.

from footystats.debug import debugDatabase

debugDatabase(Leagues.LALIGA, sources, startYear="2015")
# this will write the sources from season 2015-2016


#################################################################
	(2) BUILD DATABASE: post treatment of sources
#################################################################
 If you have sources, you can proceed to build database.
 Databases are post-treated sources (json dict).
 You also need to establish a repertory where to save the databases
 if you use Leagues.ALL, all database leagues will be build.
 If debug is True, then the .txt files are also exported
 
 from footystats.database import makeDatabase
 
 mySavePathForDatabase:str="PATH_TO_DATABASES"
 
 makeDatabase(Leagues.LALIGA, sourcesRepertory, mySavePathForDatabase,debug=True,debugYear="2020")
  
#################################################################
	(3) Load the database and enjoy for your custom projects
#################################################################
from footystats.database import loadDatabase

 my_database:dict = loadDatabase(Leagues.LALIGA,mySavePathForDatabase)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

footystats-0.1.0.tar.gz (15.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

footystats-0.1.0-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file footystats-0.1.0.tar.gz.

File metadata

  • Download URL: footystats-0.1.0.tar.gz
  • Upload date:
  • Size: 15.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.0

File hashes

Hashes for footystats-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b4a183ad3c020750bf6cfcfd29dac5de07ec739133e6cc5b41cd7674ede64e78
MD5 bd86b56a9fbe1769c9ffd28bbf34e5c7
BLAKE2b-256 78c6fa6d3f83ea3e5bcbb57ea771c8abbeafb374942beed7ae4ec0d3d252d4ca

See more details on using hashes here.

File details

Details for the file footystats-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: footystats-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.0

File hashes

Hashes for footystats-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bc6633d941ca33bb4c04bddeb579a960764df91005b6bc08a55efd752b9b2e59
MD5 a0a55d7bff45274436fc452b76ad45e2
BLAKE2b-256 9a5c39138c2af6a3427f94fdfbc47fe3d8ff60810f9dab5702621692c68794ef

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page