Closed h00t2y closed 1 month ago
Made some changes according to #252 In client.py: instead: connector=TCPConnector(ssl=verify_ssl), connector=TCPConnector(ssl=verify_ssl, force_close=True),
And i add: await asyncio.sleep(0.1) before: async with self.session.post(......
Now with this: device_info = await client.get_device_info() print(f"{device_info.id} {device_info.model_name}") Output: 88:0F:A2:55:24:48 Fast5670AXv2
hosts and xpath commands are working as well now :)
@h00t2y have you tried the latest version of the package? We can see if we can include these fixes to the package.
Oh. I was on 1.0.5. :) 1.3.2 just worx! THX Could U help me with logout? What should be the correct lines to logout in my test.py?
Just await client.logout()
.
That was the first i tried but unf i got:
AC:6F:BB:2E:90:E8 - AC:6F:BB:2E:90:E8
EC:FA:BC:06:59:E1 - HAA-0659E1
Traceback (most recent call last):
File "/home/pi/sagem.py", line 35, in
After listing the first two devices got this error. If i have the line "reutrn" after "await client.logout()" got no error but still only lists the first two devices.
My test py:
import asyncio from sagemcom_api.client import SagemcomClient from sagemcom_api.enums import EncryptionMethod from sagemcom_api.exceptions import NonWritableParameterException
HOST = "192.168.1.1" USERNAME = "" PASSWORD = "" ENCRYPTION_METHOD = EncryptionMethod.SHA512
async def main() -> None: async with SagemcomClient(HOST, USERNAME, PASSWORD, ENCRYPTION_METHOD) as client: try: await client.login() except Exception as exception: # pylint: disable=broad-except print(exception) return
devices = await client.get_hosts()
for device in devices: if device.active: print(f"{device.id} - {device.name}")
await client.logout() asyncio.run(main())
Nevermind. It was some typo.
async def main() -> None:
async with SagemcomClient(HOST, USERNAME, PASSWORD, ENCRYPTION_METHOD) as client:
try:
await client.login()
except Exception as exception:
print(exception)
return
devices = await client.get_hosts()
for device in devices:
if device.active:
print(f"{device.id} - {device.name}")
await client.logout()
asyncio.run(main())
Now it worx! thx
Model information
I use SHA512 hashing. Tried on 3 different debian with python 3.7.3 and 3.9.3 as well.
Describe the bug
The python script fails with error : aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected It happens when the script runs Device/DeviceInfo command.
I can see from the router's log that login was successfull. Please find attached log of tree values.
What could be my problem? sagemcom5670valuestree.txt
[bug]