From 5056cfbf505538c04609bbebd87eb0b587a72560 Mon Sep 17 00:00:00 2001 From: yidwy Date: Mon, 28 Jun 2021 10:08:52 +0200 Subject: [PATCH] [bp] added an error_message condition on get_loans --- modules/bp/browser.py | 8 ++++++-- modules/bp/pages/accountlist.py | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/modules/bp/browser.py b/modules/bp/browser.py index c556ab9d3d..84b99c928f 100644 --- a/modules/bp/browser.py +++ b/modules/bp/browser.py @@ -650,10 +650,14 @@ def get_loans(self, account): student_loan.currency = account.currency loans.append(student_loan) else: + # The main revolving page is not accessible, we can reach it by this new way self.go_revolving() - revolving_loan = self.page.get_revolving_attributes(account) - loans.append(revolving_loan) + if self.page.get_error(): + self.logger.warning('Details are not available for this revolving account: %s', account.id) + else: + revolving_loan = self.page.get_revolving_attributes(account) + loans.append(revolving_loan) return loans @retry(BrowserUnavailable, delay=5) diff --git a/modules/bp/pages/accountlist.py b/modules/bp/pages/accountlist.py index 5fc6e2d0d9..a2674cf0e8 100644 --- a/modules/bp/pages/accountlist.py +++ b/modules/bp/pages/accountlist.py @@ -654,3 +654,6 @@ def get_revolving_attributes(self, account): loan._has_cards = False loan.type = Account.TYPE_REVOLVING_CREDIT return loan + + def get_error(self): + return CleanText('//td[contains(text(), "momentanément indisponible.")]')(self.doc) -- GitLab