A collection of sports analysis utility functions and API wrappers
Project description
lukhed_sports
A collection of sports analysis utility functions and API wrappers
Installation
pip install lukhed-sports
Available Wrappers
- Sportspage Feeds Wrapper - For sports schedules and odds from sportspagefeeds API
- Draftkings Sports Wrapper - For obtaining live data from Draftkings sportsbook
Drafkings Sportsbook Wrapper
Access live data from Draftkings Sportsbook via their API methods. Quick start information below. Full documentation coming. This class is still a work in progress.
Table of Contents
- Instantiation
- get_available_leagues(sport)
- get_spread_for_team(league, sport)
- get_game_lines_for_league(league)
- get_basic_touchdown_scorer_props(league, prop_type_filter=None, game_filter=None)
Instantiation
from lukhed_sports import DkSportsbook
api = DkSportsbook()
get_available_leagues
Provides valid league inputs for various methods.
leagues = api.get_available_leagues('basketball')
[
"argentina - liga nacional de basquetbol",
"australia - nbl",
"brazil - nbb",
"china - cba",
"college basketball (m)",
"college basketball (w)",
"croatia premier league",
"germany - bundesliga",
"greece - basket league",
"israel - super league (w)",
"italy - lega 1",
"korea - basketball league (w)",
"nba",
"turkey - bsl",
"wnba"
]
get_spread_for_team
Provides the current spread and spread odds for the given team.
spread = api.get_spread_for_team('nfl', 'commanders')
{
"spread": 5.5,
"odds": {
"american": "-108",
"decimal": "1.92",
"fractional": "25/27"
}
}
get_gamelines_for_league
Provides all the gamelines available for a given league.
gamelines = api.get_gamelines_for_league('nfl')
get_basic_touchdown_scorer_props
Provides all the basic td scoring props available, with various filter options.
td = api.get_basic_touchdown_scorer_props('college football', prop_type_filter='anytime', game_filter='notre dame')
[
{
"id": "0QA229129141#130806310_13L87637Q1477509025Q20",
"marketId": "229129141",
"label": "Jeremiah Smith",
"displayOdds": {
"american": "-140",
"decimal": "1.71",
"fractional": "5/7"
},
"trueOdds": 1.71428572,
"outcomeType": "Anytime Scorer",
"participants": [
{
"id": "786772",
"name": "Jeremiah Smith",
"type": "Player",
"seoIdentifier": "Jeremiah Smith"
}
],
"sortOrder": 3001710,
"tags": [
"SGP",
"1stFavorite"
],
"metadata": {}
},
{
"id": "0QA229129141#130806308_13L87637Q1709721529Q20",
"marketId": "229129141",
"label": "TreVeyon Henderson",
"displayOdds": {
"american": "-140",
"decimal": "1.71",
"fractional": "5/7"
},
"trueOdds": 1.71428572,
"outcomeType": "Anytime Scorer",
"participants": [
{
"id": "570977",
"name": "TreVeyon Henderson",
"type": "Player",
"seoIdentifier": "TreVeyon Henderson"
}
],
"sortOrder": 3001710,
"tags": [
"SGP",
"2ndFavorite"
],
"metadata": {}
},
...
Sportspage Feeds Wrapper
This class is a custom wrapper for the sportspagefeeds API.
It provides:
- Management of api key -> You can store api key locally (by default) or with a private github repo so you can use the api efficiently across different hardware.
- Optionally manage api limits (on by default)
- Methods to utilize each endpoint from sportspagefeeds
- Optionally validate input (on by default), to ensure you do not waste API calls
- Methods to get valid inputs for each endpoint, as documentation is sparse
- Methods to parse data returned by basic (non-paid) endpoints
Quick start information below. Full documentation for this class is in development.
API Key Management Locally
Instatiate without optional parameters and upon first use, the class will take you thru setup (copy and paste your Sportspage key)
api = SportsPage()
API Key Managment with Private Github Repo
Instantiate with option github parameters and Upon first use, class will take you thru setup (github token and Sportspage key). Future instantiation, just reference the github_project.
#
api = SportsPage(
config_file_preference='github',
github_project='any_project_name'
)
Games
Get the games occuring today with basic schedule and odds information.
api.get_games('nfl')
See full example response see here.
Rankings
Get rankings for the given target.
rankings = api.get_rankings('ncaaf')
See full example response see here.
Check API Usage
Free tier of Sportspage is limited. You can check your api usage with this method.
api.check_api_limit()
# print to console
>>>
You have 15 api calls remaining
Your reset time is set for 20241230194114 US/Eastern
Your limit is 20
Response
{
"limit": 20,
"remaining": 15,
"resetTime": "20250105194115",
"lastCall": "20250105121251"
}
All Endpoints
api.get_games # Get schedule/status of games
api.get_rankings # Get rankings for various leagues
api.get_teams # Get teams in leagues/conferences
api.get_conferences # Get conferences in leagues
api.get_game_by_id # Get info about a game by its ID
api.get_odds # Get odds for a game (requires paid tier)
Example responses
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lukhed_sports-0.5.0.tar.gz.
File metadata
- Download URL: lukhed_sports-0.5.0.tar.gz
- Upload date:
- Size: 38.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e16bcaca95ec9a93580e5c29fb5bbc63f3ff082187adb847e9f5c6eb8e451d80
|
|
| MD5 |
7f2f2f3a1dba0eae528d55093b7de1f1
|
|
| BLAKE2b-256 |
e8b9895f8e88f5047754478e21f744067029f3d487e11ceb61262215b88744d7
|
File details
Details for the file lukhed_sports-0.5.0-py3-none-any.whl.
File metadata
- Download URL: lukhed_sports-0.5.0-py3-none-any.whl
- Upload date:
- Size: 51.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c2b3f6174f0aaf049ba0fb0b2dfb264f490a99d441accb905ed7656471ebabd
|
|
| MD5 |
bd64b276b65e3ab8d5c15d4a05c386ff
|
|
| BLAKE2b-256 |
256f21b486fc646976a7d58635c9c6aecb542d74ee8f16dcc820893d7c378a83
|