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: def __init__(self, data: dict) -> None:
self.affected_stops = [] self.affected_stops = []
for stop in data["affectedStops"]["StopLocation"]: if "affectedStops" in data:
self.affected_stops.append(Stop(stop)) for stop in data["affectedStops"]["StopLocation"]:
self.affected_stops.append(Stop(stop))
self.valid_from_stop = Stop(data["validFromStop"]) if "validFromStop" in data:
self.valid_to_stop = Stop(data["validToStop"]) 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 = [] self.channels = []
for channel in data["channel"]: for channel in data["channel"]: