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.1.tar.gz (16.6 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.1-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: footystats-0.1.1.tar.gz
  • Upload date:
  • Size: 16.6 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.1.tar.gz
Algorithm Hash digest
SHA256 b546535f1665bdcda62f572975e34b715d79d7be68454f8dc413bc37fd98ebfd
MD5 49dcf325cee2fbd85cece6b57a36881b
BLAKE2b-256 66e0be48026beb8f44950463441137edc08045b8fe5184a86469d61213f9a4e4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: footystats-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 19.5 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7b1f787bdcb38cf96a6b181b3cac0e270bd53e404371421f64002b763e71cbc8
MD5 515181e2012442e73ef262e8f98d65b0
BLAKE2b-256 9439ae58d55835ac3ec0ce6bb5fb41b62b1b4c5abe0adc631fbe5aec80434674

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