nstimes


Namenstimes JSON
Version 0.4.8 PyPI version JSON
download
home_pagehttps://github.com/evanraalte/nstimes
SummaryCLI tool to obtain schedule info from the dutch railway services
upload_time2024-01-25 19:43:55
maintainer
docs_urlNone
authorErik van Raalte
requires_python>=3.10,<4.0
licenseMIT
keywords nederland ns spoorwegen nederlandse reisplanner
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
[![PyPI Version](https://img.shields.io/pypi/v/nstimes.svg)](https://pypi.org/project/nstimes)
![Python Version](https://img.shields.io/badge/Python-3.10%20%E2%86%92%203.12-blue)
![CI/CD](https://github.com/evanraalte/nstimes/actions/workflows/actions.yml/badge.svg)


# `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**:

```console
$ 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**:

```console
$ 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**:

```console
$ 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:
```bash
pip install nstimes
```

To verify, run:
```bash
nstimes --version
```

To install auto-completion, run:
```bash
nstimes --install-completion
```

In order for autocomplete to work, one might need to add this to their `.zshrc`:
```bash
echo -e "\ncompinit -D\n" | tee -a ~/.zshrc
source ~/.zshrc # Reload shell
```

**Obtaining NS token**
Create an account at the [NS API portal](https://apiportal.ns.nl/signin).
Then create a token [here](https://apiportal.ns.nl/api-details#api=reisinformatie-api).

Add the token to your shell, for zsh:
```bash
echo -e "\nexport NS_API_TOKEN=****\n" | tee -a ~/.zshrc
source ~/.zshrc # Reload shell
```


**Printers**
By default, this tool prints in ASCII, e.g.:
```bash
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:
```bash
    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) │
└───────┴──────────┴───────────┴────────────────┴──────────────┘
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/evanraalte/nstimes",
    "name": "nstimes",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10,<4.0",
    "maintainer_email": "",
    "keywords": "nederland,NS,spoorwegen,Nederlandse,reisplanner",
    "author": "Erik van Raalte",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/05/17/6f4462e2d97b73aec696ad1f4e5054dfbbeb2b0b0bf261172e349bb04e25/nstimes-0.4.8.tar.gz",
    "platform": null,
    "description": "\n[![PyPI Version](https://img.shields.io/pypi/v/nstimes.svg)](https://pypi.org/project/nstimes)\n![Python Version](https://img.shields.io/badge/Python-3.10%20%E2%86%92%203.12-blue)\n![CI/CD](https://github.com/evanraalte/nstimes/actions/workflows/actions.yml/badge.svg)\n\n\n# `nstimes`\n\nFind your next train home while you are in CLI. I used the Dutch Railway Services (Nederlandse Spoorwegen) API to make myself this tool.\n\n**Usage**:\n\n```console\n$ nstimes [OPTIONS] COMMAND [ARGS]...\n```\n\n**Options**:\n\n* `--version`: Print version info\n* `--install-completion`: Install completion for the current shell.\n* `--show-completion`: Show completion for the current shell, to copy it or customize the installation.\n* `--help`: Show this message and exit.\n\n**Commands**:\n\n* `journey`: Provide train type, platform and departure...\n* `update-stations-json`: Generate stations lookup\n\n## `nstimes journey`\n\nProvide train type, platform and departure times of an A -> B journey\n\n**Usage**:\n\n```console\n$ nstimes journey [OPTIONS]\n```\n\n**Options**:\n\n* `--start TEXT`: Start station  [required]\n* `--end TEXT`: Stop station  [required]\n* `--token TEXT`: Token to talk with the NS API  [env var: NS_API_TOKEN; required]\n* `--time TEXT`: Time to departure (%H:%M)  [default: 12:19]\n* `--date TEXT`: Date to departure (%d-%m-%Y)  [default: 15-10-2023]\n* `--printer-choice [table|ascii]`: [default: ascii]\n* `--help`: Show this message and exit.\n\n## `nstimes update-stations-json`\n\nGenerate stations lookup, should not be neccesary\n\n**Usage**:\n\n```console\n$ nstimes update-stations-json [OPTIONS]\n```\n\n**Options**:\n\n* `--token TEXT`: Token to talk with the NS API  [env var: NS_API_TOKEN; required]\n* `--path TEXT`: Token to talk with the NS API  [env var: NS_API_TOKEN; default: /home/erik/dev/ns_cli/nstimes/stations.json]\n* `--help`: Show this message and exit.\n\n\n\n**Installation**\n\nTo install, run the following:\n```bash\npip install nstimes\n```\n\nTo verify, run:\n```bash\nnstimes --version\n```\n\nTo install auto-completion, run:\n```bash\nnstimes --install-completion\n```\n\nIn order for autocomplete to work, one might need to add this to their `.zshrc`:\n```bash\necho -e \"\\ncompinit -D\\n\" | tee -a ~/.zshrc\nsource ~/.zshrc # Reload shell\n```\n\n**Obtaining NS token**\nCreate an account at the [NS API portal](https://apiportal.ns.nl/signin).\nThen create a token [here](https://apiportal.ns.nl/api-details#api=reisinformatie-api).\n\nAdd the token to your shell, for zsh:\n```bash\necho -e \"\\nexport NS_API_TOKEN=****\\n\" | tee -a ~/.zshrc\nsource ~/.zshrc # Reload shell\n```\n\n\n**Printers**\nBy default, this tool prints in ASCII, e.g.:\n```bash\nIC  p. 12 in  4 min (21:37) -> (21:50)\nIC  p. 12 in 16 min (21:49) -> (22:02)\nSPR p.  4 in 17 min (21:50) -> (22:10)\nIC  p. 12 in 34 min (22:07) -> (22:20)\nIC  p. 12 in 46 min (22:19) -> (22:32)\nSPR p.  4 in 47 min (22:20) -> (22:40)\n```\nIf you use the `--printer-choice table` option it prints like:\n```bash\n    Journeys from Utrecht Centraal -> Amersfoort Centraal at\n                        24-01-2024 21:32\n\u250f\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n\u2503 Train \u2503 Platform \u2503 Leaves in \u2503 Departure time \u2503 Arrival time \u2503\n\u2521\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2529\n\u2502 IC    \u2502       12 \u2502     4 min \u2502        (21:37) \u2502      (21:50) \u2502\n\u2502 IC    \u2502       12 \u2502    16 min \u2502        (21:49) \u2502      (22:02) \u2502\n\u2502 SPR   \u2502        4 \u2502    17 min \u2502        (21:50) \u2502      (22:10) \u2502\n\u2502 IC    \u2502       12 \u2502    34 min \u2502        (22:07) \u2502      (22:20) \u2502\n\u2502 IC    \u2502       12 \u2502    46 min \u2502        (22:19) \u2502      (22:32) \u2502\n\u2502 SPR   \u2502        4 \u2502    47 min \u2502        (22:20) \u2502      (22:40) \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "CLI tool to obtain schedule info from the dutch railway services",
    "version": "0.4.8",
    "project_urls": {
        "Homepage": "https://github.com/evanraalte/nstimes",
        "Repository": "https://github.com/evanraalte/nstimes"
    },
    "split_keywords": [
        "nederland",
        "ns",
        "spoorwegen",
        "nederlandse",
        "reisplanner"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e9ea32500269f598fa3096d3a57f4d78ca25c6a1cc276ddd8ab3323638b2bc8a",
                "md5": "e69c7324dab882b44ed6545ee4868e08",
                "sha256": "177787dfd43567f9bae3dcb1837eccd597195465a7c259b165c423a9d2aff4ae"
            },
            "downloads": -1,
            "filename": "nstimes-0.4.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e69c7324dab882b44ed6545ee4868e08",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10,<4.0",
            "size": 11596,
            "upload_time": "2024-01-25T19:43:53",
            "upload_time_iso_8601": "2024-01-25T19:43:53.646770Z",
            "url": "https://files.pythonhosted.org/packages/e9/ea/32500269f598fa3096d3a57f4d78ca25c6a1cc276ddd8ab3323638b2bc8a/nstimes-0.4.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "05176f4462e2d97b73aec696ad1f4e5054dfbbeb2b0b0bf261172e349bb04e25",
                "md5": "5db92b764fd5aef43b2dab3b9af1bc46",
                "sha256": "d3bc0013fb461295593d14a1b904350eda7d3d8d93ad47f4435e17486f25ca21"
            },
            "downloads": -1,
            "filename": "nstimes-0.4.8.tar.gz",
            "has_sig": false,
            "md5_digest": "5db92b764fd5aef43b2dab3b9af1bc46",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10,<4.0",
            "size": 10869,
            "upload_time": "2024-01-25T19:43:55",
            "upload_time_iso_8601": "2024-01-25T19:43:55.066851Z",
            "url": "https://files.pythonhosted.org/packages/05/17/6f4462e2d97b73aec696ad1f4e5054dfbbeb2b0b0bf261172e349bb04e25/nstimes-0.4.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-25 19:43:55",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "evanraalte",
    "github_project": "nstimes",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "nstimes"
}
        
Elapsed time: 0.21911s