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 (https://sportspagefeeds.com/documentation).

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
  • 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

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 = api.get_games('nba')

Check API Usage

sP.check_api_limit()

>>>
You have 4 api calls remaining
Your reset time is set for 20241230194114 US/Eastern
Your limit is 20

Games

{
    "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
            },
            "schedule": {
                "date": "2024-12-31T01:15:00.000Z",
                "tbaTime": false
            },
            "status": "scheduled",
            "teams": {
                "away": {
                    "team": "Detroit Lions",
                    "location": "Detroit",
                    "mascot": "Lions",
                    "abbreviation": "DET",
                    "conference": "NFC",
                    "division": "North"
                },
                "home": {
                    "team": "San Francisco 49ers",
                    "location": "San Francisco",
                    "mascot": "49ers",
                    "abbreviation": "SF",
                    "conference": "NFC",
                    "division": "West"
                }
            },
            "lastUpdated": "2024-12-30T19:10:22.234Z",
            "gameId": 312013,
            "venue": {
                "name": "Levi's Stadium",
                "neutralSite": false,
                "city": "Santa Clara",
                "state": "CA"
            },
            "odds": [
                {
                    "spread": {
                        "open": {
                            "away": -3.5,
                            "home": 3.5,
                            "awayOdds": -110,
                            "homeOdds": -110
                        },
                        "current": {
                            "away": -3.5,
                            "home": 3.5,
                            "awayOdds": -115,
                            "homeOdds": -110
                        }
                    },
                    "moneyline": {
                        "open": {
                            "awayOdds": -189,
                            "homeOdds": 158
                        },
                        "current": {
                            "awayOdds": -200,
                            "homeOdds": 167
                        }
                    },
                    "total": {
                        "open": {
                            "total": 51.5,
                            "overOdds": -110,
                            "underOdds": -110
                        },
                        "current": {
                            "total": 50,
                            "overOdds": -115,
                            "underOdds": -110
                        }
                    },
                    "openDate": "2024-12-23T08:36:31.974Z",
                    "lastUpdated": "2024-12-30T19:08:42.326Z"
                }
            ]
        }
    ]
}

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.1.0.tar.gz (14.2 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.1.0-py3-none-any.whl (23.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lukhed_sports-0.1.0.tar.gz
  • Upload date:
  • Size: 14.2 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.1.0.tar.gz
Algorithm Hash digest
SHA256 4d4129adbb548978b99fadbee5b33793cc6e2af7925e98c714ceaf315d75dbb1
MD5 066bc46383c8ad28cc1c09bf5deda82a
BLAKE2b-256 d500f41a6d929a08adabca2f0f8a2493f31bb441407c1056e8d4280330434453

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lukhed_sports-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 23.7 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c1b100b8357aa80f0f18fe01734d8bbdcbd7d2b3dc0d2ce4c3469d4d5536e88d
MD5 02919997acd13770735ce7f093802c66
BLAKE2b-256 f7909d90ef1e63cf9abd379ffa9c346259973831b9afbc94fea5fd464f213a14

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