From 9cc655a6a163a79dca4685905036118854ca7127 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Wed, 20 Apr 2022 20:46:19 +0100 Subject: [PATCH] Handle empty transactions response --- handler/sinks/nordigen.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/handler/sinks/nordigen.py b/handler/sinks/nordigen.py index a271bd5..62d5be9 100644 --- a/handler/sinks/nordigen.py +++ b/handler/sinks/nordigen.py @@ -355,7 +355,11 @@ class Nordigen(util.Base): except ValidationError as err: self.log.error(f"Validation error: {err}") return - parsed = obj.to_dict()["transactions"]["booked"] + parsed_obj = obj.to_dict() + if "transactions" not in parsed_obj: + self.log.warning(f"No transactions for account: {account_id}") + return {} + parsed = parsed_obj["transactions"]["booked"] self.normalise_transactions(parsed) return parsed