A small package to work with the Deutsche Bahn timetables api
Project description
from deutsche_bahn_api.api_authentication import ApiAuthentication
from deutsche_bahn_api.station_helper import StationHelper
from deutsche_bahn_api.timetable_helper import TimetableHelper
api = ApiAuthentication("b47bcf839594dbc0ab1e22b5db9efc61", "89005b9d47fa377c682c13326fbf167f")
success: bool = api.test_credentials()
station_helper = StationHelper()
station_helper.load_stations()
found_stations = station_helper.find_stations_by_lat_long(47.9872898, 7.7262088, 10)
for station in found_stations:
print(station.NAME)
print(station.EVA_NR)
timetable_helper = TimetableHelper(found_stations[0], api)
trains = timetable_helper.get_timetable()
trains_with_changes = timetable_helper.get_timetable_changes(trains)
for train in trains_with_changes:
print(train.__dict__)
print(train.train_changes.__dict__)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
deutsche-bahn-api-1.0.0.tar.gz
(16.1 kB
view hashes)