mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-04 09:44:14 +00:00
Make device initialisation easier by reducing required imports (#936)
Adds username and password arguments to discovery to remove the need to import Credentials. Creates TypeAliases in Device for connection configuration classes and DeviceType. Using the API with these changes will only require importing either Discover or Device depending on whether using Discover.discover() or Device.connect() to initialize and interact with the API.
This commit is contained in:
@@ -231,11 +231,11 @@ async def cli(
|
||||
if host is not None:
|
||||
if discovery_info:
|
||||
click.echo("Host and discovery info given, trying connect on %s." % host)
|
||||
from kasa import ConnectionType, DeviceConfig
|
||||
from kasa import DeviceConfig, DeviceConnectionParameters
|
||||
|
||||
di = json.loads(discovery_info)
|
||||
dr = DiscoveryResult(**di)
|
||||
connection_type = ConnectionType.from_values(
|
||||
connection_type = DeviceConnectionParameters.from_values(
|
||||
dr.device_type,
|
||||
dr.mgt_encrypt_schm.encrypt_type,
|
||||
dr.mgt_encrypt_schm.lv,
|
||||
|
Reference in New Issue
Block a user