From d814326d2f439ccd821769fefbeb5e2c406ee6b3 Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Tue, 7 Aug 2012 18:00:29 +0200 Subject: [PATCH] fix parsing of accounts and history --- modules/hsbc/pages/accounts.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/hsbc/pages/accounts.py b/modules/hsbc/pages/accounts.py index 69894a2d..1fcd757a 100644 --- a/modules/hsbc/pages/accounts.py +++ b/modules/hsbc/pages/accounts.py @@ -34,7 +34,7 @@ class AccountsListPage(BasePage): def get_list(self): for tr in self.document.getiterator('tr'): tds = tr.findall('td') - if len(tds) != 3 or tds[0].attrib.get('class', '') != 'txt' or tds[0].attrib.get('valign', '') == 'center': + if len(tds) != 3 or tds[0].find('a') is None or tds[0].find('a').attrib.get('class', '') != 'flecheM': continue account = Account() @@ -76,7 +76,7 @@ class HistoryPage(BasePage): if script.text is None or script.text.find('\nCL(0') < 0: continue - for m in re.finditer(r"CL\((\d+),'(.+)','(.+)','(.+)','([\d -\.,]+)','([\d -\.,]+)','\d+','\d+','[\w\s]+'\);", script.text, flags=re.MULTILINE): + for m in re.finditer(r"CL\((\d+),'(.+)','(.+)','(.+)','([\d -\.,]+)',('([\d -\.,]+)',)?'\d+','\d+','[\w\s]+'\);", script.text, flags=re.MULTILINE): op = Transaction(m.group(1)) op.parse(date=m.group(3), raw=re.sub(u'[ ]+', u' ', m.group(4).replace(u'\n', u' '))) op.set_amount(m.group(5))