diff --git a/modules/cragr/regions/browser.py b/modules/cragr/regions/browser.py index f217851fec31c60a9fcc778e977abe38fa84989f..5c1e975fc1cf09ad6d84cbc7b36e4cdeb6dc4ae8 100644 --- a/modules/cragr/regions/browser.py +++ b/modules/cragr/regions/browser.py @@ -530,6 +530,9 @@ def iter_history(self, account, coming=False): # we must skip the ongoing one but fetch the other ones # even if they are in the future. ongoing_coming = self.page.get_ongoing_coming() + if not ongoing_coming: + # This card has no available history or coming. + return card_transactions = [] latest_date = None diff --git a/modules/cragr/regions/pages.py b/modules/cragr/regions/pages.py index 5682463c98904a0786d8c392f665e593abed115b..95c0d3ed60cab803e4cdde14f05a59cca069db95 100644 --- a/modules/cragr/regions/pages.py +++ b/modules/cragr/regions/pages.py @@ -418,8 +418,10 @@ def get_ongoing_coming(self): # the coming is positive, it will become 'Opérations créditées' raw_date = Regexp( CleanText('//table[@class="ca-table"]//tr[1]//b[contains(text(), "Opérations débitées") or contains(text(), "Opérations créditées")]'), - r'le (.*) :' + r'le (.*) :', default=None )(self.doc) + if not raw_date: + return None return parse_french_date(raw_date).date() def get_card_transactions(self, latest_date, ongoing_coming):