From 68a41392516f2aea7c93ff6ecf20a62404b03df6 Mon Sep 17 00:00:00 2001 From: Zoe Forbes Date: Sun, 8 Feb 2026 18:29:06 -0600 Subject: [PATCH] fix: use _request() in delete_bom_entry() for consistent error handling (#59) delete_bom_entry() used raw urllib.request instead of self._request(), bypassing 401 auth clearing and standard error normalization. Replace with a single _request('DELETE', ..., raw=True) call, matching the pattern used by all other BOM methods. --- silo_client/__init__.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/silo_client/__init__.py b/silo_client/__init__.py index 3447536..2a930af 100644 --- a/silo_client/__init__.py +++ b/silo_client/__init__.py @@ -844,16 +844,7 @@ class SiloClient: def delete_bom_entry(self, parent_pn: str, child_pn: str) -> None: ppn = urllib.parse.quote(parent_pn, safe="") cpn = urllib.parse.quote(child_pn, safe="") - url = f"{self.base_url}/items/{ppn}/bom/{cpn}" - headers = {"Content-Type": "application/json"} - headers.update(self._auth_headers()) - req = urllib.request.Request(url, headers=headers, method="DELETE") - try: - urllib.request.urlopen(req, context=self._ssl_context()) - except urllib.error.HTTPError as e: - raise RuntimeError(f"API error {e.code}: {e.read().decode()}") - except urllib.error.URLError as e: - raise RuntimeError(f"Connection error: {e.reason}") + self._request("DELETE", f"/items/{ppn}/bom/{cpn}", raw=True) # -- Schemas ------------------------------------------------------------