Commit fc371895 authored by Quentin Defenouillere's avatar Quentin Defenouillere Committed by Vincent A

[spirica] add try/except when accessing account details

Everything works fine locally but we are blocked in prod, leading to 500
errors when trying to access account details.
parent 034c6477
......@@ -20,7 +20,8 @@
from __future__ import unicode_literals
from weboob.browser import LoginBrowser, URL, need_login
from weboob.exceptions import BrowserIncorrectPassword
from weboob.exceptions import BrowserIncorrectPassword, BrowserUnavailable
from weboob.browser.exceptions import ServerError
from .pages import LoginPage, AccountsPage, DetailsPage, MaintenancePage
......@@ -77,7 +78,23 @@ class SpiricaBrowser(LoginBrowser):
def iter_history(self, account):
except ServerError:
# We have to handle 'fake' 500 errors, which are probably due to Spirica blocking the IPs
# Quite often, these errors cause logouts so we may have to re-login.
self.logger.warning('Access to account details has failed due to a 500 error. We try again.')
if self.login.is_here():
self.logger.warning('Server error led to a logout, we must re-login.')
except ServerError:
error_message = 'Access to details for accounts %s has failed twice.' %
raise BrowserUnavailable(error_message)
self.transaction_page =
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