Commit 183f4fba authored by Damien Mat's avatar Damien Mat Committed by Vincent A

[creditdunord/courtois] Fix redirect blocking connections

Attempt to access to ProAccountsPage can lead instead to RedirectPage,
where we can follow a link. It leads to a code 200 page even when
bearing a 'erreur-404' in the URL.
This happens only on certain connections as a wrongly activated
security feature of the server, as discussed directly with the bank,
when there is no accounts on the aimed page.
We need to pass through not to block the connection
parent e7be3679
......@@ -27,7 +27,7 @@ from weboob.tools.capabilities.bank.investments import create_french_liquidity
from .pages import (
LoginPage, ProfilePage, AccountTypePage, AccountsPage, ProAccountsPage,
TransactionsPage, IbanPage, RedirectPage, EntryPage, AVPage, ProIbanPage,
ProTransactionsPage, LabelsPage, RgpdPage, LoginConfirmPage,
ProTransactionsPage, LabelsPage, RgpdPage, LoginConfirmPage, NotFoundPage,
)
......@@ -41,7 +41,8 @@ class CreditDuNordBrowser(LoginBrowser):
LoginPage)
login_confirm = URL(r'/sec/vk/authent.json', LoginConfirmPage)
labels_page = URL(r'/icd/zco/data/public-menu.json', LabelsPage)
redirect = URL('/swm/redirectCDN.html', RedirectPage)
redirect = URL('/swm/redirectCDN.html', '/swm/errorWebCDN.html', RedirectPage)
not_found = URL('/sites/erreur-404', NotFoundPage)
entrypage = URL('/icd/zco/#zco', EntryPage)
multitype_av = URL('/vos-comptes/IPT/appmanager/transac/professionnels\?_nfpb=true&_eventName=onRestart&_pageLabel=synthese_contrats_assurance_vie', AVPage)
loans = URL(r'/vos-comptes/IPT/appmanager/transac/(?P<account_type>.*)\?_nfpb=true&_eventName=onRestart&_pageLabel=(?P<loans_page_label>(creditPersoImmobilier|credit_?_en_cours))', ProAccountsPage)
......@@ -91,8 +92,9 @@ class CreditDuNordBrowser(LoginBrowser):
def _iter_accounts(self):
owner_name = self.get_profile().name.upper()
self.loans.go(account_type=self.account_type, loans_page_label=self.loans_page_label)
for a in self.page.get_list():
yield a
if self.loans.is_here():
for a in self.page.get_list():
yield a
self.accounts.go(account_type=self.account_type, accounts_page_label=self.accounts_page_label)
self.multitype_av.go()
if self.multitype_av.is_here():
......
......@@ -107,7 +107,6 @@ class HTMLErrorPage(HTMLPage):
CleanText('//div[has-class("x-attentionErreur")]/b')(self.doc)
class RedirectPage(HTMLPage):
def on_load(self):
link = Regexp(CleanText('//script'), 'href="(.*)"', default='')(self.doc)
......@@ -115,6 +114,19 @@ class RedirectPage(HTMLPage):
self.browser.location(link)
class NotFoundPage(HTMLPage):
"""
Attempt to access to ProAccountsPage can lead
instead to RedirectPage, leading this page.
It is a code 200 request but bear a 'erreur-404' in the URL
We need to pass through not to block the connection.
This happens only on certain connections as a wrongly activated
security feature of the server,
when there is no accounts on the aimed page.
"""
pass
class EntryPage(LoggedPage, HTMLErrorPage):
pass
......
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