Skip to main content

api wrapper for Dutch Railways (NS)

Project description

Query the Dutch railways about your routes, getting info on delays and more. See below for the syntax and example output.

PyPI version PyPI downloads PyPI license Code Health GitHub commits since latest release

Installation

From PyPI

Assuming you already are inside a virtualenv:

pip install nsapi

From Git

Create a new virtualenv (if you are not already in one) and install the necessary packages:

git clone https://github.com/aquatix/ns-api.git
cd ns-api
mkvirtualenv ns-api
pip install -r requirements.txt

Development in Docker

Git clone this repository, use vscode & docker to remote open in a dev container as explained in this howto.

As part of ns-notifications

Alternatively, follow the installation instructions of ns-notifications, which makes extensive use of this library to serve notifications to for example a smartphone. The requirements of both packages can be installed in the same ns-notifications one mentioned in the project; ns-api will be installed through pip from PyPI.

Home Assistant

The very useful Home Assistant home automation software includes an integration for the ns-api. Be sure to check it out.

Also take a look at nsmaps

Bart Römgens created a fascinating contour map called nsmaps based on ns-api. It visualises Dutch railways travel information with OpenLayer 3 contour maps to show how long it takes to get somewhere in the Netherlands by train and bicycle.

Example application

For example, I use the library to push notifications about my route to my phone through Pushbullet. The program I use to do this has its own repository: ns-notifications.

NS API key

To actually be able to query the Nederlandse Spoorwegen API, you need to subscribe. This immediately gives you a primary and secundary key you need for access.

The library uses the reisinformatie API. Here you can try the API for yourself (and look up station names, but the library has the get_stations() function for this too).

The API portal also provides statistics on usage and errors.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nsapi-3.0.5.zip (15.9 kB view details)

Uploaded Source

File details

Details for the file nsapi-3.0.5.zip.

File metadata

  • Download URL: nsapi-3.0.5.zip
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.8

File hashes

Hashes for nsapi-3.0.5.zip
Algorithm Hash digest
SHA256 007035f76a97088b94b0c7c8a0bc3e1456265c02eacc8ef16329814e0f08f7d0
MD5 2fe98985070eb08d4aee141bba149606
BLAKE2b-256 78b9407e96831adcb943f5cb8cde68ac0dc9d1cc54dfcb9d3111558036f07653

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page