๐Ÿš€ Socket Launch Week ๐Ÿš€ Day 2: Introducing Repository Labels and Security Policies.Learn More โ†’
Socket
Sign inDemoInstall
Socket

nstimes

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nstimes

CLI tool to obtain schedule info from the dutch railway services

0.4.8
PyPI
Maintainers
1

PyPI Version Python Version CI/CD

nstimes

Find your next train home while you are in CLI. I used the Dutch Railway Services (Nederlandse Spoorwegen) API to make myself this tool.

Usage:

$ nstimes [OPTIONS] COMMAND [ARGS]...

Options:

  • --version: Print version info
  • --install-completion: Install completion for the current shell.
  • --show-completion: Show completion for the current shell, to copy it or customize the installation.
  • --help: Show this message and exit.

Commands:

  • journey: Provide train type, platform and departure...
  • update-stations-json: Generate stations lookup

nstimes journey

Provide train type, platform and departure times of an A -> B journey

Usage:

$ nstimes journey [OPTIONS]

Options:

  • --start TEXT: Start station [required]
  • --end TEXT: Stop station [required]
  • --token TEXT: Token to talk with the NS API [env var: NS_API_TOKEN; required]
  • --time TEXT: Time to departure (%H:%M) [default: 12:19]
  • --date TEXT: Date to departure (%d-%m-%Y) [default: 15-10-2023]
  • --printer-choice [table|ascii]: [default: ascii]
  • --help: Show this message and exit.

nstimes update-stations-json

Generate stations lookup, should not be neccesary

Usage:

$ nstimes update-stations-json [OPTIONS]

Options:

  • --token TEXT: Token to talk with the NS API [env var: NS_API_TOKEN; required]
  • --path TEXT: Token to talk with the NS API [env var: NS_API_TOKEN; default: /home/erik/dev/ns_cli/nstimes/stations.json]
  • --help: Show this message and exit.

Installation

To install, run the following:

pip install nstimes

To verify, run:

nstimes --version

To install auto-completion, run:

nstimes --install-completion

In order for autocomplete to work, one might need to add this to their .zshrc:

echo -e "\ncompinit -D\n" | tee -a ~/.zshrc
source ~/.zshrc # Reload shell

Obtaining NS token Create an account at the NS API portal. Then create a token here.

Add the token to your shell, for zsh:

echo -e "\nexport NS_API_TOKEN=****\n" | tee -a ~/.zshrc
source ~/.zshrc # Reload shell

Printers By default, this tool prints in ASCII, e.g.:

IC  p. 12 in  4 min (21:37) -> (21:50)
IC  p. 12 in 16 min (21:49) -> (22:02)
SPR p.  4 in 17 min (21:50) -> (22:10)
IC  p. 12 in 34 min (22:07) -> (22:20)
IC  p. 12 in 46 min (22:19) -> (22:32)
SPR p.  4 in 47 min (22:20) -> (22:40)

If you use the --printer-choice table option it prints like:

    Journeys from Utrecht Centraal -> Amersfoort Centraal at
                        24-01-2024 21:32
โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“
โ”ƒ Train โ”ƒ Platform โ”ƒ Leaves in โ”ƒ Departure time โ”ƒ Arrival time โ”ƒ
โ”กโ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฉ
โ”‚ IC    โ”‚       12 โ”‚     4 min โ”‚        (21:37) โ”‚      (21:50) โ”‚
โ”‚ IC    โ”‚       12 โ”‚    16 min โ”‚        (21:49) โ”‚      (22:02) โ”‚
โ”‚ SPR   โ”‚        4 โ”‚    17 min โ”‚        (21:50) โ”‚      (22:10) โ”‚
โ”‚ IC    โ”‚       12 โ”‚    34 min โ”‚        (22:07) โ”‚      (22:20) โ”‚
โ”‚ IC    โ”‚       12 โ”‚    46 min โ”‚        (22:19) โ”‚      (22:32) โ”‚
โ”‚ SPR   โ”‚        4 โ”‚    47 min โ”‚        (22:20) โ”‚      (22:40) โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Keywords

nederland

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts