dimme / tapo-cli

Command-line utility for batch-downloading your videos from the Tapo TP-Link Cloud.
22 stars 2 forks source link

Cannot download videos, error code -20212 "Incorrect service entry address", "Please login first." #6

Open olivievranska opened 3 months ago

olivievranska commented 3 months ago

Hello,

when I try to fill my Tapo credentials by command ./tapo-cli.py login and put my Tapo credentials, I got error: Something went wrong: ( "appServerUrl": "https://n-euw1-wap-gw.tplinkcloud.com", "errorCode": "-20212", "errorMsg": "Incorrect service entry address" }

When I tried to download videos, I got error "Please login first."

Please correct or suggest working solution.

Thank you and have a nice day.

Best regards olivie

Related to re-opened #3

dimme commented 3 months ago

Thanks for the report. I will look at it when I have some time, but to be realistic I will not have time before summer vacations.

olivievranska commented 3 months ago

Thanks for the report. I will look at it when I have some time, but to be realistic I will not have time before summer vacations.

Dear dimme, I understand. I can to try to help you if you'd suggest how to find the updated appServerUrl :-)

If i properly understand the code in tapo-cli.py, you are using Android Tapo app and debug in background what is app doing. BlueStack is still up-to-date on my laptop so if you would explain how to get needed data. I'm in IT since 1996, I can understand the general logic of simple structured code but I'm not a developer :-)))

If I'd be successful, I'll provide you logs and then it would be more easy to update your code.

Let me know if you are interested.

Have a nice day!

dimme commented 3 months ago

It involves running the app though an HTTPS proxy like Burp or similar and looking what it is doing. You need to trust the Burp Root CA certificate on the phone to be able to see the traffic. Since newer phones apply certificate pinning, I use an older Android phone to do this task. As long as the app runs there I will be able to intercept and see traffic.

olivievranska commented 3 months ago

It involves running the app though an HTTPS proxy like Burp or similar and looking what it is doing. You need to trust the Burp Root CA certificate on the phone to be able to see the traffic. Since newer phones apply certificate pinning, I use an older Android phone to do this task. As long as the app runs there I will be able to intercept and see traffic.

Thank you for details, it's working again. I'm able to save my tapo logon data.

But only partially, I got another error - it appears when I try to download any video or only if I try to list any video:

`Traceback (most recent call last):
File "/home/olivie/.local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 467, in _make_request
self._validate_conn(conn)
File "/home/olivie/.local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 1099, in _validate_conn
conn.connect()
File "/home/olivie/.local/lib/python3.10/site-packages/urllib3/connection.py", line 653, in connect
sock_and_verified = _ssl_wrap_socket_and_match_hostname(
File "/home/olivie/.local/lib/python3.10/site-packages/urllib3/connection.py", line 806, in _ssl_wrap_socket_and_match_hostname
ssl_sock = ssl_wrapsocket(
File "/home/olivie/.local/lib/python3.10/site-packages/urllib3/util/ssl
.py", line 465, in ssl_wrap_socket
ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls, serverhostname)
File "/home/olivie/.local/lib/python3.10/site-packages/urllib3/util/ssl
.py", line 509, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
File "/usr/lib/python3.10/ssl.py", line 513, in wrap_socket
return self.sslsocket_class._create(
File "/usr/lib/python3.10/ssl.py", line 1100, in _create
self.do_handshake()
File "/usr/lib/python3.10/ssl.py", line 1371, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: UNSAFE_LEGACY_RENEGOTIATION_DISABLED] unsafe legacy renegotiation disabled (_ssl.c:1007)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/olivie/.local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 793, in urlopen
response = self._make_request(
File "/home/olivie/.local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 491, in _make_request
raise new_e
urllib3.exceptions.SSLError: [SSL: UNSAFE_LEGACY_RENEGOTIATION_DISABLED] unsafe legacy renegotiation disabled (_ssl.c:1007)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/olivie/.local/lib/python3.10/site-packages/requests/adapters.py", line 486, in send
resp = conn.urlopen(
File "/home/olivie/.local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 847, in urlopen
retries = retries.increment(
File "/home/olivie/.local/lib/python3.10/site-packages/urllib3/util/retry.py", line 515, in increment
raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type]
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='euw1-app-tapo-care.i.tplinknbu.com', port=443): Max retries exceeded with url: /v2/vi deos/list?deviceId=8021528681746520B511E3CF23EBEB7D2011E310&page=0&pageSize=3000&order=desc&startTime=2024-04-29%2000:00:00&endTime=2024-05-01%20 00:00:00 (Caused by SSLError(SSLError(1, '[SSL: UNSAFE_LEGACY_RENEGOTIATION_DISABLED] unsafe legacy renegotiation disabled (_ssl.c:1007)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/olivie/tapo-cli/tapo-cli.py", line 366, in
tapo()
File "/home/olivie/.local/lib/python3.10/site-packages/click/core.py", line 1157, in call
return self.main(args, kwargs)
File "/home/olivie/.local/lib/python3.10/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
File "/home/olivie/.local/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/olivie/.local/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback,
ctx.params)
File "/home/olivie/.local/lib/python3.10/site-packages/click/core.py", line 783, in invoke
return __callback(
args, kwargs)
File "/home/olivie/tapo-cli/tapo-cli.py", line 325, in download_videos
videos = probe_endpoint_get(params, endpoint)
File "/home/olivie/tapo-cli/tapo-cli.py", line 119, in probe_endpoint_get
res = get(url, params, headers_get(token))
File "/home/olivie/tapo-cli/tapo-cli.py", line 91, in get
return json.loads(requests.get(url, params = params, headers = headers, verify = False).text)
File "/home/olivie/.local/lib/python3.10/site-packages/requests/api.py", line 73, in get
return request("get", url, params=params,
kwargs)
File "/home/olivie/.local/lib/python3.10/site-packages/requests/api.py", line 59, in request
return session.request(method=method, url=url, kwargs)
File "/home/olivie/.local/lib/python3.10/site-packages/requests/sessions.py", line 589, in request
resp = self.send(prep,
send_kwargs)
File "/home/olivie/.local/lib/python3.10/site-packages/requests/sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
File "/home/olivie/.local/lib/python3.10/site-packages/requests/adapters.py", line 517, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='euw1-app-tapo-care.i.tplinknbu.com', port=443): Max retries exceeded with url: /v2/videos /list?deviceId=8021528681746520B511E3CF23EBEB7D2011E310&page=0&pageSize=3000&order=desc&startTime=2024-04-29%2000:00:00&endTime=2024-05-01%2000:0 0:00 (Caused by SSLError(SSLError(1, '[SSL: UNSAFE_LEGACY_RENEGOTIATION_DISABLED] unsafe legacy renegotiation disabled (_ssl.c:1007)'))) `

Please could you be so kind and support?

Thank you and have a nice day.

Best regards olivie