From 618aeae7a58150e9c64279d487ed621b435224bd Mon Sep 17 00:00:00 2001 From: Maxime Gasselin Date: Tue, 26 Jan 2021 11:45:25 +0100 Subject: [PATCH] [caissedepargne] Skip inaccessible accounts These accounts are not accessible and navigation is broken here. The solution here is to do login again and skip them. --- modules/caissedepargne/pages.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/caissedepargne/pages.py b/modules/caissedepargne/pages.py index 5a6b59b48f..8716c99432 100644 --- a/modules/caissedepargne/pages.py +++ b/modules/caissedepargne/pages.py @@ -651,7 +651,17 @@ def _add_account(self, accounts, link, label, account_type, balance, number=None if account.type in (Account.TYPE_LIFE_INSURANCE, Account.TYPE_PERP): account.ownership = AccountOwnership.OWNER - balance = balance or self.get_balance(account) + if not balance: + try: + balance = self.get_balance(account) + except BrowserUnavailable as e: + if 'erreur_technique' in e.response.url: + # Details account are not accessible and navigation is broken here + # This account must be skipped + self.logger.warning('Could not access to %s details: we skip it', account.label) + self.browser.do_login() + return + raise if not empty(balance): account.balance = Decimal(FrenchTransaction.clean_amount(balance)) -- GitLab