Closed asraelvudogel closed 1 year ago
Hey, sorry for the last response.
There is a way to check if the train is canceled or not.
If a train got canceled, the stations for the trains are set to an empty string.
The Train object represents the planned data, and the train changes property the changed data.
That means you must be checking if the property train.train_changes.stations
is an empty string.
Below I provided you an example.
timetable_helper = TimetableHelper(found_stations_by_name[1], api)
trains = timetable_helper.get_timetable(13)
trains = timetable_helper.get_timetable_changes(trains)
for train in trains:
print(train.train_type + " " + train.train_line + " - " + train.departure + " (" + train.platform + ")")
try:
if len(train.train_changes.stations) == 0:
print("Train is canceled")
except AttributeError:
pass
Hi,
thanks for the great interface. I haven't found a way to filter out canceled trains yet. The API only outputs a message, which is not decoded in your code, so I can read it or filter out the train.
Example for such a train: