Added one more check for correct response return

This commit is contained in:
Profitroll 2023-01-04 10:35:33 +01:00
parent f8b13ccedf
commit 6b6299cd0a

View File

@ -301,8 +301,9 @@ class Client():
find_exception(messages_raw) find_exception(messages_raw)
for message in messages_raw["Message"]: if "Message" in messages_raw:
messages.append(Message(message)) for message in messages_raw["Message"]:
messages.append(Message(message))
return messages return messages
@ -402,11 +403,12 @@ class Client():
find_exception(stops_raw) find_exception(stops_raw)
for stop in stops_raw["stopLocationOrCoordLocation"]: if "stopLocationOrCoordLocation" in stops_raw:
if "StopLocation" in stop: for stop in stops_raw["stopLocationOrCoordLocation"]:
stops.append(Stop(stop["StopLocation"])) if "StopLocation" in stop:
elif "CoordLocation" in stop: stops.append(Stop(stop["StopLocation"]))
stops.append(Stop(stop["CoordLocation"])) elif "CoordLocation" in stop:
stops.append(Stop(stop["CoordLocation"]))
return stops return stops
@ -504,11 +506,12 @@ class Client():
find_exception(stops_raw) find_exception(stops_raw)
for stop in stops_raw["stopLocationOrCoordLocation"]: if "stopLocationOrCoordLocation" in stops_raw:
if "StopLocation" in stop: for stop in stops_raw["stopLocationOrCoordLocation"]:
stops.append(Stop(stop["StopLocation"])) if "StopLocation" in stop:
elif "CoordLocation" in stop: stops.append(Stop(stop["StopLocation"]))
stops.append(Stop(stop["CoordLocation"])) elif "CoordLocation" in stop:
stops.append(Stop(stop["CoordLocation"]))
return stops return stops
@ -697,8 +700,9 @@ class Client():
find_exception(trips_raw) find_exception(trips_raw)
for trip in trips_raw["Trip"]: if "Trip" in trips_raw:
trips.append(Trip(trip)) for trip in trips_raw["Trip"]:
trips.append(Trip(trip))
return trips return trips
@ -770,7 +774,8 @@ class Client():
find_exception(trips_raw) find_exception(trips_raw)
for trip in trips_raw["Trip"]: if "Trip" in trips_raw:
trips.append(Trip(trip)) for trip in trips_raw["Trip"]:
trips.append(Trip(trip))
return trips return trips