caissedepargne fix IndexError related to investment feature
This commit is contained in:
parent
0bdacd66fe
commit
43f447227a
2 changed files with 15 additions and 7 deletions
|
|
@ -144,7 +144,10 @@ class CaisseEpargne(Browser):
|
||||||
self.page.submit()
|
self.page.submit()
|
||||||
self.location('https://www.caisse-epargne.offrebourse.com/Portefeuille')
|
self.location('https://www.caisse-epargne.offrebourse.com/Portefeuille')
|
||||||
elif account.type is Account.TYPE_LIFE_INSURANCE:
|
elif account.type is Account.TYPE_LIFE_INSURANCE:
|
||||||
self.page.go_life_insurance()
|
try:
|
||||||
self.page.submit()
|
self.page.go_life_insurance(account)
|
||||||
self.location('https://www.extranet2.caisse-epargne.fr%s' % self.page.get_cons_repart())
|
self.page.submit()
|
||||||
|
self.location('https://www.extranet2.caisse-epargne.fr%s' % self.page.get_cons_repart())
|
||||||
|
except IndexError:
|
||||||
|
return iter([])
|
||||||
return self.page.iter_investment()
|
return self.page.iter_investment()
|
||||||
|
|
|
||||||
|
|
@ -179,8 +179,13 @@ class IndexPage(Page):
|
||||||
if not account.type == Account.TYPE_LIFE_INSURANCE:
|
if not account.type == Account.TYPE_LIFE_INSURANCE:
|
||||||
return NotAvailable
|
return NotAvailable
|
||||||
self.go_history(account._info)
|
self.go_history(account._info)
|
||||||
balance = self.browser.page.document.xpath('.//tr[td[contains(text(), ' + account.id + ')]]/td[contains(@class, "somme")]')[0]
|
balance = self.browser.page.document.xpath('.//tr[td[contains(text(), ' + account.id + ')]]/td[contains(@class, "somme")]')
|
||||||
balance = Decimal(FrenchTransaction.clean_amount(self.parser.tocleanstring(balance)))
|
if len(balance) > 0:
|
||||||
|
balance = self.parser.tocleanstring(balance[0])
|
||||||
|
balance = Decimal(FrenchTransaction.clean_amount(balance)) if balance != u'' else NotAvailable
|
||||||
|
else:
|
||||||
|
balance = NotAvailable
|
||||||
|
self.go_list()
|
||||||
return balance
|
return balance
|
||||||
|
|
||||||
def get_list(self):
|
def get_list(self):
|
||||||
|
|
@ -346,8 +351,8 @@ class IndexPage(Page):
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def go_life_insurance(self):
|
def go_life_insurance(self, account):
|
||||||
link = self.document.xpath('//table[@summary="Mes contrats d\'assurance vie"]/tbody/tr//a')[0]
|
link = self.document.xpath('//table[@summary="Mes contrats d\'assurance vie"]/tbody/tr[td[contains(text(), ' + account.id + ') ]]//a')[0]
|
||||||
m = re.search("PostBack(Options)?\([\"'][^\"']+[\"'],\s*['\"](REDIR_ASS_VIE[\d\w&]+)?['\"]", link.attrib.get('href', ''))
|
m = re.search("PostBack(Options)?\([\"'][^\"']+[\"'],\s*['\"](REDIR_ASS_VIE[\d\w&]+)?['\"]", link.attrib.get('href', ''))
|
||||||
if m is not None:
|
if m is not None:
|
||||||
self.browser.select_form(name='main')
|
self.browser.select_form(name='main')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue