mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-01-24 05:37:59 +00:00
Handle no method in multiple response for single request
This commit is contained in:
parent
9f10cd10cb
commit
5782ce1029
@ -246,7 +246,15 @@ class SmartProtocol(BaseProtocol):
|
|||||||
|
|
||||||
responses = response_step["result"]["responses"]
|
responses = response_step["result"]["responses"]
|
||||||
for response in 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(
|
self._handle_response_error_code(
|
||||||
response, method, raise_on_error=raise_on_error
|
response, method, raise_on_error=raise_on_error
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user