A Python wrapper for kenpom.com's API
Project description
api-kenpom
An unofficial Python wrapper for kenpom.com's API.
Installation
Requires Python 3.12+. Install with uv:
uv add api-kenpom
Or with pip:
pip install api-kenpom
Usage
[!NOTE] Some endpoints only work for 2010 or later.
from kenpom import KenpomClient
client = KenpomClient(bearer_token="YOUR_API_KEY_HERE")
# Retrieve team ratings for the 2024-25 season
ratings = client.get_ratings(year=2025)
# Retrieve ratings for a single team (by team ID)
team = client.get_ratings(team_id=73)
# Retrieve ratings filtered by conference
acc = client.get_ratings(year=2025, conf="ACC")
API Reference
KenpomClient(bearer_token)
All methods return the decoded JSON response body (a list or dict).
| Method | Endpoint | Description |
|---|---|---|
get_ratings(year, team_id, conf) |
ratings |
Team efficiency ratings, SOS, tempo, and possession length. At least one of year or team_id is required. |
get_ratings_archive_by_date(date, team_id, conf) |
archive |
Historical ratings as of a specific date (YYYY-MM-DD). |
get_preseason_ratings_archive(year, team_id, conf) |
archive |
Preseason ratings for a given year. |
get_four_factors(year, team_id, conf, conf_only) |
four-factors |
Four factors statistics for offense and defense. |
get_point_distribution(year, team_id, conf, conf_only) |
pointdist |
Percentage of points from FTs, 2s, and 3s. |
get_height(year, team_id, conf) |
height |
Team height, experience, bench, and continuity. |
get_misc_stats(year, team_id, conf, conf_only) |
misc-stats |
Miscellaneous advanced stats (shooting %, block %, steal rate, etc.). |
get_fanmatch(date) |
fanmatch |
Game predictions for a given date (YYYY-MM-DD). |
get_conference_ratings(year, conf) |
conf-ratings |
Conference efficiency ratings. |
get_teams(year, conf) |
teams |
Team list with conference, coach, and arena info. |
get_conferences(year) |
conferences |
Conference list with short and long names. |
Authentication
A KenPom API subscription is required. If subscribed, your bearer token is available at https://kenpom.com/api-documentation.php. You can find API documentation at https://kenpom.com/api-documentation.php.
Development
# Install pre-commit hooks
pre-commit install
# Install all dependencies (including dev)
uv sync --extra dev
# Run tests
uv run pytest
# Run formatting
uv run ruff format
# Run linting
uv run ruff check
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 api_kenpom-0.1.0.tar.gz.
File metadata
- Download URL: api_kenpom-0.1.0.tar.gz
- Upload date:
- Size: 26.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
915439680b7927085035373d8bb6139afef1894d5123e87f05940519bddd3844
|
|
| MD5 |
fb3a26e9dcff756026c0972615cc1f6c
|
|
| BLAKE2b-256 |
6e5d6086cf181ff93309b9594e63bfdad334e26458502843d59ca2d8dea8186a
|
File details
Details for the file api_kenpom-0.1.0-py3-none-any.whl.
File metadata
- Download URL: api_kenpom-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4dcb632f9f7aa150e40806b7afbef1bf99c85d8795b2f26653a84fb399c1dc3
|
|
| MD5 |
ece75a133c61c002a573f41b8dd8852d
|
|
| BLAKE2b-256 |
61613fb82dc7f5dfb42c2c719f2b8df0c76af31e23aeea9dc8e3ccd713b0c120
|