Most of the times when I try to generate a session with Kite, I am getting cryptography.x509 error. The problem is I am able to connect few times. However majority of the times I am getting this error. Following is the error output. Could anyone please let me know what is the issue here?
Thanks in advance.
data = kite.generate_session(request_token, api_secret=api_secret) DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.kite.trade:443 Traceback (most recent call last):
File "", line 1, in data = kite.generate_session(request_token, api_secret=api_secret)
File "/home/pi/.local/lib/python3.7/site-packages/kiteconnect/connect.py", line 252, in generate_session "checksum": checksum
File "/home/pi/.local/lib/python3.7/site-packages/kiteconnect/connect.py", line 821, in _post return self._request(route, "POST", params)
File "/home/pi/.local/lib/python3.7/site-packages/kiteconnect/connect.py", line 865, in _request raise e
File "/home/pi/.local/lib/python3.7/site-packages/kiteconnect/connect.py", line 862, in _request proxies=self.proxies)
File "/usr/lib/python3/dist-packages/requests/api.py", line 60, in request return session.request(method=method, url=url, **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 449, in send timeout=timeout
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 355, in connect cert = self.sock.getpeercert()
File "/usr/lib/python3/dist-packages/urllib3/contrib/pyopenssl.py", line 360, in getpeercert 'subjectAltName': get_subj_alt_name(x509)
File "/usr/lib/python3/dist-packages/urllib3/contrib/pyopenssl.py", line 211, in get_subj_alt_name x509.SubjectAlternativeName
File "/home/pi/.local/lib/python3.7/site-packages/cryptography/x509/extensions.py", line 131, in get_extension_for_class "No {} extension was found".format(extclass), extclass.oid
ExtensionNotFound: No < class 'cryptography.x509.extensions.SubjectAlternativeName' > extension was found
Thanks.
You can try re-installing cryptography using
pip install cryptography
.