An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

# Python NS API

[![mypy](https://github.com/evroon/ns-api-python/actions/workflows/mypy.yml/badge.svg)](https://github.com/evroon/ns-api-python/actions/workflows/mypy.yml)
[![pytest](https://github.com/evroon/ns-api-python/actions/workflows/pytest.yml/badge.svg)](https://github.com/evroon/ns-api-python/actions/workflows/pytest.yml)
[![lint](https://github.com/evroon/ns-api-python/actions/workflows/black.yml/badge.svg)](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.