mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-22 11:13:34 +00:00
Send empty dictionary instead of null for iot queries (#1145)
This commit is contained in:
parent
db80c383a9
commit
81e2685605
@ -285,7 +285,7 @@ async def get_legacy_fixture(device):
|
||||
try:
|
||||
click.echo(f"Testing {test_call}..", nl=False)
|
||||
info = await device.protocol.query(
|
||||
{test_call.module: {test_call.method: None}}
|
||||
{test_call.module: {test_call.method: {}}}
|
||||
)
|
||||
resp = info[test_call.module]
|
||||
except Exception as ex:
|
||||
@ -302,7 +302,7 @@ async def get_legacy_fixture(device):
|
||||
final_query = defaultdict(defaultdict)
|
||||
final = defaultdict(defaultdict)
|
||||
for succ, resp in successes:
|
||||
final_query[succ.module][succ.method] = None
|
||||
final_query[succ.module][succ.method] = {}
|
||||
final[succ.module][succ.method] = resp
|
||||
|
||||
final = default_to_regular(final)
|
||||
|
@ -32,8 +32,8 @@ from .xortransport import XorTransport
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
GET_SYSINFO_QUERY = {
|
||||
"system": {"get_sysinfo": None},
|
||||
GET_SYSINFO_QUERY: dict[str, dict[str, dict]] = {
|
||||
"system": {"get_sysinfo": {}},
|
||||
}
|
||||
|
||||
|
||||
|
@ -296,8 +296,8 @@ class Discover:
|
||||
|
||||
DISCOVERY_PORT = 9999
|
||||
|
||||
DISCOVERY_QUERY = {
|
||||
"system": {"get_sysinfo": None},
|
||||
DISCOVERY_QUERY: dict[str, dict[str, dict]] = {
|
||||
"system": {"get_sysinfo": {}},
|
||||
}
|
||||
|
||||
DISCOVERY_PORT_2 = 20002
|
||||
|
@ -207,6 +207,8 @@ class IotDevice(Device):
|
||||
def _create_request(
|
||||
self, target: str, cmd: str, arg: dict | None = None, child_ids=None
|
||||
):
|
||||
if arg is None:
|
||||
arg = {}
|
||||
request: dict[str, Any] = {target: {cmd: arg}}
|
||||
if child_ids is not None:
|
||||
request = {"context": {"child_ids": child_ids}, target: {cmd: arg}}
|
||||
|
@ -88,7 +88,6 @@ class KlapTransport(BaseTransport):
|
||||
"""
|
||||
|
||||
DEFAULT_PORT: int = 80
|
||||
DISCOVERY_QUERY = {"system": {"get_sysinfo": None}}
|
||||
SESSION_COOKIE_NAME = "TP_SESSIONID"
|
||||
TIMEOUT_COOKIE_NAME = "TIMEOUT"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user