Commit b4ca104a authored by Quentin Defenouillere's avatar Quentin Defenouillere Committed by Romain Bignon

[cragr] Use go_to_account_space() instead of self.contract_page.go()

It is better to use the go_to_account_space() method in iter_accounts()
because it automatically checks if we are still logged when switching to
another space, thus avoiding calling AccountsPage methods whereas we are
in fact logged out.
parent e9fb17ef
......@@ -208,11 +208,11 @@ class CragrAPI(LoginBrowser):
for contract in range(total_spaces):
# This request often returns a 500 error so we retry several times.
try:
self.contracts_page.go(id_contract=contract)
self.go_to_account_space(contract)
except ServerError:
self.logger.warning('Server returned error 500 when trying to access space %s, we try again' % contract)
try:
self.contracts_page.go(id_contract=contract)
self.go_to_account_space(contract)
except ServerError:
self.logger.warning('Server returned error 500 twice when trying to access space %s, this space will be skipped' % contract)
continue
......
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