mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-22 11:13:34 +00:00
Fix cli discover bug with None username/password (#615)
This commit is contained in:
parent
1bb930b096
commit
b156defc3c
@ -64,7 +64,9 @@ class AesTransport(BaseTransport):
|
||||
super().__init__(config=config)
|
||||
|
||||
self._login_version = config.connection_type.login_version
|
||||
if not self._credentials and not self._credentials_hash:
|
||||
if (
|
||||
not self._credentials or self._credentials.username is None
|
||||
) and not self._credentials_hash:
|
||||
self._credentials = Credentials()
|
||||
if self._credentials:
|
||||
self._login_params = self._get_login_params()
|
||||
|
@ -395,7 +395,7 @@ async def discover(ctx):
|
||||
timeout = ctx.parent.params["timeout"]
|
||||
port = ctx.parent.params["port"]
|
||||
|
||||
credentials = Credentials(username, password)
|
||||
credentials = Credentials(username, password) if username and password else None
|
||||
|
||||
sem = asyncio.Semaphore()
|
||||
discovered = dict()
|
||||
|
@ -100,7 +100,9 @@ class KlapTransport(BaseTransport):
|
||||
|
||||
self._default_http_client: Optional[httpx.AsyncClient] = None
|
||||
self._local_seed: Optional[bytes] = None
|
||||
if not self._credentials and not self._credentials_hash:
|
||||
if (
|
||||
not self._credentials or self._credentials.username is None
|
||||
) and not self._credentials_hash:
|
||||
self._credentials = Credentials()
|
||||
if self._credentials:
|
||||
self._local_auth_hash = self.generate_auth_hash(self._credentials)
|
||||
|
Loading…
Reference in New Issue
Block a user