Getting Started
This page walks you through installing SlaPyShot, setting up your API key, and making your first request.
1. Install SlaPyShot
2. Get a SportRadar API Key
SlaPyShot uses the SportRadar NHL API. The free trial tier gives you access to all endpoints used by this package.
- Sign up at developer.sportradar.com
- Register a new application and request access to the NHL Official API Trial
- Copy your API key
Trial tier limits
The free trial tier allows 1 request per second and 1,000 requests per month. SlaPyShot's built-in rate limiter handles the 1 req/sec limit automatically.
3. Configure Your API Key
Create a .env file in your project root and add your key:
SlaPyShot will load it automatically on import. You can also pass the key directly:
from slapyshot import NHLClient
# From .env (recommended)
client = NHLClient()
# Or passed directly
client = NHLClient(api_key="your_key_here")
Keep your key out of version control
Add .env to your .gitignore so your API key is never committed to a repository.
4. Your First Request
from slapyshot import NHLClient
client = NHLClient()
# Get all NHL teams
teams = client.teams.get_all_teams()
print(teams)
You should see a Polars DataFrame with one row per team:
shape: (32, 9)
┌──────────────────────┬────────────┬──────────┬───────┬─────────┬──────────────┬─────────────────┬─────────────┬───────────────┐
│ id ┆ name ┆ market ┆ alias ┆ founded ┆ conference_id┆ conference_name ┆ division_id ┆ division_name │
╞══════════════════════╪════════════╪══════════╪═══════╪═════════╪══════════════╪═════════════════╪═════════════╪═══════════════╡
│ 4416091c-0f24-11e2… ┆ Wild ┆ Minnesota┆ MIN ┆ 2000 ┆ conf-west-id ┆ Western ┆ div-cent-id ┆ Central │
│ … ┆ … ┆ … ┆ … ┆ … ┆ … ┆ … ┆ … ┆ … │
└──────────────────────┴────────────┴──────────┴───────┴─────────┴──────────────┴─────────────────┴─────────────┴───────────────┘
5. Access Levels
SlaPyShot supports both SportRadar access levels:
# Free trial (default)
client = NHLClient(access_level="trial")
# Paid production access
client = NHLClient(access_level="production")
6. Rate Limiting
The default delay between API calls is 1.0 seconds, matching the trial tier limit. You can adjust this for production access:
# Faster for production tier
client = NHLClient(rate_limit_delay=0.5)
# Slower if you want to be extra conservative
client = NHLClient(rate_limit_delay=2.0)
The rate limiter is automatic — you never need to call time.sleep() yourself.
Next Steps
Now that you're set up, explore what SlaPyShot can do:
- Teams & Rosters — find team IDs and pull rosters
- Schedules — get game IDs from daily or season schedules
- Game Data — boxscores, summaries, and play-by-play
- Player Stats — career profiles and season leaderboards