Message improved

This commit is contained in:
Profitroll 2022-10-06 11:36:18 +02:00
parent ebb21aea8c
commit d49196ff26

View File

@ -36,11 +36,19 @@ class Message():
def __init__(self, data: dict) -> None:
self.affected_stops = []
for stop in data["affectedStops"]["StopLocation"]:
self.affected_stops.append(Stop(stop))
if "affectedStops" in data:
for stop in data["affectedStops"]["StopLocation"]:
self.affected_stops.append(Stop(stop))
self.valid_from_stop = Stop(data["validFromStop"])
self.valid_to_stop = Stop(data["validToStop"])
if "validFromStop" in data:
self.valid_from_stop = Stop(data["validFromStop"])
else:
self.valid_from_stop = None
if "validToStop" in data:
self.valid_to_stop = Stop(data["validToStop"])
else:
self.valid_to_stop = None
self.channels = []
for channel in data["channel"]: