- Python 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| database | ||
| .gitignore | ||
| get_rmv.py | ||
| prepare_rmv_keys.py | ||
| README.md | ||
| requirements.txt | ||
| station_ids.json | ||
seb-bahn-py
This repository holds the python script to get current live data from rmv api and get the relevant journey ids for each trip based on the dienstplan.
Credits to seb for creating the pdf extractor.
Usage
For both scripts, you need to have a rmv api key in your environment as RMV_API_KEY. And you need the python packages of requirements.txt. (This file was created automatically, you need to have at least requests and camelot-py)
Preparation
Before running the actual tracker script, you need to create (or fill) the journey_ids.json. For that purpose, there exists
the script prepare_rmv_keys.py.
- Put the dienstplan as
dienstplan.pdfin this directory - Make sure that you have
station_ids.jsonwith all relevant stations. - Make sure to have a file called
journey_ids.jsonwith at least{} - Run
python prepare_rmv_keys.py
This script outputs the signal message (done by sebi) and fills in the journey_ids.json in the background.
This json file can be simply out on the server to be tracked automatically. The date is included to reduce
the number of api calls to only the journeys of today.
Tracker
To track the journeys created by prepare_rmv_keys.py, you can use the script get_rmv.py.
- Make sure to have the file
journey_ids.jsonin the same directory asget_rmv.py - Make sure to have a directory called
jsonsin the same directory. - Run
python get_rmv.py