Handle empty transactions response

This commit is contained in:
Mark Veidemanis 2022-04-20 20:46:19 +01:00
parent e53721da8c
commit 9cc655a6a1
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
1 changed files with 5 additions and 1 deletions

View File

@ -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