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.0.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.0-py3-none-any.whl (24.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lukhed_sports-0.3.0.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.0.tar.gz
Algorithm Hash digest
SHA256 d7ce29c43e4e7f973cd5b9f5b71ff61724d23f8b49e7890e85a9b896be710dbe
MD5 048ce88a715c5c769d7e252ede94ee2b
BLAKE2b-256 9ccee66b9f51c73230647c393733cb41a515f2495aa93bc1a52f24754f87267a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lukhed_sports-0.3.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 00be080b687c9af195e89be8e1d50dad88d856c9d597660008ff03dacab0478a
MD5 c44033cae74628dfab71e1c7448e7117
BLAKE2b-256 a98721fe18ba78af52b7d9074dfc9d51427baed4f94511d09e810958005d5673

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