SSLError(MaxRetryError('HTTPSConnectionPool(host=\'api.kite.trade\', port=443): Max retries exceeded

krmadala
version kiteconnect==3.8.2
kite = KiteConnect(api_key="xxxxx")
data = kite.generate_session("xxxxx", api_secret="xxxxxxxxx")
throwing error at second line

Error: 500 Internal Server Error

SSLError(MaxRetryError('HTTPSConnectionPool(host=\'api.kite.trade\', port=443): Max retries exceeded with url: /session/token (Caused by SSLError(SSLError("bad handshake: Error([(\'SSL routines\', \'tls_process_server_certificate\', \'certificate verify failed\')],)",),))',),)


Traceback (most recent call last):
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\urllib3\contrib\pyopenssl.py", line 485, in wrap_socket
cnx.do_handshake()
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\OpenSSL\SSL.py", line 1934, in do_handshake
self._raise_ssl_error(self._ssl, result)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\OpenSSL\SSL.py", line 1671, in _raise_ssl_error
_raise_current_error()
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\OpenSSL\_util.py", line 54, in exception_from_error_queue
raise exception_type(errors)
OpenSSL.SSL.Error: [('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\urllib3\connectionpool.py", line 672, in urlopen
chunked=chunked,
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\urllib3\connectionpool.py", line 376, in _make_request
self._validate_conn(conn)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\urllib3\connectionpool.py", line 994, in _validate_conn
conn.connect()
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\urllib3\connection.py", line 360, in connect
ssl_context=context,
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\urllib3\util\ssl_.py", line 370, in ssl_wrap_socket
return context.wrap_socket(sock, server_hostname=server_hostname)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\urllib3\contrib\pyopenssl.py", line 491, in wrap_socket
raise ssl.SSLError("bad handshake: %r" % e)
ssl.SSLError: ("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\requests\adapters.py", line 449, in send
timeout=timeout
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\urllib3\connectionpool.py", line 720, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\urllib3\util\retry.py", line 436, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.kite.trade', port=443): Max retries exceeded with url: /session/token (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\bottle.py", line 868, in _handle
return route.call(**args)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\bottle.py", line 1748, in wrapper
rv = callback(*a, **ka)
File "C:\Users\K.Madala\source\repos\BottleWebProject1\BottleWebProject1\app.py", line 28, in hello
data = kite.generate_session("f36deOZ32H1hIsAfOTBBoaAuWNYwrT1k", api_secret="vgg7n167hdtt1jn2xdam7zlow83iz09v")
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\kiteconnect\connect.py", line 252, in generate_session
"checksum": checksum
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\kiteconnect\connect.py", line 821, in _post
return self._request(route, "POST", params)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\kiteconnect\connect.py", line 865, in _request
raise e
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\kiteconnect\connect.py", line 862, in _request
proxies=self.proxies)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\requests\api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\requests\sessions.py", line 530, in request
resp = self.send(prep, **send_kwargs)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\requests\sessions.py", line 643, in send
r = adapter.send(request, **kwargs)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\requests\adapters.py", line 514, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='api.kite.trade', port=443): Max retries exceeded with url: /session/token (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),))
  • krmadala
    Can any body help me to solve above issue
  • Sree
    @krmadala
    you can refer this similar thread here
  • krmadala
    Thanks @Sree ,
    But the issue is not with kite .Actually i am using company laptop they installed some security related tools in laptop.So from that moment onwards i am getting this issue.I am looking into the thread which you sent to me.
  • VJ8403
    @krmadala Your problem resolved? I am also having the same problem. I am also using a company laptop and they have installed some security tools, after that, I am getting this error.
  • VJ8403
    @krmadala If the issue not resolved, try this. This resolved my issue.
This discussion has been closed.