diff --git a/modules/boursorama/pages.py b/modules/boursorama/pages.py index 3f3af93007164786120c04868d53313c7ba2e9af..6bb9f2a6988c59429e183225819516067ad4140d 100644 --- a/modules/boursorama/pages.py +++ b/modules/boursorama/pages.py @@ -41,7 +41,7 @@ AddRecipientBankError, TransferInvalidAmount, Loan, AccountOwnership, ) from weboob.tools.capabilities.bank.investments import create_french_liquidity -from weboob.capabilities.base import NotAvailable, Currency, find_object +from weboob.capabilities.base import NotAvailable, Currency, find_object, empty from weboob.capabilities.profile import Person from weboob.tools.capabilities.bank.transactions import FrenchTransaction from weboob.tools.capabilities.bank.iban import is_iban_valid @@ -862,11 +862,13 @@ def populate_cards_number(self, cards): # There is only one place in the code where we can associate both hash to each other. The second hash # that we found with the first one match with a card account id. - url = Link('//nav[@data-card-key="%s"]//a[contains(@href, "calendrier")]' % _hash)(self.doc) - card_id = re.search(r'\/carte\/(.*)\/calendrier', url).group(1) + url = Link('//nav[@data-card-key="%s"]//a[contains(@href, "calendrier")]' % _hash, NotAvailable)(self.doc) - card = find_object(cards, id=card_id, error=AccountNotFound) - card.number = card_number + # If there is no coming, that's not a deferred card + if not empty(url): + card_id = re.search(r'\/carte\/(.*)\/calendrier', url).group(1) + card = find_object(cards, id=card_id, error=AccountNotFound) + card.number = card_number class HomePage(LoggedPage, HTMLPage):