mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-10-12 10:28:01 +00:00
Handle smartcam partial list responses (#1411)
This commit is contained in:
@@ -5,7 +5,7 @@ from __future__ import annotations
|
||||
import logging
|
||||
from dataclasses import dataclass
|
||||
from pprint import pformat as pf
|
||||
from typing import Any
|
||||
from typing import Any, cast
|
||||
|
||||
from ..exceptions import (
|
||||
AuthenticationError,
|
||||
@@ -49,10 +49,13 @@ class SingleRequest:
|
||||
class SmartCamProtocol(SmartProtocol):
|
||||
"""Class for SmartCam Protocol."""
|
||||
|
||||
async def _handle_response_lists(
|
||||
self, response_result: dict[str, Any], method: str, retry_count: int
|
||||
) -> None:
|
||||
pass
|
||||
def _get_list_request(
|
||||
self, method: str, params: dict | None, start_index: int
|
||||
) -> dict:
|
||||
# All smartcam requests have params
|
||||
params = cast(dict, params)
|
||||
module_name = next(iter(params))
|
||||
return {method: {module_name: {"start_index": start_index}}}
|
||||
|
||||
def _handle_response_error_code(
|
||||
self, resp_dict: dict, method: str, raise_on_error: bool = True
|
||||
@@ -147,7 +150,9 @@ class SmartCamProtocol(SmartProtocol):
|
||||
if len(request) == 1 and method in {"get", "set", "do", "multipleRequest"}:
|
||||
single_request = self._get_smart_camera_single_request(request)
|
||||
else:
|
||||
return await self._execute_multiple_query(request, retry_count)
|
||||
return await self._execute_multiple_query(
|
||||
request, retry_count, iterate_list_pages
|
||||
)
|
||||
else:
|
||||
single_request = self._make_smart_camera_single_request(request)
|
||||
|
||||
|
Reference in New Issue
Block a user