From bfd637f7017c2272d84c7867864887690d6083bb Mon Sep 17 00:00:00 2001 From: christian Date: Fri, 31 May 2024 08:30:24 +0200 Subject: [PATCH] retry relogin if parse json false (#113) * retry relogin if parse json false No-Issue * Update galaxykit/client.py Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Update galaxykit/client.py Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- galaxykit/client.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/galaxykit/client.py b/galaxykit/client.py index 884b608..4ee9ff3 100644 --- a/galaxykit/client.py +++ b/galaxykit/client.py @@ -304,7 +304,13 @@ def _http(self, method, path, *args, **kwargs): raise GalaxyClientError(resp, resp.status_code) return json_data else: - if resp.status_code >= 400: + if resp.status_code == 401 and "gateway_sessionid" in self.headers.get( + "Cookie" + ): + return self._retry_if_expired_gw_token( + method, url, headers, *args, **kwargs + ) + elif resp.status_code >= 400: logging.debug(resp.text) raise GalaxyClientError(resp, resp.status_code) return resp