https://github.com/evroon/ns-api-python
Simple Python wrapper of the NS API
https://github.com/evroon/ns-api-python
api-wrapper ns pydantic python requests
Last synced: about 1 year ago
JSON representation
Simple Python wrapper of the NS API
- Host: GitHub
- URL: https://github.com/evroon/ns-api-python
- Owner: evroon
- Created: 2021-11-13T16:19:43.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-11-02T18:20:51.000Z (over 3 years ago)
- Last Synced: 2025-02-07T19:33:36.335Z (over 1 year ago)
- Topics: api-wrapper, ns, pydantic, python, requests
- Language: Python
- Homepage:
- Size: 36.1 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Python NS API
[](https://github.com/evroon/ns-api-python/actions/workflows/mypy.yml)
[](https://github.com/evroon/ns-api-python/actions/workflows/pytest.yml)
[](https://github.com/evroon/ns-api-python/actions/workflows/black.yml)
This project serves as a simple Python client of the [NS API](https://apiportal.ns.nl).
The reponses are stored in Pydantic models, enabling easy manipulation and validation of the data.
## Setup
Get a (free) API key from NS (see the [startersguide](https://apiportal.ns.nl/startersguide)).
Create a file called `.env` with the following content: (see `sample.env`)
```bash
API_KEY=""
```
## Usage
Run `python3 main.py --help` to see a list of commands.
It is recommended to first run `python3 main.py stations` to retrieve (and store) a list of all stations.