From ab418b7e1508a94ff38bdf272c9dd89c2563f77a Mon Sep 17 00:00:00 2001 From: Matteo Date: Fri, 13 Sep 2024 16:11:57 +0200 Subject: [PATCH] Fix SyncClient close for not fully initialized object (#9) --- src/giskard_hub/_base_client.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/giskard_hub/_base_client.py b/src/giskard_hub/_base_client.py index 8d153fe..96ff5df 100644 --- a/src/giskard_hub/_base_client.py +++ b/src/giskard_hub/_base_client.py @@ -75,7 +75,11 @@ def delete(self, path: str, **kwargs): return self._request("DELETE", path, **kwargs) def close(self): - self._http.close() + try: + self._http.close() + except AttributeError: + # This may happen if the client was not properly initialized yet + pass def __del__(self): self.close()