Skip to main content

sportly

Python SDK for multi-source sports data — ESPN, MLB, NBA, NFL, FotMob, Sofascore, ESPN Fantasy, and NHL.

PyPI version CI License: MIT Python 3.12+


☕ Support This Project

Platform Link
☕ Buy Me a Coffee buymeacoffee.com/pseudo_r
💖 GitHub Sponsors github.com/sponsors/Kloverdevs
💳 PayPal PayPal (CAD)

📱 Real-World Apps Built With sportly

App Store
🏀 Sportly: Basketball Live Google Play
⚽ Sportly: Soccer Live Google Play
🏒 Sportly: NHL & Hockey Live Google Play
🏈 Sportly: American Football Live Google Play
⚾ Sportly: Baseball Live Google Play

Install

pip install sportly

# Include Sofascore support (curl_cffi TLS impersonation)
pip install sportly[sofascore]

# All optional extras
pip install sportly[all]

Requires Python 3.12+.


Data Sources

Module Source Auth Special
sportly.espn ESPN (17 sports, 139+ leagues) None 6 ESPN API domains
sportly.nhl NHL Web API + NHL Stats REST None Official NHL data
sportly.mlb MLB Stats API (statsapi.mlb.com) None hydrate= embeds sub-resources
sportly.nba NBA Stats API (stats.nba.com) WAF headers (auto-injected) resultSets row-parser built-in
sportly.nfl ESPN public NFL infrastructure None Wraps existing ESPN domains
sportly.fantasy ESPN Fantasy v3 (lm-api-reads) Cookies (private leagues only) Public leagues need no auth
sportly.fotmob FotMob web API None xG, shot maps, player ratings
sportly.sofascore Sofascore API v1 curl_cffi TLS spoof pip install sportly[sofascore]

Quick Start

# ── ESPN ──────────────────────────────────────────────────────────────
from sportly.espn import basketball, football, soccer, hockey

# NBA teams
teams = basketball.teams("nba")
# EPL standings
table = soccer.standings("eng.1")
# NHL scores
scores = hockey.scoreboard("nhl")

# ── MLB ───────────────────────────────────────────────────────────────
from sportly import mlb

games  = mlb.schedule()                          # today
ohtani = mlb.player(660271)                      # Shohei Ohtani
hr     = mlb.leaders("homeRuns", season=2025)    # HR leaders
box    = mlb.boxscore(745444)                    # game boxscore

# ── NBA ───────────────────────────────────────────────────────────────
from sportly import nba

sb     = nba.scoreboard("2025-03-26")
shots  = nba.shot_chart("201939", "2024-25")     # Curry
top    = nba.leaders("PTS", season="2024-25")
st     = nba.standings("2024-25")

# ── NFL ───────────────────────────────────────────────────────────────
from sportly import nfl

sb     = nfl.scoreboard(week=1, season=2024)
dc     = nfl.depth_chart("6")                    # Cowboys
inj    = nfl.injuries()
qbr    = nfl.qbr(season=2024)

# ── ESPN Fantasy ──────────────────────────────────────────────────────
from sportly import fantasy

teams  = fantasy.teams("ffl", league_id=336358, season=2025)
draft  = fantasy.draft("ffl", league_id=336358, season=2025)
# Private league:
data   = fantasy.league("ffl", league_id=123456, season=2025,
                         cookies={"espn_s2": "...", "SWID": "{...}"})

# ── FotMob ────────────────────────────────────────────────────────────
from sportly import fotmob

day    = fotmob.matches("20260326")              # today's matches
epl    = fotmob.league(47)                       # Premier League
m      = fotmob.match(4310531)                   # xG, lineups, ratings

# ── Sofascore ─────────────────────────────────────────────────────────
from sportly import sofascore                    # requires pip install sportly[sofascore]

games  = sofascore.matches("football", "2026-03-26")
stats  = sofascore.match_stats(11352523)         # xG, possession
lineup = sofascore.lineups(11352523)

# ── NHL ───────────────────────────────────────────────────────────────
from sportly import nhl

today  = nhl.schedule()
games  = nhl.scoreboard()
roster = nhl.roster("TOR")

CLI

sportly info

# ESPN
sportly espn basketball teams --league nba
sportly espn football scoreboard --league nfl
sportly espn soccer standings --league eng.1

# NHL
sportly nhl teams
sportly nhl schedule --date 2024-04-15

ESPN Coverage (17 sports · 139+ leagues)

Module Default League Notable Leagues
espn.basketball nba WNBA, NCAA, NBL, FIBA
espn.football nfl NCAAF, CFL, XFL, UFL
espn.soccer eng.1 260+ leagues worldwide
espn.hockey nhl NCAA
espn.baseball mlb NCAA, WBC
espn.cricket icc-cricket ICC T20/ODI, IPL
espn.tennis atp WTA
espn.golf pga LPGA, LIV, DP World
espn.mma bellator LFA, Cage Warriors
espn.racing f1 IndyCar, NASCAR
espn.lacrosse pll NLL, NCAA
espn.volleyball womens-college-volleyball NCAA
espn.water_polo mens-college-water-polo NCAA
espn.field_hockey womens-college-field-hockey NCAA
espn.rugby 180659 (Six Nations) 24 competitions
espn.rugby_league 3 NRL, Super League
espn.australian_football afl AFL

ESPN Methods (per sport module)

Method Description
teams(league) All teams
team(id, league) Single team
roster(team_id, league) Team roster
scoreboard(league, date) Live scores / schedule
game(id, league) Game summary
news(league, limit) Latest news
standings(league, season) League table
injuries(league) Injury report
transactions(league) Signings / trades
athlete(id, league) Athlete profile
athlete_stats(id, league) Season statistics
athlete_gamelog(id, league) Game-by-game log
odds(event_id, league) Betting odds
play_by_play(event_id, league) Play-by-play
cdn_game(game_id) Full CDN game package

Documentation


Development

git clone https://github.com/pseudo-r/sportly
cd sportly
pip install -e .[dev]
pytest

License

MIT — see LICENSE

Disclaimer: This SDK uses undocumented public APIs. Not affiliated with ESPN, MLB, NBA, NFL, FotMob, Sofascore, or NHL.

Last updated: March 2026 · v1.1.0 · 8 sources · 17+ sports · 139+ leagues

Metadata

Release files for sportly 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sportly 1.1.1
File Size Uploaded
sportly-1.1.1.tar.gz 65.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sportly 1.1.1
File Interpreter ABI Platform
sportly-1.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 151.9 kB

Release files / sportly-1.1.1.tar.gz

Download URL sportly-1.1.1.tar.gz
Size 65.3 kB
Tags Source
SHA-256 checksum
How to use checksums
03fc6e7fe534869216f578c9339aab8e07af46ee8357c8015f973c0170cc9c4a
BLAKE2b-256 checksum
How to use checksums
81de690007d6b9ea3f3dfece7a4e4eb3b5ccb5fed9e89a317565edcc441ebcbe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 27, 2026.

Transparency log

Release files / sportly-1.1.1-py3-none-any.whl

Download URL sportly-1.1.1-py3-none-any.whl
Size 86.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
65828ba279be86442d2487e4f3b52d950d369f9a45967cd0e6ffa7071f204f02
BLAKE2b-256 checksum
How to use checksums
802d32ecaef91b324fb95a0b240d172d207d3210b9c300f0c38170923ab069c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 27, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.1.1 This release

2 release files

1.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page