A command line interface for the National Statistical API
Project description
natstat-cli
A command line interface for the National Statistical API
Installation
The CLI can be installed with pip.
git clone https://github.com/jhelderman/natstat-cli.git
cd natstat-cli
pip install .
Configuration
This CLI requires an API key for National Statistical. This can be acquired from the NatStat website. The API key is configured with an environment variable.
export NATSTAT_API_KEY=change-me
Usage
The CLI has a subcommand for each endpoint. These can be seen in the help message for the base command.
❯ natstat --help
Usage: natstat [OPTIONS] COMMAND [ARGS]...
Query the NatStat API
Options:
--help Show this message and exit.
Commands:
games Game data
leaguecodes League codes
moneyline Moneyline records
overunder Over/Under records
playbyplay Play-by-play data
playerperfs Player performance data
players Player data
pointspread Point spread records
seasons Season info
teamcodes Team codes
teamperfs Team performance data
teams Team data
venues Venue data
Each subcommand has a help message that shows the available options.
natstat games --help
The following command queries for the NBA games that were played on 2025-11-23. Results are output to the standard output in CSV format.
natstat games --date 2025-11-23 --service nba
NatStat responses are paginated to limit the number of records per response. This CLI automatically requests all the pages for a given request. For example, the following command will fetch the NBA game data for the 2022 season.
natstat games --season 2022 --service nba
To disable this behavior and only fetch one page, pass the --one-page
flag.
natstat games --season 2022 --service nba --one-page
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file natstat_cli-0.1.0.tar.gz.
File metadata
- Download URL: natstat_cli-0.1.0.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa417aa9f331c3f9316f1dc5ac75337017e743c0fafef63bf32a2c0c9070c827
|
|
| MD5 |
87af409474ea34570f4b247abd05e065
|
|
| BLAKE2b-256 |
80340ff1f06221dcca5c0b74b14345f92fe862361a847c745f20f0ffd355c104
|
File details
Details for the file natstat_cli-0.1.0-py3-none-any.whl.
File metadata
- Download URL: natstat_cli-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c2711d7f32bdb86dcd6e6ed182e7588b8d999eb6c8ad9bb4af956d67c34f0b17
|
|
| MD5 |
2054ada94bd2c9c907e0d4d4b4979c86
|
|
| BLAKE2b-256 |
1edac5cc20abbc399dc4e2f3fc29284a6034bad6901259e6f1791d166db0e311
|