Commit 6bc8ae24 authored by Laurent Bachelier's avatar Laurent Bachelier 🐧

Check if Credit Agricole is down

parent 0942c08d
......@@ -20,9 +20,6 @@ from weboob.capabilities.bank import Account
from .base import CragrBasePage
class AccountsList(CragrBasePage):
def on_loaded(self):
pass
def get_list(self):
l = []
......
......@@ -17,8 +17,23 @@
from weboob.tools.browser import BasePage
from weboob.tools.browser import BrowserUnavailable
class CragrBasePage(BasePage):
def on_loaded(self):
# Check for an error
for div in self.document.getiterator('div'):
if div.attrib.get('class', '') == 'dv' and div.getchildren()[0].tag in ('img') and div.getchildren()[0].attrib.get('alt', '') == 'Attention':
# Try to find a detailed error message
if div.getchildren()[1].tag == 'span':
raise BrowserUnavailable(div.find('span').find('b').text)
elif div.getchildren()[1].tag == 'b':
# I haven't encountered this variation in the wild,
# but I wouldn't be surprised if it existed
# given the similar differences between regions.
raise BrowserUnavailable(div.find('b').find('span').text)
raise BrowserUnavailable()
def is_logged(self):
for form in self.document.getiterator('form'):
return False
......
......@@ -26,9 +26,6 @@ __all__ = ['LoginPage']
class LoginPage(CragrBasePage):
def on_loaded(self):
pass
def login(self, login, password):
self.browser.select_form(nr=0)
try:
......
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