Commit 8dea2985 authored by Martin Morlot's avatar Martin Morlot Committed by VA

[creditdunord/smc] Returned BrowserUnavailable for the case of a page that is...

[creditdunord/smc] Returned BrowserUnavailable for the case of a page that is temporarily unavailable.

On rare occasions, the life insurance pages would return error. This MR handles when this might occur.

Closes: 12424@zendesk, 37335@sibi.
parent e9c39278
Pipeline #161603 passed with stages
in 4 minutes and 31 seconds
......@@ -20,7 +20,7 @@
from __future__ import unicode_literals
from weboob.browser import LoginBrowser, URL, need_login
from weboob.exceptions import BrowserIncorrectPassword, BrowserPasswordExpired, ActionNeeded
from weboob.exceptions import BrowserIncorrectPassword, BrowserPasswordExpired, ActionNeeded, BrowserUnavailable
from weboob.capabilities.bank import Account
from weboob.capabilities.base import find_object
from weboob.tools.capabilities.bank.investments import create_french_liquidity
......@@ -94,6 +94,8 @@ class CreditDuNordBrowser(LoginBrowser):
for a in self.page.get_av_accounts():
self.location(a._link, data=a._args)
self.location(a._link.replace("_attente", "_detail_contrat_rep"), data=a._args)
if self.page.get_error():
raise BrowserUnavailable(self.page.get_error())
self.page.fill_diff_currency(a)
yield a
self.accounts.go(account_type=self.account_type, accounts_page_label=self.accounts_page_label)
......
......@@ -743,6 +743,9 @@ class TransactionsPage(LoggedPage, CDNBasePage):
class ProTransactionsPage(TransactionsPage):
TRANSACTION = Transaction
def get_error(self):
return CleanText('//b[contains(text(), "momentanément indisponible")]')(self.doc)
def get_next_args(self, args):
if len(self.doc.xpath('//a[contains(text(), "Suivant")]')) > 0:
args['PageDemandee'] = int(args.get('PageDemandee', 1)) + 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment