mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-22 11:13:34 +00:00
Add timeout parameter to dump_devinfo (#1381)
This commit is contained in:
parent
e9109447a7
commit
62345be916
@ -233,6 +233,12 @@ async def handle_device(
|
|||||||
type=bool,
|
type=bool,
|
||||||
help="Set flag if the device encryption uses https.",
|
help="Set flag if the device encryption uses https.",
|
||||||
)
|
)
|
||||||
|
@click.option(
|
||||||
|
"--timeout",
|
||||||
|
required=False,
|
||||||
|
default=15,
|
||||||
|
help="Timeout for queries.",
|
||||||
|
)
|
||||||
@click.option("--port", help="Port override", type=int)
|
@click.option("--port", help="Port override", type=int)
|
||||||
async def cli(
|
async def cli(
|
||||||
host,
|
host,
|
||||||
@ -250,6 +256,7 @@ async def cli(
|
|||||||
device_family,
|
device_family,
|
||||||
login_version,
|
login_version,
|
||||||
port,
|
port,
|
||||||
|
timeout,
|
||||||
):
|
):
|
||||||
"""Generate devinfo files for devices.
|
"""Generate devinfo files for devices.
|
||||||
|
|
||||||
@ -280,6 +287,7 @@ async def cli(
|
|||||||
connection_type=connection_type,
|
connection_type=connection_type,
|
||||||
port_override=port,
|
port_override=port,
|
||||||
credentials=credentials,
|
credentials=credentials,
|
||||||
|
timeout=timeout,
|
||||||
)
|
)
|
||||||
device = await Device.connect(config=dc)
|
device = await Device.connect(config=dc)
|
||||||
await handle_device(
|
await handle_device(
|
||||||
@ -301,6 +309,7 @@ async def cli(
|
|||||||
port_override=port,
|
port_override=port,
|
||||||
credentials=credentials,
|
credentials=credentials,
|
||||||
connection_type=ctype,
|
connection_type=ctype,
|
||||||
|
timeout=timeout,
|
||||||
)
|
)
|
||||||
if protocol := get_protocol(config):
|
if protocol := get_protocol(config):
|
||||||
await handle_device(basedir, autosave, protocol, batch_size=batch_size)
|
await handle_device(basedir, autosave, protocol, batch_size=batch_size)
|
||||||
@ -315,6 +324,7 @@ async def cli(
|
|||||||
credentials=credentials,
|
credentials=credentials,
|
||||||
port=port,
|
port=port,
|
||||||
discovery_timeout=discovery_timeout,
|
discovery_timeout=discovery_timeout,
|
||||||
|
timeout=timeout,
|
||||||
on_discovered_raw=capture_raw,
|
on_discovered_raw=capture_raw,
|
||||||
)
|
)
|
||||||
discovery_info = raw_discovery[device.host]
|
discovery_info = raw_discovery[device.host]
|
||||||
@ -336,6 +346,7 @@ async def cli(
|
|||||||
target=target,
|
target=target,
|
||||||
credentials=credentials,
|
credentials=credentials,
|
||||||
discovery_timeout=discovery_timeout,
|
discovery_timeout=discovery_timeout,
|
||||||
|
timeout=timeout,
|
||||||
on_discovered_raw=capture_raw,
|
on_discovered_raw=capture_raw,
|
||||||
)
|
)
|
||||||
click.echo(f"Detected {len(devices)} devices")
|
click.echo(f"Detected {len(devices)} devices")
|
||||||
|
Loading…
Reference in New Issue
Block a user