From 9ecf04410e211e5fd916b058ae3f26ed34b4847f Mon Sep 17 00:00:00 2001 From: Quentin Defenouillere Date: Mon, 4 Feb 2019 15:49:50 +0100 Subject: [PATCH] [cragr] Remove assert on account balances Sometimes the JSON does not contain any account balance, or there is no balance at all, and this assert crashes the whole connection because of this. Without the assert, if we could not find the account balance, it will just return NotAvailable instead of keeping the connection in bug. --- modules/cragr/api/pages.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/cragr/api/pages.py b/modules/cragr/api/pages.py index 9fe03a836e..d54b84d31d 100644 --- a/modules/cragr/api/pages.py +++ b/modules/cragr/api/pages.py @@ -245,7 +245,8 @@ def get_account_balances(self): if el.get('typeProduit') == 'assurance': continue value = el.get('solde', el.get('encoursActuel', el.get('valorisationContrat', el.get('montantRestantDu', el.get('capitalDisponible'))))) - assert value is not None, 'Could not find the account balance' + if value is None: + continue account_balances[Dict('idElementContrat')(el)] = float_to_decimal(value) return account_balances -- GitLab