From e8b46de0f7a501b270799a2bc22f73f0bbc5b42a Mon Sep 17 00:00:00 2001 From: Quentin Defenouillere Date: Fri, 3 Jul 2020 10:17:34 +0200 Subject: [PATCH] [bnporc] Handle unavailable website for Life Insurance with ConnectionError --- modules/bnporc/pp/browser.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/bnporc/pp/browser.py b/modules/bnporc/pp/browser.py index 7157d5f09a..ce45c485ed 100644 --- a/modules/bnporc/pp/browser.py +++ b/modules/bnporc/pp/browser.py @@ -21,9 +21,10 @@ from __future__ import unicode_literals +import time from datetime import datetime + from dateutil.relativedelta import relativedelta -import time from requests.exceptions import ConnectionError from weboob.browser.browsers import LoginBrowser, URL, need_login, StatesMixin @@ -257,9 +258,10 @@ def iter_accounts(self): params = self.natio_vie_pro.go().get_params() try: # When the space does not exist we land on a 302 that tries to redirect - # to an unexisting domain, hence the 'allow_redirects=False' + # to an unexisting domain, hence the 'allow_redirects=False'. + # Sometimes the Life Insurance space is unavailable, hence the 'ConnectionError'. self.location(self.capitalisation_page.build(params=params), allow_redirects=False) - except ServerError: + except (ServerError, ConnectionError): self.logger.warning("An Internal Server Error occurred") else: if self.capitalisation_page.is_here() and self.page.has_contracts(): -- GitLab