Skip to content

Commit

Permalink
Merge pull request #81 from gjohansson-ST/fix-console-script
Browse files Browse the repository at this point in the history
Fix console script
  • Loading branch information
gjohansson-ST committed Jul 3, 2024
2 parents 6b1f432 + ab9ffab commit f2b525f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
23 changes: 13 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ python module for communicating with the swedish trafikverket api
Development and testing done with 3.11

## Code example

```python
from pytrafikverket import TrafikverketTrain, StationInfo
import aiohttp
Expand Down Expand Up @@ -34,14 +35,16 @@ loop.run_until_complete(main(loop))
```

## CLI example
```bash
$ py pytrafikverket.py -key <api_key> -method search-for-station -station "Kristianstad"
$ py pytrafikverket.py -key <api_key> -method get-next-train-stop -from-station "Kristianstad C" -to-station "Sölvesborg"
$ py pytrafikverket.py -key <api_key> -method get-next-train-stop -from-station "Kristianstad C" -to-station "Sölvesborg" -train-product "SJ Regional"
$ py pytrafikverket.py -key <api_key> -method get-train-stop -from-station "Kristianstad C" -to-station "Sölvesborg" -date-time "2017-05-19T16:38:00"
$ py pytrafikverket.py -key <api_key> -method get-weather -station "Nöbbele"
$ py pytrafikverket.py -key <api_key> -method search-for-ferry-route -route "sund"
$ py pytrafikverket.py -key <api_key> -method get-ferry-route -route "Adelsöleden"
$ py pytrafikverket.py -key <api_key> -method get-next-ferry-stop -from-harbor "Ekerö"
$ py pytrafikverket.py -key <api_key> -method get-next-ferry-stop -from-harbor "Furusund" -date-time "2019-12-24T00:00:00"
<!-- blacken-docs:off -->
```python
trafikverket_cli -key <api_key> -method search-for-station -station "Kristianstad"
trafikverket_cli -key <api_key> -method get-next-train-stop -from-station "Kristianstad C" -to-station "Sölvesborg"
trafikverket_cli -key <api_key> -method get-next-train-stop -from-station "Kristianstad C" -to-station "Sölvesborg" -train-product "SJ Regional"
trafikverket_cli -key <api_key> -method get-train-stop -from-station "Kristianstad C" -to-station "Sölvesborg" -date-time "2017-05-19T16:38:00"
trafikverket_cli -key <api_key> -method get-weather -station "Nöbbele"
trafikverket_cli -key <api_key> -method search-for-ferry-route -route "sund"
trafikverket_cli -key <api_key> -method get-ferry-route -route "Adelsöleden"
trafikverket_cli -key <api_key> -method get-next-ferry-stop -from-harbor "Ekerö"
trafikverket_cli -key <api_key> -method get-next-ferry-stop -from-harbor "Furusund" -date-time "2019-12-24T00:00:00"
```
<!-- blacken-docs:on -->
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ packages = [
]

[tool.poetry.scripts]
pytrafikverket = "pytrafikverket:main"
trafikverket_cli = "pytrafikverket:run"

[tool.poetry.dependencies]
python = "^3.11"
Expand Down
6 changes: 6 additions & 0 deletions pytrafikverket/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,9 @@
TrafikverketTrain,
)
from .trafikverket_weather import TrafikverketWeather

from .__main__ import main


def run() -> None:
main()

0 comments on commit f2b525f

Please sign in to comment.