Commit f4937c32 authored by Florian Duguet's avatar Florian Duguet Committed by Vincent A

[ameli] raise BrowserUnavailable in ErrorPage.on_load

we can be redirected on this page anywhere, not just at login
parent fba22b3e
......@@ -28,7 +28,7 @@
from dateutil.relativedelta import relativedelta
from woob.browser import LoginBrowser, URL, need_login
from woob.exceptions import ActionNeeded, BrowserIncorrectPassword, BrowserUnavailable
from woob.exceptions import ActionNeeded, BrowserIncorrectPassword
from import merge_iterators
from .pages import (
......@@ -86,9 +86,6 @@ def do_login(self):
raise BrowserIncorrectPassword(err_msg)
raise AssertionError('Unhandled error at login %s' % err_msg)
if self.error_page.is_here():
raise BrowserUnavailable(
if self.cgu_page.is_here():
raise ActionNeeded(
......@@ -30,6 +30,7 @@
from woob.browser.filters.json import Dict
from woob.browser.pages import LoggedPage, HTMLPage, PartialHTMLPage, RawPage, JsonPage
from woob.capabilities.bill import Subscription, Bill, Document, DocumentTypes
from woob.exceptions import BrowserUnavailable
from import html_unescape
from import parse_french_date
from import json
......@@ -71,8 +72,10 @@ def get_cgu_message(self):
class ErrorPage(HTMLPage):
def get_error_message(self):
return html_unescape(CleanText('//div[@class="mobile"]/p')(self.doc))
def on_load(self):
# message is: "Oups... votre compte ameli est momentanément indisponible. Il sera de retour en pleine forme très bientôt."
# nothing we can do, but retry later
raise BrowserUnavailable(html_unescape(CleanText('//div[@class="mobile"]/p')(self.doc)))
class SubscriptionPage(LoggedPage, HTMLPage):
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