nfl — Python SDK for ESPN's NFL API
A small, typed Python client for the public (but undocumented) JSON API behind ESPN's NFL pages. No API key or account is needed.
- Typed dataclasses for teams, rosters, scoreboards, game summaries
(boxscore, drives, scoring plays, leaders), standings, athletes and news —
with
.rawon every model for anything not modelled. - Retries on 5xx responses, optional rate limiting, and a small exception
hierarchy (
NFLError,NFLNotFoundError,NFLRateLimitError, ...). - Depends only on
requestsandurllib3. Python 3.10+.
ESPN publishes no developer program or documentation for this API. It has been stable, but it can change without notice.
Install
pip install nfl-espn
# or, from a checkout:
pip install -e .
Quick start
from nfl import NFLClient
client = NFLClient()
# A week's scores
for game in client.scoreboard.get(week=1, season=2026).games:
print(f"{game.short_name:12} {game.score_display:8} [{game.status.short_detail}]")
# Division standings
standings = client.standings.get(season=2026)
for entry in standings.get_division("AFC West").entries:
print(f"{entry.team_display_name:25} {entry.overall}")
# A team and its roster
broncos = client.teams.get(client.teams.BRONCOS)
print(broncos.display_name, broncos.record_str, broncos.standing_summary)
for player in client.teams.roster(client.teams.BRONCOS)[:5]:
print(f"#{player.jersey or '??'} {player.full_name} {player.position_abbreviation}")
See examples/lions.py for a fuller example.
Choosing a season
A season is named by the year it starts. season=2026 is the 2026-27
season: September 2026 through the Super Bowl in February 2027. The playoffs
played in January 2027 are season=2026, not 2027.
Leave season out and you get the current season.
| Call | Selects the season with | Notes |
|---|---|---|
scoreboard.get(week=5, season=2026) |
season + week |
Regular season by default; season_type=1 preseason, 3 postseason. season without week raises ValueError |
scoreboard.get(week=5) |
week |
Week 5 of the current season |
scoreboard.get(dates="2026-10-04") |
a calendar date | Whatever was played that day; today() is the same for today |
scoreboard.playoffs(season=2025) |
season |
Every playoff game of that season (13: Wild Card to Super Bowl, no Pro Bowl) |
scoreboard.playoffs(season=2025, week=5) |
season + round |
1 Wild Card, 2 Divisional, 3 Conference, 5 Super Bowl (4 is the Pro Bowl) |
standings.get(season=2025) |
season |
Final standings for a finished season, or the standings so far for the current one |
teams.schedule(team_id, season=2026) |
season |
That team's regular-season games |
games, athletes, news and teams.get/roster take no season: a game
is looked up by its id (from a scoreboard or schedule), and the rest are
always current.
client.scoreboard.get(week=1, season=2026) # opening week, 2026-27
client.scoreboard.playoffs(season=2025) # the playoffs played Jan-Feb 2026
client.standings.get(season=2025) # final 2025 standings
client.standings.get() # the current season so far
Endpoints
| Attribute | Covers |
|---|---|
client.teams |
teams, rosters, team schedules |
client.scoreboard |
scores and schedule by week, date or season; playoffs |
client.games |
game summary, boxscore, scoring plays, drives, leaders |
client.standings |
division and conference standings |
client.athletes |
a player by ESPN id |
client.news |
league and team news |
Full reference: docs/.
Things the API does that you might not expect
| Behaviour | Notes |
|---|---|
| Seasons are named by their start year | season=2026 is the 2026-27 season, playoffs included |
The scoreboard ignores season= |
It selects a season with dates=YYYY; the SDK sends that for you |
| A year with no week returns a mixed bag | Preseason, regular season and playoffs together, ignoring the season type; the SDK refuses it |
| The Pro Bowl is postseason week 4 | playoffs() leaves it out |
| Three different API hosts | site.api.espn.com for most things, site.web.api.espn.com for standings, sports.core.api.espn.com for athletes — handled internally |
| No player search | Find players through a roster or game data, then look them up by id |
| An unknown team id returns HTTP 400, not 404 | Raised as NFLHTTPError |
| Standings carry no points for/against | Point differential is available |
| A drive's net yards can be negative | Penalties |
Tests
pip install -e '.[dev]'
python3 -m pytest tests -q
The tests are integration tests against the live API (no mocks), so they need network access.
Disclaimer
Not affiliated with or endorsed by ESPN or the NFL. The data belongs to them; this library only makes the requests.
License
GNU General Public License v3.0 only (GPL-3.0-only) — see LICENSE.
Metadata
Release files for nfl-espn 0.1.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 |
|---|---|---|---|---|
| nfl_espn-0.1.0.tar.gz | 32.7 kB | Without provenance | Details for nfl_espn-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nfl_espn-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for nfl_espn-0.1.0-py3-none-any.whl |
Total release size: 63.4 kB
Release files / nfl_espn-0.1.0.tar.gz
| Download URL | nfl_espn-0.1.0.tar.gz |
|---|---|
| Size | 32.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
993f65ac8dfbdaf1f74d7cd73630c6500d36ca779764e92f31cd1e6bbdc774a0
|
|
BLAKE2b-256 checksum How to use checksums |
8618d3c2604fd628c566b7263e5e0b9f192c18275738fa54bf3e366c7c2ec39e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / nfl_espn-0.1.0-py3-none-any.whl
| Download URL | nfl_espn-0.1.0-py3-none-any.whl |
|---|---|
| Size | 30.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
437f76444227168e3e7cd179ef19191a63b1cce4a69b4ba596fb7d2cb5582cfc
|
|
BLAKE2b-256 checksum How to use checksums |
7a0df6d7cd449a4ad2ad820b3e51f141edfe67e8414e3792e7442bb83a0d8be1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Security for nfl-espn 0.1.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.