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