From 6ade6f75541f70ed24fc157e728d93465bb669db Mon Sep 17 00:00:00 2001 From: profitroll Date: Sun, 4 May 2025 23:26:12 +0200 Subject: [PATCH] Fixed altStart and altEnd not being provided causing KeyError --- src/pyrmv/classes/message.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pyrmv/classes/message.py b/src/pyrmv/classes/message.py index 7063e0f..09dbeed 100644 --- a/src/pyrmv/classes/message.py +++ b/src/pyrmv/classes/message.py @@ -81,8 +81,10 @@ class Message: f"{data['validToDate']} {data['validToTime']}", "%Y-%m-%d %H:%M:%S" ) ) - self.date_start_alt: str = data["altStart"] - self.date_end_alt: str = data["altEnd"] + self.date_start_alt: Union[str, None] = ( + None if "altStart" not in data else data["altStart"] + ) + self.date_end_alt: Union[str, None] = None if "altEnd" not in data else data["altEnd"] self.time_modified: Union[datetime, None] = ( None if "modDate" not in data or "modTime" not in data