Commit 02bffb5f authored by Florian Duguet's avatar Florian Duguet Committed by Romain Bignon

[ameli] handle error page to raise BrowserUnavailable

Closes: 44026@sibi
parent c73cd885
......@@ -24,12 +24,13 @@ from time import time
from dateutil.relativedelta import relativedelta
from weboob.browser import LoginBrowser, URL, need_login
from .pages import LoginPage, SubscriptionPage, DocumentsPage
from .pages import ErrorPage, LoginPage, SubscriptionPage, DocumentsPage
class AmeliBrowser(LoginBrowser):
BASEURL = 'https://assure.ameli.fr'
error_page = URL(r'/vu/INDISPO_COMPTE_ASSURES.html', ErrorPage)
login_page = URL(r'/PortailAS/appmanager/PortailAS/assure\?_nfpb=true&connexioncompte_2actionEvt=afficher.*', LoginPage)
subscription_page = URL(r'/PortailAS/appmanager/PortailAS/assure\?_nfpb=true&_pageLabel=as_info_perso_page.*', SubscriptionPage)
documents_page = URL(r'/PortailAS/paiements.do', DocumentsPage)
......
......@@ -26,6 +26,7 @@ from weboob.browser.filters.html import Attr, Link
from weboob.browser.filters.standard import CleanText, Regexp, CleanDecimal, Currency, Field, Format, Env
from weboob.browser.pages import LoggedPage, HTMLPage, PartialHTMLPage
from weboob.capabilities.bill import Subscription, Bill
from weboob.exceptions import BrowserUnavailable
from weboob.tools.date import parse_french_date
......@@ -37,6 +38,12 @@ class LoginPage(HTMLPage):
form.submit()
class ErrorPage(HTMLPage):
def on_load(self):
msg = CleanText('//div[@id="backgroundId"]//p')(self.doc)
raise BrowserUnavailable(msg)
class SubscriptionPage(LoggedPage, HTMLPage):
@method
class iter_subscriptions(ListElement):
......
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