AlexandrErohin / TP-Link-Archer-C6U

Python package for API access and management for TP-Link Routers. See supported routers list
GNU General Public License v3.0
43 stars 14 forks source link

JSON Parse error #13

Closed FayeParship closed 7 months ago

FayeParship commented 7 months ago

Hi, im getting a json parse error even though the response value seems to be valid json. Any idea?

response.text output: {"data":"V91SCKGNBUpSyV0vhtTUTxSraG96i9gpP/UHARnmoDmQf+DJvKlv1jME/Bw164Aadg3VhU5ErvX7RhGqJ6cx6OkVPxjF0RtWiKOdK/U988g="}

TplinkRouter - C6 - Cannot authorize! Error - Expecting value: line 1 column 1 (char 0); Response - Traceback (most recent call last): File "/Users/faye.schipper/.pyenv/versions/3.10.8/lib/python3.10/site-packages/requests/models.py", line 971, in json return complexjson.loads(self.text, **kwargs) File "/Users/faye.schipper/.pyenv/versions/3.10.8/lib/python3.10/json/init.py", line 346, in loads return _default_decoder.decode(s) File "/Users/faye.schipper/.pyenv/versions/3.10.8/lib/python3.10/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/Users/faye.schipper/.pyenv/versions/3.10.8/lib/python3.10/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/faye.schipper/Downloads/TP-Link-Archer-C6U-main/tplinkrouterc6u/client.py", line 268, in authorize data = response.json() File "/Users/faye.schipper/.pyenv/versions/3.10.8/lib/python3.10/site-packages/requests/models.py", line 975, in json raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

AlexandrErohin commented 7 months ago

What is your router's model and hardware version?

fayeinmay commented 7 months ago

What is your router's model and hardware version?

I've got the Tp-Link Archer AX6000

Firmware Version: 1.3.2 Build 20230906 rel.52143(4555) Hardware Version: Archer AX6000 v1.0

(Still me, just work github account vs private github account ^^)

AlexandrErohin commented 7 months ago

it looks like data cannot be decoded here https://github.com/AlexandrErohin/TP-Link-Archer-C6U/blob/main/tplinkrouterc6u/client.py#L268

fayeinmay commented 7 months ago

it looks like data cannot be decoded here https://github.com/AlexandrErohin/TP-Link-Archer-C6U/blob/main/tplinkrouterc6u/client.py#L268

I included a log line for the response.text in the source files so L268 is actually the response.json() line for me.

AlexandrErohin commented 7 months ago

the problem is that the encrypted data from json cannot be decoded properly https://github.com/AlexandrErohin/TP-Link-Archer-C6U/blob/main/tplinkrouterc6u/client.py#L268

data = self._decrypt_response(data)
fayeinmay commented 7 months ago

the problem is that the encrypted data from json cannot be decoded properly https://github.com/AlexandrErohin/TP-Link-Archer-C6U/blob/main/tplinkrouterc6u/client.py#L268

data = self._decrypt_response(data)

Well in that case, do you have any idea why that might be considering that model should be supported?

AlexandrErohin commented 7 months ago

AX6000 V1 support was confirmed here https://github.com/AlexandrErohin/home-assistant-tplink-router/issues/20

fayeinmay commented 7 months ago

Issue can be closed. Typical user error. (Java dev trying to do python stuff)

AlexandrErohin commented 7 months ago

So the integration works OK with your router?

fayeinmay commented 7 months ago

Correct