Skip to main content
Join the official 2020 Python Developers SurveyStart the survey!

Get all NBA player data into JSON format

Project description

NBA Player Data into JSON

Installation

pip install nba-player

Usage

import datanba

Get All Players

data = datanba.player_stats.AllOfBasketball(arr)

arr is the years that you want in the normal year format for NBA (i.e ["2018-19"])

To get all player data into JSON

data = datanba.player_stats.AllOfBasketball(["2018-19"])
data.gather("players.json", exists=False)

Only use this if you have nothing in your players.json file or it does not exist at all.

However, since you will be polling a lot, you might have your connection work or the NBA stats API will limit you, so if scraping stops in the middle, you can change your code to:

data = datanba.player_stats.AllOfBasketball(["2018-19"])
data.gather("players.json", exists=True)

Then, scraping will continue from where it left off.

Use Player JSON data

After polling once, you can reuse the output form the JSON file as long as you would like(until the data that you have polled has become old), by using these commands.

import datanba.player_stats as datanba
data = datanba.AllOfBasketball(["2018-19"])
players = data.players_from_json('players.json')

Now you have all NBA players in your players variable.

Project details


Download files

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

Files for nba-player, version 0.6.8
Filename, size File type Python version Upload date Hashes
Filename, size nba_player-0.6.8-py3-none-any.whl (11.7 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size nba_player-0.6.8.tar.gz (6.1 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page