Commit cf31803e authored by Florent Viard's avatar Florent Viard Committed by Vincent A

[bp] Detect and raise browser unavailable when service is unavailable

The banque postale website often has temporary unavailabilities of
pages.

When it happens, instead of being redirected to a specific url, the
content of the page is simply rewritten with an unavailability message.

Closes: 186382@sibi 155183@sibi 145247@sibi
parent 99053629
Pipeline #3583 passed with stages
in 15 minutes and 42 seconds
......@@ -19,11 +19,19 @@
# flake8: compatible
from weboob.browser.filters.standard import CleanText
from weboob.browser.pages import HTMLPage
from weboob.exceptions import BrowserUnavailable
class MyHTMLPage(HTMLPage):
def on_load(self):
unavail_msg = CleanText(
'//main/h1[contains(text(), "Le service est momentanément indisponible.")]'
)(self.doc)
if unavail_msg:
raise BrowserUnavailable(unavail_msg)
deconnexion = self.doc.xpath('//iframe[contains(@id, "deconnexion")] | //p[@class="txt" and contains(text(), "Session expir")]')
if deconnexion:
self.browser.do_login()
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