From b4ca104ae6d4adb4aef51cf2a727dfc10f24e7dd Mon Sep 17 00:00:00 2001 From: Quentin Defenouillere Date: Mon, 4 Feb 2019 15:33:25 +0100 Subject: [PATCH] [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. --- modules/cragr/api/browser.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/cragr/api/browser.py b/modules/cragr/api/browser.py index 36989b4795..77b8c90c03 100644 --- a/modules/cragr/api/browser.py +++ b/modules/cragr/api/browser.py @@ -208,11 +208,11 @@ def get_accounts_list(self): 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 -- GitLab