TPLink-Python icon indicating copy to clipboard operation
TPLink-Python copied to clipboard

Except when doing first test

Open xLasttDev opened this issue 3 years ago • 2 comments
trafficstars

I'm testing with Model No. TL-WR841N / TL-WR841ND Router, and get except with

<----------to get router details---------->

**tp_client: <tplink_python.TPLinkClient object at 0x000001CE8B383FD0>**

Traceback (most recent call last):
  File "C:\Users\xLasttPC\Desktop\TPLink\test.py", line 67, in <module>
    test()
  File "C:\Users\xLasttPC\Desktop\TPLink\test.py", line 14, in test
    router_details = tp_client.get_router_details()
  File "C:\Users\xLasttPC\Desktop\TPLink\tplink_python.py", line 67, in get_router_details
    model_name = re.findall(r"(?i)modelName=(?P<modelName>.+)", response)[0].strip()
IndexError: list index out of range

all lists gets empty data login success(?): tp_client: <tplink_python.TPLinkClient object at 0x000001CE8B383FD0>

xLasttDev avatar Mar 30 '22 03:03 xLasttDev

Hi @xLasttDev, that means the parsing is not returning any data. It seems the model is using different strategies to communicate which is very common to Tplink. I would encourage you to dive deep into it using tools like Postman interceptor or Chrome developer tool to check what payload TPLink frontend is sending to communicate with the backend. Hope this helps.

epsi95 avatar Apr 01 '22 03:04 epsi95

I'm testing it with TL-WDR5620 and I get the response below, what does the code mean?

{"error_code":-40210}
Traceback (most recent call last):
  File "/home/pi/reps/TPLink-Python/tplink_python.py", line 318, in <module>
    tp_client.get_router_details()
  File "/home/pi/reps/TPLink-Python/tplink_python.py", line 67, in get_router_details
    model_name = re.findall(r"(?i)modelName=(?P<modelName>.+)", response)[0].strip()
IndexError: list index out of range

caimaoy avatar Apr 21 '22 03:04 caimaoy