From 8dbcbf2daa4b2668769fe082362bc48c6123a3d0 Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Fri, 26 Apr 2013 15:36:52 +0200 Subject: [PATCH] support personnal accounts on professionnal website --- modules/bnporc/pro.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/modules/bnporc/pro.py b/modules/bnporc/pro.py index 9bd32df9..55097a4b 100644 --- a/modules/bnporc/pro.py +++ b/modules/bnporc/pro.py @@ -38,10 +38,13 @@ class ProAccountsList(BasePage): COL_BALANCE = 3 COL_COMING = 5 - def get_list(self): + def get_list(self, pro=True): for tr in self.document.xpath('//tr[@class="comptes"]'): cols = tr.findall('td') + if len(cols) < 5: + continue + account = Account() account.id = self.parser.tocleanstring(cols[self.COL_ID]) account.label = self.parser.tocleanstring(cols[self.COL_LABEL]) @@ -63,6 +66,16 @@ class ProAccountsList(BasePage): yield account + # If there are also personnal accounts linked, display the page and iter on them. + if pro and len(self.document.xpath('//div[@class="onglets"]//a[contains(@href, "afficherComptesPrives")]')) > 0: + self.browser.select_form(name='myForm') + self.browser.set_all_readonly(False) + self.browser['udcAction'] = '/afficherComptesPrives' + self.browser.submit() + + for a in self.browser.page.get_list(False): + yield a + class ProAccountHistory(BasePage): COL_DATE = 0