Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

A nba stats client

Project Description

NBA Stats Client

Introduction

Getting (free) NBA statistics, even the most basic, can be a real pain. Luckily, the NBA Stats API (base uri: http://stats.nba.com/stats/)
can provide many of these statistics. This project, and more specifically, this client, serves as an abstraction on top
of the NBA Stats API.

Challenges

Unfortunately, the NBA Stats API makes no guarantees about uptime, breaking changes, and does not have much (i.e. any)
documentation around it, so identifying all the available endpoints and their implementation is non-trivial.

Thus, due to these contraints this client is only as dependable and consistent as the NBA Stats service.

Additionally, this client is by no means complete, and will be in active development.

Client API Details

Installation

This project is available on PyPi.

To install

pip install nba_data

API Methods

  • get_players_for_season(season, league=League.nba, current_season_only=CurrentSeasonOnly.yes)
  • get_games_for_team(season, team, season_type=SeasonType.regular_season)
  • get_player_info(player_id)
  • get_advanced_box_score(game_id)

API Method Parameters

  • season: A Season enum value. Represents the specific season to query for.
  • league: A League enum value. Generally speaking, will always want to use League.nba.
  • current_season_only: A CurrentSeasonOnly enum value. When yes, disregards the sesaon parameter and returns all players across all seasons
  • season_type: A SeasonType enum value that represents which section of a season to query (regular season, playoffs, etc.)
  • player_id: The unique id that NBA Stats assigns to each player.
  • game_id: The unique id that NBA Stats assigns to each game.

Example Usage

Get Players For Season

from nba_data import Client
from nba_data import CurrentSeasonOnly
from nba_data import Season


def get_players_for_2015_season():
    return Client.get_players_for_season(season=Season.season_2015)


def get_players_for_every_season():
    return Client.get_players_for_season(season=Season.season_2015, current_season_only=CurrentSeasonOnly.no)

Get Games For Team

```python
from nba_data import Client
from nba_data import Season
from nba_data import SeasonType
from nba_data import Team
def get_regular_season_games_for_2015_boston_celtics():
return Client.get_games_for_team(season=Season.season_2015, team=Team.boston_celtics)
def get_playoff_for_2015_boston_celtics():
return Client.get_games_for_team(season=Season.season_2015, team=Team.boston_celtics, season_type=S
Release History

Release History

This version
History Node

1.9

History Node

1.8.1

History Node

1.8

History Node

1.8.0

History Node

1.7

History Node

1.6

History Node

1.5

History Node

1.4

History Node

1.3

History Node

1.2

History Node

1.1

History Node

1.0

History Node

0.9

History Node

0.8

History Node

0.7

History Node

0.6

History Node

0.5

History Node

0.4

History Node

0.3

History Node

0.2

History Node

0.1

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
nba_data-1.9.tar.gz (19.0 kB) Copy SHA256 Checksum SHA256 Source Apr 30, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting