Commit 7d91ba35 authored by Quentin Defenouillere's avatar Quentin Defenouillere Committed by Vincent A

[s2e] Handle 503 errors when fetching Investment details

Currently the BNPPERE website does not work really well and the access
to investment details returns 503 errors (even when clicking on the
button on the website).

We handle it with serverError.
parent e8b46de0
......@@ -25,6 +25,7 @@ import re
from weboob.browser import LoginBrowser, URL, need_login, StatesMixin
from weboob.exceptions import BrowserIncorrectPassword, ActionNeeded, NoAccountsException
from weboob.browser.exceptions import ServerError
from weboob.capabilities.wealth import Investment
from weboob.tools.capabilities.bank.investments import is_isin_valid
......@@ -209,7 +210,13 @@ class S2eBrowser(LoginBrowser, StatesMixin):
# From the current URL, which has the format:
# https://optimisermon.epargne-retraite-entreprises.bnpparibas.com/Mes-Supports/11111/QS0002222T5
# We can extract the investment ISIN code and use it to call routes of the BNP Wealth API
self.location(inv._link)
try:
self.location(inv._link)
except ServerError:
# For some connections, this request returns a 503 even on the website
self.logger.warning('Server returned a Server Error when trying to fetch investment performances.')
continue
m = re.search(r'Mes-Supports/(.*)/(.*)', self.url)
if m:
if is_isin_valid(m.group(2)):
......
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