mirror of
				https://github.com/python-kasa/python-kasa.git
				synced 2025-10-31 04:31:54 +00:00 
			
		
		
		
	Fix cli discover bug with None username/password (#615)
This commit is contained in:
		| @@ -64,7 +64,9 @@ class AesTransport(BaseTransport): | |||||||
|         super().__init__(config=config) |         super().__init__(config=config) | ||||||
|  |  | ||||||
|         self._login_version = config.connection_type.login_version |         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() |             self._credentials = Credentials() | ||||||
|         if self._credentials: |         if self._credentials: | ||||||
|             self._login_params = self._get_login_params() |             self._login_params = self._get_login_params() | ||||||
|   | |||||||
| @@ -395,7 +395,7 @@ async def discover(ctx): | |||||||
|     timeout = ctx.parent.params["timeout"] |     timeout = ctx.parent.params["timeout"] | ||||||
|     port = ctx.parent.params["port"] |     port = ctx.parent.params["port"] | ||||||
|  |  | ||||||
|     credentials = Credentials(username, password) |     credentials = Credentials(username, password) if username and password else None | ||||||
|  |  | ||||||
|     sem = asyncio.Semaphore() |     sem = asyncio.Semaphore() | ||||||
|     discovered = dict() |     discovered = dict() | ||||||
|   | |||||||
| @@ -100,7 +100,9 @@ class KlapTransport(BaseTransport): | |||||||
|  |  | ||||||
|         self._default_http_client: Optional[httpx.AsyncClient] = None |         self._default_http_client: Optional[httpx.AsyncClient] = None | ||||||
|         self._local_seed: Optional[bytes] = 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() |             self._credentials = Credentials() | ||||||
|         if self._credentials: |         if self._credentials: | ||||||
|             self._local_auth_hash = self.generate_auth_hash(self._credentials) |             self._local_auth_hash = self.generate_auth_hash(self._credentials) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 sdb9696
					sdb9696