Commit 7a3e3622 authored by Maxime Gasselin's avatar Maxime Gasselin Committed by Romain Bignon

[creditdunord] Fix get_label

The "credit" and "synthese" keys are now splitted. It is more secure to
check the label in each iteration instead of a given index.

Closes: 37018@sibi
parent c943f648
......@@ -173,12 +173,14 @@ class LabelsPage(LoggedPage, JsonPage):
def get_labels(self):
synthesis_labels = ["Synthèse"]
loan_labels = ["Crédits en cours", "Crédits perso et immo", "Crédits"]
for element in Dict('donnees/1/submenu')(self.doc):
if CleanText(Dict('label'))(element) in synthesis_labels:
synthesis_label = CleanText(Dict('link'))(element).split("/")[-1]
if CleanText(Dict('label'))(element) in loan_labels:
loan_label = CleanText(Dict('link'))(element).split("/")[-1]
loan_labels = ["Crédits en cours", "Crédits perso et immo", "Crédits", "Crédits Personnels et immobiliers"]
keys = [key for key in Dict('donnees')(self.doc) if key.get('label') in ['Crédits', 'Comptes et cartes']]
for key in keys:
for element in Dict('submenu')(key):
if CleanText(Dict('label'))(element) in synthesis_labels:
synthesis_label = CleanText(Dict('link'))(element).split("/")[-1]
if CleanText(Dict('label'))(element) in loan_labels:
loan_label = CleanText(Dict('link'))(element).split("/")[-1]
return (synthesis_label, loan_label)
......
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