Skip to main content

A collection of sports analysis utility functions and API wrappers

Project description

lukhed_sports

A collection of sports analysis utility functions and API wrappers

pip install lukhed-sports

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

Full documentation for this class is in development.

Basic Usage

from lukhed_sports import SportsPage

API Key Management Locally

# Upon first use, class will take you thru setup (copy and paste your Sportspage key)
api = SportsPage()
games = api.get_games('nfl')

API Key Managment with Private Github Repo

# Upon first use, class will take you thru setup (github token and Sportspage key)
api = SportsPage(
    config_file_preference='github', 
    github_project='any_project_name'
    )

Games

# Get games occuring today
api.get_games('nfl')

Partial example resopnse below, for full example response see here.

{
    "status": 200,
    "time": "2024-12-30T19:11:10.045Z",
    "games": 1,
    "skip": 0,
    "results": [
        {
            "summary": "Detroit Lions @ San Francisco 49ers",
            "details": {
                "league": "NFL",
                "seasonType": "regular",
                "season": 2024,
                "conferenceGame": true,
                "divisionGame": false
            },
    ...

Rankings

rankings = api.get_rankings('ncaaf')

Partial example resopnse below, for full example response see here.

{
    "status": 200,
    "time": "2025-01-05T17:12:24.613Z",
    "results": [
        {
            "name": "College Football Playoff",
            "rankings": [
                {
                    "rank": 1,
                    "team": "Oregon",
                    "teamId": 1388
                },
                {
                    "rank": 2,
                    "team": "Georgia",
                    "teamId": 1365
                },
        ...

Check API Usage

api.check_api_limit()

# print to console
>>>
You have 4 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
get_games nfl
get_rankings ncaaf
get_teams ncaaf
get_conferences ncaab
get_game_by_id nfl game id
get_odds error response for non paid

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

lukhed_sports-0.3.1.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

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

lukhed_sports-0.3.1-py3-none-any.whl (24.1 kB view details)

Uploaded Python 3

File details

Details for the file lukhed_sports-0.3.1.tar.gz.

File metadata

  • Download URL: lukhed_sports-0.3.1.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.9

File hashes

Hashes for lukhed_sports-0.3.1.tar.gz
Algorithm Hash digest
SHA256 6cadabc17e0497109bac7650a9020aa58d06d958821cb74a1e3c44d4da1008b1
MD5 71188024abfd16cf9c78cac768b062dc
BLAKE2b-256 500ef24c456e536f08c0ba5b7d7c5e41676383093ded74231651e7e0fecfd956

See more details on using hashes here.

File details

Details for the file lukhed_sports-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: lukhed_sports-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 24.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.9

File hashes

Hashes for lukhed_sports-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 aee69e790269feeba4ae83bbad7540bb896b2a35e86d94b18fda857109124bcc
MD5 71ca91190af7c74c9c5ea1bd28daa175
BLAKE2b-256 4e607ae79127120904e7bb86bfd9620d6694587ad537362182f97a7502076b95

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