AltSportsLeagues Python SDK
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
Metadata
Release files for altsportsleagues 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| altsportsleagues-2.0.0.tar.gz | 28.1 kB | Without provenance | Details for altsportsleagues-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| altsportsleagues-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for altsportsleagues-2.0.0-py3-none-any.whl |
Total release size: 39.5 kB
Release files / altsportsleagues-2.0.0.tar.gz
| Download URL | altsportsleagues-2.0.0.tar.gz |
|---|---|
| Size | 28.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2ebc645753270b303ebafb2d925628ac5e5743ccc47358668b441738d99e058a
|
|
BLAKE2b-256 checksum How to use checksums |
b995c81446347ba0195682ef9558b82b36f081b94a28f06daa39be6bb909d45f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Release files / altsportsleagues-2.0.0-py3-none-any.whl
| Download URL | altsportsleagues-2.0.0-py3-none-any.whl |
|---|---|
| Size | 11.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
26d27bce7d06eb937a6e0853f61b829c10490e755c44f450bb0dbae3485698ee
|
|
BLAKE2b-256 checksum How to use checksums |
0c8948a0420ecb6936723a51cd768322209d00feedb5ff44a389acc34b03a8e3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Security for altsportsleagues 2.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.