Commit 540d894e authored by Quentin Defenouillere's avatar Quentin Defenouillere Committed by Romain Bignon

[caissedepargne] Fix request when trying to go to Loans details

Added a for loop wqhen trying to access the Loans JSON.
If it fails, we must go back to home page before retrying.
If we failed 5 times, we raise BrowserUnavailable.

Closes: 30311@sibi
parent 9b355e9a
......@@ -32,7 +32,7 @@ from weboob.browser.url import URL
from import Account, AddRecipientStep, Recipient, TransferBankError, Transaction, TransferStep
from weboob.capabilities.base import NotAvailable
from weboob.capabilities.profile import Profile
from weboob.browser.exceptions import BrowserHTTPNotFound, ClientError
from weboob.browser.exceptions import BrowserHTTPNotFound, ClientError, ServerError
from weboob.exceptions import (
BrowserIncorrectPassword, BrowserUnavailable, BrowserHTTPError, BrowserPasswordExpired, ActionNeeded
......@@ -445,15 +445,27 @@ class CaisseEpargne(LoginBrowser, StatesMixin):
if or
return []
for _ in range(3):
access_to_loans = False
for trial in range(5):
for _ in range(3):
if self.home.is_here():
if self.home.is_here():
if self.home.is_here():
if not = list(
if not
# The server often returns a 520 error (Undefined):
try: = list(
except ServerError:
self.logger.warning('Access to loans failed, we try again')
# We managed to reach the Loans JSON
access_to_loans = True
if not access_to_loans:
raise BrowserUnavailable()
for _ in range(3):
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