Documentation¶
- Data Loaders
- Objects
- Resources
Client¶
Instantiating a Client object will load data loader objects
for resources specified in settings dict.
The following code will instantiate the client and get Possession data
for game id 0021900001 from files in /response_data subdirectories
from pbpstats.client import Client
settings = {
"dir": "/response_data",
"Possessions": {"source": "file", "data_provider": "stats_nba"}
}
client = Client(settings)
game = client.Game('0021900001')
for possession in game.possessions.items:
print(possession)
-
class
pbpstats.client.Client(settings)[source]¶ Bases:
objectParameters: settings (dict) – Dict with data that specifies which data loaders should be used. dirkey is optional, but recommended and should point to the directory you have set up that either already contains response data or where you want to store the response data. Other keys in the settings dict should be resources from theresourcesmodule and their values should be a dict withsource(‘file’ or ‘web’) anddata_provider(‘stats_nba’ or ‘data_nba’ or ‘live’)