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 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://[^/]*': LoginPage,
'https://[^/]': IndexPage,
'https://[^/]': ErrorPage,
'https://[^/]*.aspx': UnavailablePage,
def is_logged(self):
......@@ -22,12 +22,12 @@ from decimal import Decimal
import re
from import ClientForm
from import BasePage, BrokenPageError
from import BasePage, BrokenPageError, BrowserUnavailable
from import Account
from 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):
raise BrowserUnavailable(, '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})'),
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