A module for interacting with the Deutsche Bahn onboard APIs
Project description
iceportal_apis
No longer actively developed in favor of the onboardAPIs (PyPI) project which includes APIs for different providers.
Description
This module interacts with the onboard APIs of the Deutsche Bahn ICE trains.
It can do various things from reading the trains' velocity to telling you the distance to and the delay at the next station.
This is an unofficial project and not supported by Deutsche Bahn AG
.
Note, that this module will only work correctly while you are on a train and connected to its WiFi-Hotspot.
However a basic simulation for offline research is also included in this module
Installation
- Available on PyPI
$ python -m pip install iceportal_apis
for the newest (unstable) version install the module from GitHub$ python -m pip install git+https://github.com/felix-zenk/iceportal-apis.git
Usage
Example code is available in the fileexample.py
and other files insamples
.
The basic usage consists of requesting new data from the api, then processing it with the modules functions.
import iceportal_apis as ipa
train = ipa.Train()
while True:
# Request new data from the api
train.refresh()
# Process data
print(train.get_train_type().name)
next_station = train.get_next_station()
. . .
For GUI applications you can also specify automatic api polling
train = ipa.Train(auto_refresh=True)
License
This software is distributed under the MIT License, please see
LICENSE
for detailed information.
API documentation
1. Status API
The Status API is available at https://iceportal.de/api1/rs/status
A sample response can be found at:
iceportal_api.mocking.data.STATIC_STATUS
2. Trip API
The Trip API is available at https://iceportal.de/api1/rs/tripInfo/trip
A sample response can be found at:
iceportal_api.mocking.data.STATIC_TRIP
3. Connections API
The Connecting trains API can be found at https://iceportal.de/api1/rs/tripInfo/connection/{eva_number}
A sample response can be found at:
iceportal_api.mocking.data.STATIC_CONNECTIONS
4. Other APIs
These are other APIs I discovered but didn't investigate in:
4.1. https://iceportal.de/api1/rs/pois/map/{lat_s}/{lon_s}/{lat_e}/{lon_e}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for iceportal_apis-2.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | acda96f57df7731591a9e4b4ecc9f93a1ec4a2927fee334d6e1be3f4f1440075 |
|
MD5 | 15619b8611cfe3fa48b880746923c74f |
|
BLAKE2b-256 | 7fd4e5cd2d41663a4653636e89aa2bab2012ad30932d9d9a23491d871f2e5359 |