sampsyo / wideq

reverse-engineered client for the LG SmartThinQ API
https://pypi.org/project/wideq/
MIT License
332 stars 159 forks source link

SSL error #106

Closed potshot closed 4 years ago

potshot commented 4 years ago

`Traceback (most recent call last): File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 600, in urlopen chunked=chunked) File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 343, in _make_request self._validate_conn(conn) File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 841, in _validate_conn conn.connect() File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 344, in connect sslcontext=context) File "/usr/lib/python3/dist-packages/urllib3/util/ssl.py", line 344, in ssl_wrap_socket return context.wrap_socket(sock, server_hostname=server_hostname) File "/usr/lib/python3.7/ssl.py", line 412, in wrap_socket session=session File "/usr/lib/python3.7/ssl.py", line 853, in _create self.do_handshake() File "/usr/lib/python3.7/ssl.py", line 1117, in do_handshake self._sslobj.do_handshake() ssl.SSLError: [SSL: UNSUPPORTED_PROTOCOL] unsupported protocol (_ssl.c:1056)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3/dist-packages/requests/adapters.py", line 449, in send timeout=timeout File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 667, in urlopen response_kw) File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 667, in urlopen response_kw) File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 667, in urlopen **response_kw) [Previous line repeated 2 more times] File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 638, in urlopen _stacktrace=sys.exc_info()[2]) File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 398, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='aic.lgthinq.com', port=46030): Max retries exceeded with url: /api/member/login (Caused by SSLError(SSLError(1, '[SSL: UNSUPPORTED_PROTOCOL] unsupported protocol (_ssl.c:1056)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "example.py", line 272, in main() File "example.py", line 268, in main example(args.country, args.language, args.verbose, args.cmd, args.args) File "example.py", line 209, in example example_command(client, cmd, args) File "example.py", line 178, in example_command func(client, *args) File "example.py", line 34, in ls for device in client.devices: File "/home/jbuck/dev/lg/wideq/wideq/client.py", line 126, in devices self._devices = self.session.get_devices() File "/home/jbuck/dev/lg/wideq/wideq/client.py", line 117, in session self._session, self._devices = self.auth.start_session() File "/home/jbuck/dev/lg/wideq/wideq/core.py", line 362, in start_session self.gateway.country, self.gateway.language) File "/home/jbuck/dev/lg/wideq/wideq/core.py", line 258, in login return lgedm_post(url, data) File "/home/jbuck/dev/lg/wideq/wideq/core.py", line 202, in lgedm_post res = session.post(url, json={DATA_ROOT: data}, headers=headers) File "/usr/lib/python3/dist-packages/requests/sessions.py", line 581, in post return self.request('POST', url, data=data, json=json, kwargs) File "/usr/lib/python3/dist-packages/requests/sessions.py", line 533, in request resp = self.send(prep, send_kwargs) File "/usr/lib/python3/dist-packages/requests/sessions.py", line 646, in send r = adapter.send(request, **kwargs) File "/usr/lib/python3/dist-packages/requests/adapters.py", line 514, in send raise SSLError(e, request=request) requests.exceptions.SSLError: HTTPSConnectionPool(host='aic.lgthinq.com', port=46030): Max retries exceeded with url: /api/member/login (Caused by SSLError(SSLError(1, '[SSL: UNSUPPORTED_PROTOCOL] unsupported protocol (_ssl.c:1056)')))`

After running example.py this error occurred. I tried upgrading python3 to 3.7.4 and 3.8 to no effect.

town3r commented 4 years ago

What was the issue?

potshot commented 4 years ago

What was the issue?

Changing the minimum required version of tls to 1.0 in the openssl config file.

town3r commented 4 years ago

Hmm I tried that and am still running into issues.

pi@ToWn3r-Homebridge:~ $ wideq auth -c US -l en-US
Log in here: https://us.m.lgaccount.com/login/sign_in?country=US&language=en-US&svcCode=SVC202&authSvr=oauth2&client_id=LGAO221A02&division=ha&grant_type=password
Then paste the URL where the browser is redirected: https://us.m.lgaccount.com/login/iabClose?access_token=1234&refresh_token=1234&oauth2_backend_url=https://us.lgeapi.com/
(node:9819) UnhandledPromiseRejectionWarning: Error: write EPROTO 3069297872:error:1425F102:SSL routines:ssl_choose_client_version:unsupported protocol:../deps/openssl/openssl/ssl/statem/statem_lib.c:1942:

    at WriteWrap.onWriteComplete [as oncomplete] (internal/stream_base_commons.js:92:16)
(node:9819) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:9819) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
town3r commented 4 years ago

image