Skip to main content

A lightweight, dynamic Python client to pull NBA data from

Project description

dlo is a lightweight, dynamic Python client to pull NBA data from


This client utilizes error messages from the API to:

  • check whether parameter passed is valid
  • check whether endpoint is valid or possibly deprecated
  • return list of parameters for endpoint
  • return list of possible values for any parameters and whether required for endpoint
  • automatically pass required parameters with default value if not given

It is possible to build a documentation of the API given possible endpoints with this client.

Inspired by nba_py.


# stable version
pip install dlo

# latest version
git clone
cd ./dlo
pip install .



A list of endpoints can be found here. IDs (PlayerID, GameID, etc.) can be found on

>>> from dlo import Data                            # import module
>>> LOCAL = {                                       # set local parameters
... "PlayerID": 1626156,
... "Season": "2018-19",
... "SeasonType": "Regular Season"
... }
>>> d = Data(**LOCAL)                               # create instance of Data class with local parameters
>>> d.local = LOCAL                                 # another way to pass local parameters (recommended; deletes previous local parameters)
>>> d.local                                         # returns local parameters passed
{"PlayerID": 1626156, "Season": "2018-19", "SeasonType": "Regular Season"}
>>> d.endpoint = "playergamelog"                    # set endpoint
>>> d.endpoint                                      # returns current endpoint
>>> d.getEndpointParams()                           # returns list of parameters for current endpoint
['PlayerID', 'Season', 'SeasonType']
>>> d.getParamInfo("SeasonType")                    # returns list of values for parameter and whether required
{'regex': '^(Regular Season)|(Pre Season)|(Playoffs)|(All-Star)|(All Star)$', 'values': ['Regular Season', 'Pre Season', 'Playoffs', 'All-Star', 'All Star'], 'required': True}
>>> d.getParam("Season")                            # returns parameter value if passed
>>> d.removeParam("Season")                         # value for Season (2018-19) removed
>>> d.setParam("Season", "2018-19")                 # two ways to set/add parameters
>>> d.Season = "2018-19"
>>> data = d.getData()                              # returns data (game log of D'Angelo Russell for the 2018-19 Regular Season)
>>> data_in_pandas_format = d.getData(pandify=True)

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 dlo, version 0.2.1
Filename, size File type Python version Upload date Hashes
Filename, size dlo-0.2.1.tar.gz (6.7 kB) File type Source Python version None Upload date Hashes View
Filename, size dlo-0.2.1-py3-none-any.whl (16.9 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page