Skip to content

Commit f223f3d

Browse files
committed
Refactor update method to return full JSON responses instead of status code; improve error handling with response.raise_for_status().
1 parent b52640b commit f223f3d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

darktrace/dt_devices.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def get(self,
8484
response.raise_for_status()
8585
return response.json()
8686

87-
def update(self, did: int, **kwargs):
87+
def update(self, did: int, **kwargs) -> dict:
8888
"""Update device properties in Darktrace.
8989
9090
Args:
@@ -110,4 +110,5 @@ def update(self, did: int, **kwargs):
110110
response = requests.post(url, headers=headers, params=sorted_params, data=json_data, verify=False)
111111
self.client._debug(f"Response Status: {response.status_code}")
112112
self.client._debug(f"Response Text: {response.text}")
113-
return response.status_code == 200
113+
response.raise_for_status()
114+
return response.json()

0 commit comments

Comments
 (0)