huawei-lte-api icon indicating copy to clipboard operation
huawei-lte-api copied to clipboard

Exception on log-out ResponseErrorWrongSessionToken: 125003: Wrong Session Token

Open Salamek opened this issue 2 years ago • 3 comments

As mentioned in #159 :

One last addition : logout seems to fail on my hardware even with an account set, as shown below : EDIT: this behaviour is common to 1.6.4 and 1.6.7 when using default account

# ./data_dump.py --username admin --password admin http://192.168.8.1
...
==== Developer.atport_status
100002: No support

Traceback (most recent call last):
  File "/home/npillot/huawei-lte-api_1.6.7/examples/./data_dump.py", line 334, in <module>
    dump(client.developer.atport_status)
  File "/home/npillot/huawei-lte-api_1.6.7/examples/./../huawei_lte_api/Connection.py", line 54, in __exit__
    self.close()
  File "/home/npillot/huawei-lte-api_1.6.7/examples/./../huawei_lte_api/Connection.py", line 42, in close
    self.user_session.close()
  File "/home/npillot/huawei-lte-api_1.6.7/examples/./../huawei_lte_api/api/User.py", line 30, in close
    self.user.logout()
  File "/home/npillot/huawei-lte-api_1.6.7/examples/./../huawei_lte_api/api/User.py", line 115, in logout
    return self._session.post_set('user/logout', {
  File "/home/npillot/huawei-lte-api_1.6.7/examples/./../huawei_lte_api/Session.py", line 215, in post_set
    self._post(endpoint, data, refresh_csrf, prefix, is_encrypted, is_json)
  File "/home/npillot/huawei-lte-api_1.6.7/examples/./../huawei_lte_api/Session.py", line 34, in wrapped
    return fn(*args, **kw)
  File "/home/npillot/huawei-lte-api_1.6.7/examples/./../huawei_lte_api/Session.py", line 254, in _post
    response_data = cast(str, self._check_response_status(self._process_response_data(response)))
  File "/home/npillot/huawei-lte-api_1.6.7/examples/./../huawei_lte_api/Session.py", line 156, in _check_response_status
    raise error_code_to_exception.get(error_code, ResponseErrorException)(
huawei_lte_api.exceptions.ResponseErrorWrongSessionToken: 125003: Wrong Session Token

Salamek avatar Dec 19 '22 13:12 Salamek

Should be fixed in https://github.com/Salamek/huawei-lte-api/pull/169 i guess...

Salamek avatar Jan 15 '23 23:01 Salamek

Hm, I'm not sure, in #169 ResponseErrorLoginRequiredException and ResponseErrorNotSupportedException are the suppressed exceptions, whereas here ResponseErrorWrongSessionToken is raised.

Then again I might be missing something. Or then again ResponseErrorWrongSessionToken could be similarly suppressed as the other two, doesn't seem there's anything that could be done about that as far as closing a session goes either.

scop avatar Jan 16 '23 20:01 scop

Oh, you are right, wrong exception

Salamek avatar Jan 17 '23 10:01 Salamek