Commit db2d032c authored by Maxime Pommier's avatar Maxime Pommier Committed by ntome

[axabanque] Handle only the exception needed for account id

Reformat the code to have only the part that can raise an exception in the try/except for account id
parent 999f7ce8
......@@ -199,15 +199,16 @@ class AccountsPage(LoggedPage, MyHTMLPage):
# get accounts id
try:
account.id = args['paramNumCompte'] + args['paramNumContrat']
if 'Visa' in account.label:
card_id = re.search('(\d+)', box.xpath('./td[2]')[0].text.strip())
if card_id:
account.id += card_id.group(1)
if u'Valorisation' in account.label or u'Liquidités' in account.label:
account.id += args[next(k for k in args.keys() if "_idcl" in k)].split('Jsp')[-1]
except KeyError:
account.id = args['paramNumCompte']
if 'Visa' in account.label:
card_id = re.search('(\d+)', box.xpath('./td[2]')[0].text.strip())
if card_id:
account.id += card_id.group(1)
if u'Valorisation' in account.label or u'Liquidités' in account.label:
account.id += args[next(k for k in args.keys() if "_idcl" in k)].split('Jsp')[-1]
# get accounts balance
try:
balance_value = CleanText('.//td[has-class("montant")]')(box)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment