Commit f265722d authored by Romain Bignon's avatar Romain Bignon

support when website is unavailable

parent e7c8e8c7
......@@ -22,7 +22,7 @@ from urlparse import urlsplit
from weboob.tools.browser import BaseBrowser, BrowserIncorrectPassword
from .pages import LoginPage, IndexPage, ErrorPage
from .pages import LoginPage, IndexPage, ErrorPage, UnavailablePage
__all__ = ['CaisseEpargne']
......@@ -35,6 +35,7 @@ class CaisseEpargne(BaseBrowser):
PAGES = {'https://[^/]+.caisse-epargne.fr/particuliers/ind_pauthpopup.aspx.*': LoginPage,
'https://[^/]+.caisse-epargne.fr/Portail.aspx': IndexPage,
'https://[^/]+.caisse-epargne.fr/login.aspx': ErrorPage,
'https://[^/]+.caisse-epargne.fr/page_hs_dei_.*.aspx': UnavailablePage,
}
def is_logged(self):
......
......@@ -22,12 +22,12 @@ from decimal import Decimal
import re
from weboob.tools.mech import ClientForm
from weboob.tools.browser import BasePage, BrokenPageError
from weboob.tools.browser import BasePage, BrokenPageError, BrowserUnavailable
from weboob.capabilities.bank import Account
from weboob.tools.capabilities.bank.transactions import FrenchTransaction
__all__ = ['LoginPage', 'ErrorPage', 'IndexPage']
__all__ = ['LoginPage', 'ErrorPage', 'IndexPage', 'UnavailablePage']
class LoginPage(BasePage):
......@@ -61,6 +61,13 @@ class ErrorPage(BasePage):
except BrokenPageError:
return None
class UnavailablePage(BasePage):
def on_loaded(self):
try:
raise BrowserUnavailable(self.parser.select(self.document.getroot(), 'div#message_error_hs', 1).text.strip())
except BrokenPageError:
raise BrowserUnavailable()
class Transaction(FrenchTransaction):
PATTERNS = [(re.compile('^CB (?P<text>.*?) FACT (?P<dd>\d{2})(?P<mm>\d{2})(?P<yy>\d{2})'),
FrenchTransaction.TYPE_CARD),
......
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