From 5ff962ab4a87b05a1e1b860790a77ce878d4e9a5 Mon Sep 17 00:00:00 2001 From: Christophe Francois Date: Thu, 4 Jun 2020 18:16:18 +0200 Subject: [PATCH] [hsbc] Catch BrowserUnavailable error while fetching invests Some wealth accounts are now available only on the linebourse space. The current way of fetching accounts results in an error message. The linebourse space is not accessible with the current authentication so for now we catch the error so the accounts can be fetched (although without investments details and history). --- modules/hsbc/browser.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/hsbc/browser.py b/modules/hsbc/browser.py index eae3361747..d2b59688d3 100644 --- a/modules/hsbc/browser.py +++ b/modules/hsbc/browser.py @@ -28,7 +28,7 @@ from weboob.capabilities.bank import Account, AccountNotFound, AccountOwnership from weboob.tools.capabilities.bank.transactions import sorted_transactions, keep_only_card_transactions from weboob.tools.compat import parse_qsl, urlparse -from weboob.exceptions import BrowserIncorrectPassword +from weboob.exceptions import BrowserIncorrectPassword, BrowserUnavailable from weboob.browser import LoginBrowser, URL, need_login from weboob.browser.exceptions import HTTPNotFound from weboob.capabilities.base import find_object @@ -629,7 +629,11 @@ def _go_to_wealth_accounts(self, account): if self.page.get_patrimoine_url(): self.location(self.page.get_patrimoine_url()) - self.page.go_next() + try: + self.page.go_next() + except BrowserUnavailable: + # Some wealth accounts are on linebourse and can't be accessed with the current authentication. + return False if self.login.is_here(): self.logger.warning('Connection to the Logon page failed, we must try again.') -- GitLab