MCPcopy Index your code
hub / github.com/swar/nba_api

github.com/swar/nba_api @v1.11.4 sqlite

repository ↗ · DeepWiki ↗ · release v1.11.4 ↗
1,479 symbols 5,702 edges 281 files 526 documented · 36%
README

Version: PyPI Downloads per Month: PyPY Build: CircleCI License: MIT Slack

nba_api

An API Client Package to Access the APIs of NBA.com

nba_api is an API Client for www.nba.com. This package intends to make the APIs of NBA.com easily accessible and provide extensive documentation about them.

Getting Started

nba_api requires Python 3.10+ along with the requests and numpy packages. While pandas is not required, it is required to work with Pandas DataFrames.

pip install nba_api

NBA Official Stats

from nba_api.stats.endpoints import playercareerstats

# Nikola Jokić
career = playercareerstats.PlayerCareerStats(player_id='203999')

# pandas data frames (optional: pip install pandas)
career.season_totals_regular_season.get_data_frame()

# json
career.get_json()

# dictionary
career.get_dict()

NBA Live Data

from nba_api.live.nba.endpoints import scoreboard

# Today's Score Board
games = scoreboard.ScoreBoard()

# json
games.get_json()

# dictionary
games.get_dict()

Additional Examples

  • Requests/Response Options
  • Proxy Support, Custom Headers, and Timeout Settings
  • Return Types and Raw Responses
  • Static Data Sets
  • Reduce HTTP requests for common and frequently accessed player and team data.
  • Jupyter Notebooks
  • Practical examples in Jupyter Notebook format, including making basic calls, finding games, working with play-by-play data, and interacting with live game data.

Documentation

Join the Community

Slack

Join Slack to get help, help others, provide feedback, see amazing projects, participate in discussions, and collaborate with others from around the world.

Stack Overflow

Not a Slack fan? No problem. Head over to StackOverflow. Be sure to tag your post with nba-api.

Contributing

See Contributing to the NBA_API for complete details.

Endpoints

A significant purpose of this package is to continuously map and analyze as many endpoints on NBA.com as possible. The documentation and analysis of the endpoints and parameters in this package are some of the most extensive information available. At the same time, NBA.com does not provide information regarding new, changed, or removed endpoints.

If you find a new, changed, or deprecated endpoint, open a GitHub Issue

Bugs

Encounter a bug, report a bug.

License & Terms of Use

API Client Package

The nba_api package is Open Source with an MIT License.

NBA.com

NBA.com has a Terms of Use regarding the use of the NBA’s digital platforms.

Core symbols most depended-on inside this repo

send_api_request
called by 143
src/nba_api/library/http.py
get_data_sets
called by 139
src/nba_api/stats/endpoints/_parsers/iststandings.py
get_data_sets
called by 28
src/nba_api/stats/library/http.py
get_dict
called by 23
src/nba_api/library/http.py
get_player_data
called by 15
src/nba_api/stats/endpoints/_parsers/boxscoremiscv3.py
get_team_data
called by 13
src/nba_api/stats/endpoints/_parsers/boxscoremiscv3.py
get_team_headers
called by 12
src/nba_api/stats/endpoints/_parsers/boxscoremiscv3.py
get_player_headers
called by 12
src/nba_api/stats/endpoints/_parsers/boxscoremiscv3.py

Shape

Method 916
Class 337
Function 218
Route 8

Languages

Python100%

Modules by API surface

src/nba_api/stats/library/parameters.py136 symbols
tests/unit/stats/endpoints/test_boxscoreplayertrackv3_parser.py36 symbols
tests/unit/stats/endpoints/test_boxscoresummaryv3.py30 symbols
tests/unit/stats/endpoints/test_scheduleleaguev2.py25 symbols
src/nba_api/stats/static/teams.py25 symbols
tests/unit/stats/endpoints/test_gravityleaders_parser.py24 symbols
src/nba_api/stats/endpoints/_parsers/scheduleleaguev2.py24 symbols
tests/unit/stats/endpoints/test_scheduleleaguev2_parser.py21 symbols
src/nba_api/stats/static/players.py21 symbols
src/nba_api/stats/endpoints/_parsers/boxscoresummaryv3.py21 symbols
tests/unit/test_playbyplayregex.py18 symbols
tests/unit/stats/endpoints/test_scoreboardv3_parser.py18 symbols

For agents

$ claude mcp add nba_api \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact