Skip to main content

Python SDK for multi-source sports data — ESPN (17 sports, 139+ leagues), NHL, MLB, NBA, NFL, FotMob, Sofascore & Fantasy

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sportly-1.1.1.tar.gz (65.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sportly-1.1.1-py3-none-any.whl (86.6 kB view details)

Uploaded Python 3

File details

Details for the file sportly-1.1.1.tar.gz.

File metadata

  • Download URL: sportly-1.1.1.tar.gz
  • Upload date:
  • Size: 65.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sportly-1.1.1.tar.gz
Algorithm Hash digest
SHA256 03fc6e7fe534869216f578c9339aab8e07af46ee8357c8015f973c0170cc9c4a
MD5 f1259bde103678a52354d386df03ba90
BLAKE2b-256 81de690007d6b9ea3f3dfece7a4e4eb3b5ccb5fed9e89a317565edcc441ebcbe

See more details on using hashes here.

Provenance

The following attestation bundles were made for sportly-1.1.1.tar.gz:

Publisher: publish.yml on pseudo-r/sportly

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sportly-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: sportly-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 86.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sportly-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 65828ba279be86442d2487e4f3b52d950d369f9a45967cd0e6ffa7071f204f02
MD5 72b55844b4ace218ef2ce58ef190a133
BLAKE2b-256 802d32ecaef91b324fb95a0b240d172d207d3210b9c300f0c38170923ab069c8

See more details on using hashes here.

Provenance

The following attestation bundles were made for sportly-1.1.1-py3-none-any.whl:

Publisher: publish.yml on pseudo-r/sportly

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page