diff --git a/modules/cic/browser.py b/modules/cic/browser.py index 54e9f361..88edad20 100644 --- a/modules/cic/browser.py +++ b/modules/cic/browser.py @@ -42,8 +42,10 @@ class CICBrowser(Browser): PAGES = {'https://www.cic.fr/.*/fr/banques/particuliers/index.html': LoginPage, 'https://www.cic.fr/.*/fr/identification/default.cgi': LoginErrorPage, 'https://www.cic.fr/.*/fr/banque/situation_financiere.cgi': AccountsPage, + 'https://www.cic.fr/.*/fr/banque/situation_financiere.html': AccountsPage, 'https://www.cic.fr/.*/fr/banque/espace_personnel.aspx': UserSpacePage, 'https://www.cic.fr/.*/fr/banque/mouvements.cgi.*': OperationsPage, + 'https://www.cic.fr/.*/fr/banque/mouvements.html.*': OperationsPage, 'https://www.cic.fr/.*/fr/banque/mvts_instance.cgi.*': ComingPage, 'https://www.cic.fr/.*/fr/banque/nr/nr_devbooster.aspx.*': OperationsPage, 'https://www.cic.fr/.*/fr/banque/operations_carte\.cgi.*': CardPage, @@ -101,7 +103,7 @@ class CICBrowser(Browser): self.currentSubBank = url.path.lstrip('/').split('/')[0] def list_operations(self, page_url): - if page_url.startswith('/'): + if page_url.startswith('/') or page_url.startswith('https'): self.location(page_url) else: self.location('https://%s/%s/fr/banque/%s' % (self.DOMAIN, self.currentSubBank, page_url)) diff --git a/modules/cic/pages.py b/modules/cic/pages.py index e08754f9..c8b93175 100644 --- a/modules/cic/pages.py +++ b/modules/cic/pages.py @@ -83,8 +83,11 @@ class AccountsPage(Page): for tr in self.document.getiterator('tr'): first_td = tr.getchildren()[0] - if (first_td.attrib.get('class', '') == 'i g' or first_td.attrib.get('class', '') == 'p g') \ - and first_td.find('a') is not None: + if (first_td.attrib.get('class', '') == 'i g' \ + or first_td.attrib.get('class', '') == 'p g' \ + or 'i _c1' in first_td.attrib.get('class', '') \ + or 'p _c1' in first_td.attrib.get('class', '')) \ + and first_td.find('a') is not None: a = first_td.find('a') link = a.get('href', '') @@ -97,8 +100,12 @@ class AccountsPage(Page): continue for i in (2,1): - balance = FrenchTransaction.clean_amount(tr.getchildren()[i].text) - currency = Account.get_currency(tr.getchildren()[i].text) + if tr.getchildren()[i].text is None: + amout = tr.getchildren()[i].getchildren()[0].text + else: + amout = tr.getchildren()[i].text + balance = FrenchTransaction.clean_amount(amout) + currency = Account.get_currency(amout) if len(balance) > 0: break balance = Decimal(balance) @@ -114,7 +121,12 @@ class AccountsPage(Page): account = Account() account.id = id - account.label = unicode(a.text).strip().lstrip(' 0123456789').title() + + if len(a.getchildren()) > 0: + account.label = u' '.join([unicode(c.text) for c in a.getchildren()]) + else: + account.label = unicode(a.text) + account.label.strip().lstrip(' 0123456789').title() for pattern, actype in self.TYPES.iteritems(): if account.label.startswith(pattern): @@ -183,7 +195,8 @@ class OperationsPage(Page): if tds[0].attrib.get('class', '') == 'i g' or \ tds[0].attrib.get('class', '') == 'p g' or \ - tds[0].attrib.get('class', '').endswith('_c1 c _c1'): + tds[0].attrib.get('class', '').endswith('_c1 c _c1') or \ + tds[0].attrib.get('class', '').endswith('_c1 i _c1'): operation = Transaction(0) parts = [txt.strip() for txt in tds[-3].itertext() if len(txt.strip()) > 0]