Skip to main content

Python SDK for AltSportsLeagues.ai — discover, evaluate, and integrate 150+ alternative sports leagues

Project description

AltSportsLeagues Python SDK

PyPI version Python versions

Python SDK for AltSportsLeagues.ai — discover, evaluate, and integrate with 150+ alternative sports leagues worldwide.

Installation

pip install altsportsleagues

Quick Start

from altsportsleagues import AltSportsLeagues

# Initialize (or set ALTSPORTSLEAGUES_API_KEY env var)
client = AltSportsLeagues(api_key="your_api_key")

# Browse leagues
leagues = client.leagues.list(limit=10)
for league in leagues:
    print(f"{league.name}  [{league.tier}]  {league.sport}")

# Get a specific league
league = client.leagues.get("premier-lacrosse-league")
print(league.name, league.tier, league.country)

# Evaluate a league's business value
valuation = client.valuations.evaluate(league_id="premier-lacrosse-league")
print(f"Tier: {valuation.tier}")
print(f"Annual Value: ${valuation.estimated_annual_value:,.0f}")
print(f"Confidence: {valuation.confidence}%")

# See tier definitions
for tier in client.valuations.tiers():
    print(tier)

Filtering & Search

# Filter by sport bucket
combat = client.leagues.list(sport_bucket="combat")
racing = client.leagues.list(sport_bucket="racing")

# Filter by tier
elite = client.leagues.list(tier="tier-1")

# Search by name
results = client.leagues.list(search="lacrosse")

# Find similar leagues
similar = client.leagues.similar("premier-lacrosse-league")

Valuations

# Evaluate with default weights
val = client.valuations.evaluate(league_id="premier-lacrosse-league")

# Evaluate with custom weights
val = client.valuations.evaluate(
    league_id="premier-lacrosse-league",
    custom_weights={
        "market_size": 0.25,
        "technical_feasibility": 0.20,
        "growth_potential": 0.15,
        "revenue_opportunity": 0.20,
        "strategic_fit": 0.10,
        "competitive_landscape": 0.05,
        "risk_factor": 0.05,
    }
)

# Evaluate ad-hoc league data (no league_id needed)
val = client.valuations.evaluate(
    league_data={
        "leagueName": "My New League",
        "primarySport": "Pickleball",
        "numberOfTeams": 16,
        "region": "North America",
    }
)

Platform Statistics

stats = client.leagues.stats()
print(f"Total leagues: {stats.total_leagues}")
print(f"Tiers: {stats.tier_breakdown}")
print(f"Sports: {stats.sport_bucket_breakdown}")

Error Handling

from altsportsleagues import (
    AltSportsLeagues,
    AuthenticationError,
    NotFoundError,
    RateLimitError,
)

client = AltSportsLeagues(api_key="your_key")

try:
    league = client.leagues.get("nonexistent-league")
except NotFoundError:
    print("League not found")
except AuthenticationError:
    print("Invalid API key")
except RateLimitError as e:
    print(f"Rate limited — retry after {e.retry_after}s")

Configuration

import os

# Via environment variable
os.environ["ALTSPORTSLEAGUES_API_KEY"] = "your_key"
client = AltSportsLeagues()  # picks up env var automatically

# Custom base URL (for self-hosted or staging)
client = AltSportsLeagues(
    api_key="your_key",
    base_url="https://staging-api.altsportsleagues.ai",
    timeout=60,
)

API Resources

Resource Methods
client.leagues .list(), .get(), .create(), .update(), .similar(), .evaluate(), .stats()
client.valuations .evaluate(), .tiers()
client .ping(), .info(), .validate_key()

Links

License

MIT

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

altsportsleagues-2.0.0.tar.gz (28.1 kB view details)

Uploaded Source

Built Distribution

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

altsportsleagues-2.0.0-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file altsportsleagues-2.0.0.tar.gz.

File metadata

  • Download URL: altsportsleagues-2.0.0.tar.gz
  • Upload date:
  • Size: 28.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for altsportsleagues-2.0.0.tar.gz
Algorithm Hash digest
SHA256 2ebc645753270b303ebafb2d925628ac5e5743ccc47358668b441738d99e058a
MD5 06e78f1578c23ab79d6d68e993b71346
BLAKE2b-256 b995c81446347ba0195682ef9558b82b36f081b94a28f06daa39be6bb909d45f

See more details on using hashes here.

File details

Details for the file altsportsleagues-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for altsportsleagues-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 26d27bce7d06eb937a6e0853f61b829c10490e755c44f450bb0dbae3485698ee
MD5 60e2f89c95cb5eae160b66f3e01cdd78
BLAKE2b-256 0c8948a0420ecb6936723a51cd768322209d00feedb5ff44a389acc34b03a8e3

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