From 0942c08d55cf0d13009c8c51a8575cf53b6a3f28 Mon Sep 17 00:00:00 2001 From: Laurent Bachelier Date: Fri, 1 Oct 2010 12:07:45 +0200 Subject: [PATCH] Add support for another version of Credit Agricole Both versions are present, for different regions. --- weboob/backends/cragr/pages/accounts_list.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/weboob/backends/cragr/pages/accounts_list.py b/weboob/backends/cragr/pages/accounts_list.py index 358cb9ee..99fca92f 100644 --- a/weboob/backends/cragr/pages/accounts_list.py +++ b/weboob/backends/cragr/pages/accounts_list.py @@ -25,12 +25,20 @@ class AccountsList(CragrBasePage): def get_list(self): l = [] + for div in self.document.getiterator('div'): - if div.attrib.get('class', '') == 'dv' and div.getchildren()[0].tag == 'br': + if div.attrib.get('class', '') == 'dv' and div.getchildren()[0].tag in ('a', 'br'): account = Account() - account.label = div.find('a').text.strip() - account.id = div.findall('br')[1].tail.strip() - s = div.find('div').find('span').find('b').text + if div.getchildren()[0].tag == 'a': + # This is at least present on CA Nord-Est + account.label = ' '.join(div.find('a').text.split()[:-1]) + account.id = div.find('a').text.split()[-1] + s = div.find('div').find('b').find('span').text + else: + # This is at least present on CA Toulouse + account.label = div.find('a').text.strip() + account.id = div.findall('br')[1].tail.strip() + s = div.find('div').find('span').find('b').text balance = u'' for c in s: if c.isdigit():