Python SDK for the Canadian Football League (CFL) API
Project description
🏈 CFL SDK
A modern Python SDK for the Canadian Football League API using httpx.
Features
- Full type hints using modern Python typing
- Comprehensive API coverage (most endpoints supported)
- Error handling and logging
Installation
pip install cfl-sdk
With Poetry
poetry add cfl-sdk
Quick Start
from cfl import CFLClient
# Create client
client = CFLClient()
# Get teams
teams = client.get_teams()
for team in teams:
print(f"{team['name']} ({team['abbreviation']})")
# Get fixtures for a season
fixtures = client.get_fixtures(season_id=34) # 2025 season
# Get player stats
player_stats = client.get_player_stats(season_id=34) # 2025 season
API Reference
Teams
# Get all teams
teams = client.get_teams()
# Get a specific team
team = client.get_team(team_id=1)
Venues
# Get all venues
venues = client.get_venues()
# Get specific venue
venue = client.get_venue(venue_id=1)
Seasons
# Get all seasons (with optional pagination)
seasons = client.get_seasons(page=1, limit=50)
# Get specific season
season = client.get_season(season_id=34) # 2025 season
Fixtures (Games)
# Get all fixtures (with optional pagination)
fixtures = client.get_fixtures(page=1, limit=50)
# Get fixtures for a season
fixtures = client.get_fixtures(season_id=34, page=1, limit=50) # 2025 season
Rosters
# Get all rosters
rosters = client.get_rosters()
# Get specific roster
roster = client.get_roster(roster_id=1)
Ledger (Transactions)
# Get transactions for a year
transactions = client.get_ledger(year=2024)
Team Stats
# Get team stats
team_stats = client.get_team_stats()
# Get team stats for a season
team_stats = client.get_team_stats(season_id=34) # 2025 season
# Get specific team stats
team_stat = client.get_team_stat(team_stats_id=122345)
Player Stats
# Get player stats (with optional pagination and season filter)
player_stats = client.get_player_stats(season_id=34, page=1, limit=50)
# Get specific player stats
player_stat = client.get_player_stat(player_stats_id=1629968)
# Get player stats with photo URL
player_stat = client.get_player_pims(player_id=168507)
Standings
# Get standings for a year (2023-2025 supported)
standings = client.get_standings(year=2024)
Leaderboard
# Get player leaderboard for different stats for a year (2023-2025 supported)
leaderboard = client.get_leaderboards(season=2024)
Error Handling
The SDK provides specific error types:
CFLAPIConnectionError: For connection issuesCFLAPITimeoutError: For request timeoutsCFLAPINotFoundError: For 404 responsesCFLAPIAuthenticationError: For auth issuesCFLAPIValidationError: For invalid requestsCFLAPIServerError: For server errors
from cfl import CFLClient, CFLAPINotFoundError
client = CFLClient()
try:
team = client.get_team(team_id=999999)
except CFLAPINotFoundError:
print("Team not found")
Using with Context Manager
with CFLClient() as client:
teams = client.get_teams()
# Client will be closed automatically
Acknowledgements & Disclaimer
Thank you to the Canadian Football League (CFL) for providing a public API.
This is an unofficial SDK and is not affiliated with, endorsed, or sponsored by the Canadian Football League (CFL).
Contributing
Contributions are welcome! Please feel free to submit a pull request or open an issue for any bugs or feature requests.
License
This project is licensed under the MIT License. See the LICENSE file for more details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cfl_sdk-0.0.1.tar.gz.
File metadata
- Download URL: cfl_sdk-0.0.1.tar.gz
- Upload date:
- Size: 14.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51f62df32ede63096e4b7ca6b66b6abcf647d61afef71e826770713e29c9c67d
|
|
| MD5 |
fd648fda4bce3a6860a4fe6b1f7edc33
|
|
| BLAKE2b-256 |
3cd9fd870485db9d111fc2d1d437cfcb8d30ec82152398ad4372a483b6758560
|
Provenance
The following attestation bundles were made for cfl_sdk-0.0.1.tar.gz:
Publisher:
release.yml on ojadeyemi/cfl-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cfl_sdk-0.0.1.tar.gz -
Subject digest:
51f62df32ede63096e4b7ca6b66b6abcf647d61afef71e826770713e29c9c67d - Sigstore transparency entry: 483388334
- Sigstore integration time:
-
Permalink:
ojadeyemi/cfl-sdk@cfea767ca8fdb592f4dddc294618b5fbc9b44a2d -
Branch / Tag:
refs/tags/v.0.0.1 - Owner: https://github.com/ojadeyemi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@cfea767ca8fdb592f4dddc294618b5fbc9b44a2d -
Trigger Event:
release
-
Statement type:
File details
Details for the file cfl_sdk-0.0.1-py3-none-any.whl.
File metadata
- Download URL: cfl_sdk-0.0.1-py3-none-any.whl
- Upload date:
- Size: 16.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f73156d16caa571225f4226917d338c297f27fb584ee7110b6e7faee69fcdb5
|
|
| MD5 |
7221cd3a68439aac504c93c6bfc727e2
|
|
| BLAKE2b-256 |
f6abb9d8aa5dd07c08f04289de1422020773516f60f9613d14569cd8c224b3a5
|
Provenance
The following attestation bundles were made for cfl_sdk-0.0.1-py3-none-any.whl:
Publisher:
release.yml on ojadeyemi/cfl-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cfl_sdk-0.0.1-py3-none-any.whl -
Subject digest:
1f73156d16caa571225f4226917d338c297f27fb584ee7110b6e7faee69fcdb5 - Sigstore transparency entry: 483388347
- Sigstore integration time:
-
Permalink:
ojadeyemi/cfl-sdk@cfea767ca8fdb592f4dddc294618b5fbc9b44a2d -
Branch / Tag:
refs/tags/v.0.0.1 - Owner: https://github.com/ojadeyemi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@cfea767ca8fdb592f4dddc294618b5fbc9b44a2d -
Trigger Event:
release
-
Statement type: