sports.py
Gather live up-to-date sports scores. Baseball, basketball, cricket, football, handball, hockey, rugby, soccer, tennis, and volleyball currently functional
Scrapes data from:
- scorespro.com
- pro-football-reference.com
- baseball-reference.com
- basketball-reference.com
- hockey-reference.com
Installation
Python >= 3.5
pip install sports.py
Usage
import sports
Valid sports:
- Baseball:
sports.BASEBALL - Basketball:
sports.BASKETBALL - Cricket:
sports.CRICKET - Football:
sports.FOOTBALL - Handball:
sports.HANDBALL - Hockey:
sports.HOCKEY - Rugby Union:
sports.RUGBY_U - Rugby League:
sports.RUGBY_L - Soccer:
sports.SOCCER - Tennis:
sports.TENNIS - Volleyball:
sports.VOLLEYBALL
Get a single match
get_match() takes three parameters:
sport: Name of sport being played (see above for a list of valid sports)team1: Name of city or team in a match (Not case-sensitive)team2: Name of city or team in a match (Not case-sensitive)
get_match() returns a single Match object which contains the following properties:
sport: Sport of the matchleague: League of the matchhome_team: Home teamaway_team: Away teamhome_score: Home team scoreaway_score: Away team scorematch_time: Current match timematch_date: Date the match was playedmatch_link: Link to an XML file containing match data
match = sports.get_match(sports.TENNIS, 'Murray', 'Federer')
Get multiple matches
get_sport() takes one parameter:
sport: Name of sport (see above for list of valid sports)
get_sport() returns a list of Match objects which contain the same properties described above
matches = sports.get_sport(sports.BASKETBALL)
Get all live matches
all_matches() returns a dictionary of Match objects grouped by sport conatining data from all live matches.
all_matches = sports.all_matches()
baseball = all_matches['baseball']
Get extra team info
Only works with MLB, NBA, NFL, and NHL teams
Get team information including overall record, championships won and more.
get_team() takes two parameters:
sport: Sport of the team the findteam: Name of city or team to find (Not case-sensitive)
Properties available to all valid teams/sports:
name: Name of the teamseasons: Total number of seasons playedrecord: Overall regular season recordchamps: Number of total championships (Includes pre-merger champs for NFL)leaders: Overall team leaders for certain statistical categoriesraw: Dictionary containing all gathered info
Properties available to only MLB teams:
pennants: Total number of AL/NL championships
Properties available to only NFL teams:
super_bowls: Total number of Super Bowls
Properties available to only NHL teams:
points: Total number of regular season points earned
Properties available to both NFL/NHL teams:
playoff_record: Overall playoff record
Properties available to MLB, NBA, NHL teams:
playoff_app: Total number of playoff appearances
pirates = sports.get_team_info(sports.BASEBALL, 'pirates')
print(pirates.pennants)
penguins = sports.get_team_info(sports.HOCKEY, 'penguins')
print(penguins.points)
steelers = sports.get_team_info(sports.FOOTBALL, 'steelers')
print(steelers.super_bowls)
sixers = sports.get_team_info(sports.BASKETBALL, '76ers')
print(sixers.playoff_app)
Metadata
Release files for sports.py 2.0.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sports.py-2.0.10.tar.gz | 6.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sports.py-2.0.10-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.4 kB
Release files / sports.py-2.0.10.tar.gz
| Download URL | sports.py-2.0.10.tar.gz |
|---|---|
| Size | 6.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dd110daf3720b1944e356f64bc841d10ffa7f5afbd2705985d6228cbffd096bb
|
|
BLAKE2b-256 checksum How to use checksums |
915ca77dde53f5dbde27b683a1437df9dc19a367e1bdb89f015ac93f599f5940
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.20.0 setuptools/46.4.0 requests-toolbelt/0.8.0 tqdm/4.15.0 CPython/3.7.3
|
Release files / sports.py-2.0.10-py3-none-any.whl
| Download URL | sports.py-2.0.10-py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
eaed8a2e4b15d73c8d75cc15126161b368d0fe885c2d0ec36d73e32a449e434a
|
|
BLAKE2b-256 checksum How to use checksums |
0ed909cce3dad7895c59786fe359787e65f5e3bf242dc941033a1b09afdf9d64
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.20.0 setuptools/46.4.0 requests-toolbelt/0.8.0 tqdm/4.15.0 CPython/3.7.3
|