diff --git a/pyrmv/classes/Trip.py b/pyrmv/classes/Trip.py index d6eced9..cc463ab 100644 --- a/pyrmv/classes/Trip.py +++ b/pyrmv/classes/Trip.py @@ -19,9 +19,18 @@ class Trip(): self.id = data["tripId"] self.ctx_recon = data["ctxRecon"] self.duration = parse_duration(data["duration"]) - self.real_time_duration = parse_duration(data["rtDuration"]) + + if "rtDuration" in data: + self.real_time_duration = parse_duration(data["rtDuration"]) + else: + self.real_time_duration = None + self.checksum = data["checksum"] - self.transfer_count = data["transferCount"] + + if "transferCount" in data: + self.transfer_count = data["transferCount"] + else: + self.transfer_count = 0 def __str__(self) -> str: return f"Trip from {self.origin.name} to {self.destination.name} lasting {self.duration} ({self.real_time_duration}) with {len(self.legs)} legs and {self.transfer_count} transfers" \ No newline at end of file