Salamek / huawei-lte-api

API For huawei LAN/WAN LTE Modems
GNU Lesser General Public License v3.0
376 stars 92 forks source link

Connection to E5186s-22a failed. 125002: Session error #61

Closed wisekki closed 4 years ago

wisekki commented 4 years ago

I'm trying to connect to my huawei lte with the code example from README.md. Can someone please tell me what I'm doing wrong. I'm using Python 3.7.5 and ip/username/pwd are correct. Thank you!

from huawei_lte_api.Client import Client from huawei_lte_api.AuthorizedConnection import AuthorizedConnection from huawei_lte_api.Connection import Connection

connection = AuthorizedConnection('http://admin:pwd@192.168.1.1/')

client = Client(connection) # This just simplifies access to separate API groups

print(client.device.signal()) # Can be accessed without authorization print(client.device.information())

and this is the result:

root@firewall:/root# python3 test.py Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/huawei_lte_api/Connection.py", line 22, in wrapped return fn(*args, **kw) File "/usr/local/lib/python3.7/dist-packages/huawei_lte_api/Connection.py", line 169, in get return self._check_response_status(self._process_response_xml(response)) File "/usr/local/lib/python3.7/dist-packages/huawei_lte_api/Connection.py", line 91, in _check_response_status error_code huawei_lte_api.exceptions.ResponseErrorLoginCsrfException: 125002: Session error

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "test.py", line 7, in connection = AuthorizedConnection('http://admin:pwd@192.168.1.1/') File "/usr/local/lib/python3.7/dist-packages/huawei_lte_api/AuthorizedConnection.py", line 24, in init if self.user.login(True): File "/usr/local/lib/python3.7/dist-packages/huawei_lte_api/api/User.py", line 76, in login state_login = self.state_login() File "/usr/local/lib/python3.7/dist-packages/huawei_lte_api/api/User.py", line 27, in state_login return self._connection.get('user/state-login') File "/usr/local/lib/python3.7/dist-packages/huawei_lte_api/Connection.py", line 25, in wrapped return fn(*args, **kw) File "/usr/local/lib/python3.7/dist-packages/huawei_lte_api/Connection.py", line 169, in get return self._check_response_status(self._process_response_xml(response)) File "/usr/local/lib/python3.7/dist-packages/huawei_lte_api/Connection.py", line 91, in _check_response_status error_code huawei_lte_api.exceptions.ResponseErrorLoginCsrfException: 125002: Session error

octave21 commented 4 years ago

Here my code which works well with Python 3.8 (take care of the issue #56 when using the API)

wisekki commented 4 years ago

Thank you for the response and code example.. unfortunately I only get:

lte.py 192.168.1.1 pwd stat Connexion error - 125002: Session error

My E5186 has the following firmware:

Firmware: CL1E5175HM
Program version: 21.316.01.01.182
Web UI -version: 16.100.02.00.03
octave21 commented 4 years ago

ok I suppose your IP is correct, because my default IP is 192.168.8.1

wisekki commented 4 years ago

Yes it is correct.. I can utilize the modem with api written in PHP but I really need one with python for full home assistant support :)

Salamek commented 4 years ago

@wisekki can you try huawei-lte-api version 1.4.6 ?

wisekki commented 4 years ago

@Salamek hey now it works! And I can send text messages nicely. Very nice work indeed. Thank you!