Closed
Description
The dump_devinfo script defaults to None which causes a crash inside the transport for non-legacy devices:
Testing Call(module='component_nego', method='component_nego')..FAIL Unable to connect to the device: 192.168.x.x: 'NoneType' object has no attribute 'encode'
Traceback (most recent call last):
File "/home/tpr/code/python-kasa/kasa/smartprotocol.py", line 89, in _query
return await self._execute_query(request, retry)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/tpr/code/python-kasa/kasa/smartprotocol.py", line 160, in _execute_query
response_data = await self._transport.send(smart_request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/tpr/code/python-kasa/kasa/aestransport.py", line 265, in send
await self.perform_login()
File "/home/tpr/code/python-kasa/kasa/aestransport.py", line 192, in perform_login
await self._perform_login_for_version(login_version=2)
File "/home/tpr/code/python-kasa/kasa/aestransport.py", line 175, in _perform_login_for_version
un, pw = self.hash_credentials(login_version == 2)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/tpr/code/python-kasa/kasa/aestransport.py", line 91, in hash_credentials
_sha1(self._credentials.username.encode()).encode()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'encode'
This is likely a regression, but passing ""
as default in the script will cause another failure that could be handled more gracefully.
Ping @sdb9696 just in case you are not subscribed to new issues & PRs in the repository :-)
Also, the help text in https://github.com/python-kasa/python-kasa/tree/master/devtools#dump_devinfo should be updated.