The new woob repository is here: https://gitlab.com/woob/woob. This gitlab will be removed soon.

Commit d3389faa authored by Ilyas Semmaoui's avatar Ilyas Semmaoui Committed by Vincent A

[banquepopulaire] raise BrowserUnavailable for unavailable account history

parent c6091ad2
......@@ -48,7 +48,7 @@
LineboursePage, AlreadyLoginPage, InvestmentPage,
NewLoginPage, JsFilePage, AuthorizePage, LoginTokensPage, VkImagePage,
AuthenticationMethodPage, AuthenticationStepPage, CaissedepargneVirtKeyboard,
AccountsNextPage, GenericAccountsPage, InfoTokensPage,
AccountsNextPage, GenericAccountsPage, InfoTokensPage, NatixisUnavailablePage,
)
from .document_pages import BasicTokenPage, SubscriberPage, SubscriptionsPage, DocumentsPage
from .linebourse_browser import LinebourseAPIBrowser
......@@ -237,6 +237,10 @@ class BanquePopulaire(LoginBrowser):
r'https://www.assurances.natixis.fr/etna-ihs-bp/#/equipement;codeEtab=.*\?windowId=.*',
NatixisErrorPage
)
natixis_unavailable_page = URL(
r'https://www.assurances.natixis.fr/espaceinternet-bp/page500.xhtml',
NatixisUnavailablePage
)
natixis_invest = URL(
r'https://www.assurances.natixis.fr/espaceinternet-bp/rest/v2/contratVie/load/(?P<id1>\w+)/(?P<id2>\w+)/(?P<id3>\w+)',
NatixisInvestPage
......@@ -936,6 +940,8 @@ def get_invest_history(self, account):
except ServerError:
return
else:
if self.natixis_unavailable_page.is_here():
raise BrowserUnavailable(self.page.get_message())
history = list(self.page.get_history())
history.sort(reverse=True, key=lambda item: item.date)
for tr in history:
......
......@@ -1274,6 +1274,11 @@ class NatixisErrorPage(LoggedPage, HTMLPage):
pass
class NatixisUnavailablePage(LoggedPage, HTMLPage):
def get_message(self):
return CleanText('//label')(self.doc)
class IbanPage(LoggedPage, MyHTMLPage):
def need_to_go(self):
return len(self.doc.xpath('//div[@class="grid"]/div/span[contains(text(), "IBAN")]')) == 0
......
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