Handle no method in multiple response for single request

This commit is contained in:
Steven B 2024-12-13 14:39:55 +00:00
parent 9f10cd10cb
commit 5782ce1029
No known key found for this signature in database
GPG Key ID: 6D5B46B3679F2A43

View File

@ -246,7 +246,15 @@ class SmartProtocol(BaseProtocol):
responses = response_step["result"]["responses"]
for response in responses:
method = response["method"]
# smartcam devices sometimes do not populate method if there's
# only one item in the request
if (
not (method := response.get("method"))
and "result" in response
and len(requests) == 1
):
method = next(iter(requests))
self._handle_response_error_code(
response, method, raise_on_error=raise_on_error
)