diff --git a/modules/cragr/api/browser.py b/modules/cragr/api/browser.py index 3d7f475099422364f339a58171ca878355f66e71..82a215f57401d25b1fdb82d62bfa8f2d9e134e13 100644 --- a/modules/cragr/api/browser.py +++ b/modules/cragr/api/browser.py @@ -143,12 +143,10 @@ def do_security_check(self): if any(value in message for value in technical_error_messages) or \ any(value in code for value in technical_error_codes): raise BrowserUnavailable(message) - elif error_type and 'UNAUTHORIZED_ERREUR_TYPE' in error_type: - # Usually appears when doing retries after a BrowserUnavailable - raise BrowserUnavailable() - # When a PSD2 SCA is required it also returns a 500, but info is under 'url' key - if exc.response.json().get('url') == 'dsp2/informations.html': + # When a PSD2 SCA is required it also returns a 500, hopefully we can detect it + if (exc_json.get('url') == 'dsp2/informations.html' or + exc_json.get('redirection', '').endswith('dsp2/informations.html')): return self.handle_sca() raise