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)

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.2.0.tar.gz (14.6 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.2.0-py3-none-any.whl (24.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lukhed_sports-0.2.0.tar.gz
  • Upload date:
  • Size: 14.6 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.2.0.tar.gz
Algorithm Hash digest
SHA256 e60a36aba0f9a42b57b0eee166c7de409d26b5ebf30b10d46c8acc8348161b93
MD5 3be1dbbdcc643ce6dc835f3665502b68
BLAKE2b-256 26514cad32a77a233c414396a74deac43bd0f1a3546c8864feadcee8e6a0b28e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lukhed_sports-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 24.0 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 441323db6906a11112576b6fab7bf3f54d808cefe41f94f1dcaafcd597ae123c
MD5 e25443e7a8db33db12923e8cff9b77d1
BLAKE2b-256 9738c92cb2e65030a5ca2808b303c48342f9ba2323b06f8f6a1d2368a3e15a82

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