From db2d032ce8178aa745db8842376149ec25634af8 Mon Sep 17 00:00:00 2001 From: Maxime Pommier Date: Tue, 18 Jun 2019 12:12:46 +0200 Subject: [PATCH] [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 --- modules/axabanque/pages/bank.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/modules/axabanque/pages/bank.py b/modules/axabanque/pages/bank.py index 6e472f4352..2eca975df6 100644 --- a/modules/axabanque/pages/bank.py +++ b/modules/axabanque/pages/bank.py @@ -199,15 +199,16 @@ def get_list(self): # 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) -- GitLab