Skip to content
This repository was archived by the owner on Jun 28, 2024. It is now read-only.

Commit 9280c73

Browse files
Change device delete http method + minor fixes
1 parent 357f6c3 commit 9280c73

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

seamapi/devices.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def delete(self, device: Union[DeviceId, Device]) -> bool:
207207

208208
delete_payload = {"device_id": to_device_id(device)}
209209
self.seam.make_request(
210-
"POST",
210+
"DELETE",
211211
"/devices/delete",
212212
json=delete_payload,
213213
)

seamapi/events.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,4 @@ def get(
137137
params=params,
138138
)
139139

140-
if not res.get("event", None):
141-
return None
142-
143-
return res["event"]
140+
return res.get("event", None)

seamapi/locks.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,20 +83,20 @@ def list(
8383
A list of locks.
8484
"""
8585

86-
list_payload = {}
86+
params = {}
8787
if connected_account:
88-
list_payload["connected_account_id"] = to_connected_account_id(
88+
params["connected_account_id"] = to_connected_account_id(
8989
connected_account
9090
)
9191
if connect_webview:
92-
list_payload["connect_webview_id"] = to_connect_webview_id(
92+
params["connect_webview_id"] = to_connect_webview_id(
9393
connect_webview
9494
)
9595

9696
res = self.seam.make_request(
9797
"GET",
9898
"/locks/list",
99-
params=list_payload,
99+
params=params,
100100
)
101101
json_locks = res["devices"]
102102

@@ -126,16 +126,16 @@ def get(
126126
A lock dict.
127127
"""
128128

129-
get_payload = {}
129+
params = {}
130130
if device:
131-
get_payload["device_id"] = to_device_id(device)
131+
params["device_id"] = to_device_id(device)
132132
if name:
133-
get_payload["name"] = name
133+
params["name"] = name
134134

135135
res = self.seam.make_request(
136136
"GET",
137137
"/locks/get",
138-
params=get_payload,
138+
params=params,
139139
)
140140
json_lock = res["device"]
141141

0 commit comments

Comments
 (0)