Closed bjm904 closed 7 years ago
Hm it's hanging during the first SSL login request to MyLeviton. I'm not sure what's different about your networking environment, but something isn't letting the requests through. Could it be a firewall, router, or VPN issue?
It does appear to be a ssl issue. I tried curl -v https://my.leviton.com/api
Trying 52.70.248.144...
TCP_NODELAY set
Connected to my.leviton.com (52.70.248.144) port 443 (#0)
ALPN, offering http/1.1
Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
successfully set certificate verify locations:
CAfile: /usr/share/curl/ca-bundle.crt
CApath: none
TLSv1.2 (OUT), TLS header, Certificate Status (22):
TLSv1.2 (OUT), TLS handshake, Client hello (1):
Unknown SSL protocol error in connection to my.leviton.com:443
Curl_http_done: called premature == 1
Closing connection 0
curl: (35) Unknown SSL protocol error in connection to my.leviton.com:443
I have not had any issues with other SSL connections. I tired all versions of ssl/tls manually:
curl -v --tlsv1.0 https://my.leviton.com/api
curl -v --tlsv1.1 https://my.leviton.com/api
curl -v --tlsv1.2 https://my.leviton.com/api
curl -v --sslv3 https://my.leviton.com/api
Fixed it. For completeness I'm going to explain what happened.
Turns out it was an issue with my network. MTU got set down to 1480. Setting it to 1500 fixed it. On my Mikrotik RouterOS router, a bridge interface's MTU decreased to 1480 after creating an EOIP tunnel that defaulted to 1480. After setting the EOIP tunnel to use 1500 MTU, the bridge changed to 1500 and everything started working correctly.
Worth noting that I have not noticed any other SSL connections not working on the network during this time. Possibly there is an argument you can add to the network calls that can work around this.
interesting. I've got the exact same issue, but MTU is 1500 on the network
Can you connect to https://my.leviton.com/api?
Yeah, curling it returns the There is no method to handle GET /
response though
And the traceback you're seeing is identical? Hanging on the session.login method?
I have no idea what changed but when I tried yesterday it started working
python3 cli-test.py email@gmail.com password ON
Testing the lib hangs. Upon Ctrl+C the following is shown:
Traceback (most recent call last): File "cli-test.py", line 21, in <module> session.login(decora_email, decora_pass) File "/root/test/python-decora_wifi-master/decora_wifi/__init__.py", line 76, in login login_json = Person.login(self, payload) File "/root/test/python-decora_wifi-master/decora_wifi/models/person.py", line 569, in login return session.call_api(api, attribs, 'post') File "/root/test/python-decora_wifi-master/decora_wifi/__init__.py", line 48, in call_api response = getattr(self._session, method)(uri, data=payload_json) File "/usr/lib64/python3.6/site-packages/requests-2.18.4-py3.6.egg/requests/sessions.py", line 555, in post return self.request('POST', url, data=data, json=json, **kwargs) File "/usr/lib64/python3.6/site-packages/requests-2.18.4-py3.6.egg/requests/sessions.py", line 508, in request resp = self.send(prep, **send_kwargs) File "/usr/lib64/python3.6/site-packages/requests-2.18.4-py3.6.egg/requests/sessions.py", line 618, in send r = adapter.send(request, **kwargs) File "/usr/lib64/python3.6/site-packages/requests-2.18.4-py3.6.egg/requests/adapters.py", line 440, in send timeout=timeout File "/usr/lib64/python3.6/site-packages/urllib3-1.22-py3.6.egg/urllib3/connectionpool.py", line 601, in urlopen chunked=chunked) File "/usr/lib64/python3.6/site-packages/urllib3-1.22-py3.6.egg/urllib3/connectionpool.py", line 346, in _make_request self._validate_conn(conn) File "/usr/lib64/python3.6/site-packages/urllib3-1.22-py3.6.egg/urllib3/connectionpool.py", line 850, in _validate_conn conn.connect() File "/usr/lib64/python3.6/site-packages/urllib3-1.22-py3.6.egg/urllib3/connection.py", line 326, in connect ssl_context=context) File "/usr/lib64/python3.6/site-packages/urllib3-1.22-py3.6.egg/urllib3/util/ssl_.py", line 329, in ssl_wrap_socket return context.wrap_socket(sock, server_hostname=server_hostname) File "/usr/lib64/python3.6/ssl.py", line 401, in wrap_socket _context=self, _session=session) File "/usr/lib64/python3.6/ssl.py", line 808, in __init__ self.do_handshake() File "/usr/lib64/python3.6/ssl.py", line 1061, in do_handshake self._sslobj.do_handshake() File "/usr/lib64/python3.6/ssl.py", line 683, in do_handshake self._sslobj.do_handshake() KeyboardInterrupt