Refactor error handling in Node class

- Updated the `Node` class to use `response.raise_for_status()` for improved error handling, replacing the previous manual check for a 500 status code. This change simplifies the error management process when fetching node data.
This commit is contained in:
IluaAir
2026-03-16 18:24:24 +03:00
parent 974fff6038
commit 65c82fbaf5

View File

@@ -18,8 +18,7 @@ class Node:
if not url.endswith(".json"):
url += ".json"
response = self._session.get(url)
if response.status_code == 500:
raise ValueError(f"page {url} not found")
response.raise_for_status()
return NodeView(
session=self._session, base_url=self._base_url, data=response.json()
)