Sportradar APIs
This is a Python wrapper for the sports APIs provided by Sportradar. You'll need to sign up for an API key to use the service. Sportradar provides a free trial evaluation that provides 1,000 API queries at up to 1 query per second.
Supported APIs
| Sport | API Wrapper | Unit Tests |
|---|---|---|
| Soccer ⚽ | ✔️ | ✔️ |
| NBA 🏀 | ✔️ | ✔️ |
| WNBA 🏀 | ✔️ | ✔️ |
| NCAAMB 🏀 | ✔️ | ✔️ |
| NFL 🏈 | ✔️ | ✔️ |
| NHL 🏆 | ✔️ | ✔️ |
| Tennis 🎾 | ✔️ | ✔️ |
| MLB ⚾ | ✔️ | ✔️ |
| Darts 🎯 | ✔️ | ✔️ |
| Beach volleyball 🌴 | ✔️ | ✔️ |
| Golf ⛳ | ✔️ | ✔️ |
| NASCAR 🚗 | ✔️ | ✔️ |
| LoL 🎮 | ✔️ | ✔️ |
| Dota2 🎮 | ✔️ | ✔️ |
| Cricket 🦗 | ✔️ | ✔️ |
| Rugby 🏉 | ✔️ | ✔️ |
Installation
The easiest way to start using this package is via PyPI using pip:
$pip install sportradar
If you'd prefer to clone the repository and install the package manually, follow these steps:
- Clone this repo:
$git clone https://github.com/johnwmillr/SportradarAPIs.git - Enter the cloned directory:
$cd SportradarAPIs - Install:
$python setup.py install
Usage
Below is a brief demonstration of how to use the package to download data for the 2018 FIFA World Cup.
from sportradar import Soccer
# Create an instance of the Sportradar Soccer API class
sr = Soccer.Soccer("paste your api key here")
# Get a list of all tournaments
tournaments = sr.get_tournaments().json()
# Get info on the 2018 World Cup (Teams, Rounds, etc.)
worldcup = sr.get_tournament_info(tournaments['tournaments'][4]['id']).json()
# Get more information on each team in the World Cup
teams = []
team_counter = 0
for group in worldcup['groups']:
for team in group['teams']:
team_counter += 1
team_id = team['id']
team_name = team['name']
print("({}): {}, {}".format(team_counter, team_name, team_id))
try:
teams.append(sr.get_team_profile(team_id).json())
except Exception as e:
print("Error: {}".format(e))
time.sleep(5) # wait 5 seconds before next API call
# Save the team data to a .json file
print("Saving the data...", end="", flush=True)
with open("world_cup_team_data.json", "w") as outfile:
json.dump(teams, outfile)
print(" Done.")
Example projects
Metadata
Release files for sportradar 1.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sportradar-1.6.0.tar.gz | 14.4 kB | Without provenance | Details for sportradar-1.6.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sportradar-1.6.0-py3-none-any.whl | Python 3 | none | any | Details for sportradar-1.6.0-py3-none-any.whl |
Total release size: 38.1 kB
Release files / sportradar-1.6.0.tar.gz
| Download URL | sportradar-1.6.0.tar.gz |
|---|---|
| Size | 14.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c737ead138cdb8850ebb1609b2bc27e244ea5d8189f121c2cb1895811e1975db
|
|
BLAKE2b-256 checksum How to use checksums |
aef1a87f9552ca6b977bffff70e48f0408b4ab7bc55a9191a8cd5fbbefe8938b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.7.9
|
Release files / sportradar-1.6.0-py3-none-any.whl
| Download URL | sportradar-1.6.0-py3-none-any.whl |
|---|---|
| Size | 23.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
90e8ccd1502b72f3ecb1157fcdff5abcca9f75f576b03675a15cadf96c0f4dda
|
|
BLAKE2b-256 checksum How to use checksums |
24178ea1dadd354afc20f583cd998ae0725ab477fe45ce94ea4416a5463cda9f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.7.9
|
Security for sportradar 1.6.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.