generate_session - Max retries exceeded with url - certificate verify failed

VJ8403
Since Morning, I am getting this error. Can someone please help me to resolve this?

data = kite.generate_session(request_token, api_secret=key_secret[1])
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/kiteconnect-3.7.7-py3.7.egg/kiteconnect/connect.py", line 232, in generate_session
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/kiteconnect-3.7.7-py3.7.egg/kiteconnect/connect.py", line 701, in _post
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/kiteconnect-3.7.7-py3.7.egg/kiteconnect/connect.py", line 745, in _request
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/kiteconnect-3.7.7-py3.7.egg/kiteconnect/connect.py", line 742, in _request
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/requests/api.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/requests/sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/requests/sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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')])")))

  • VJ8403
    This doesn't help. Did lots of research in google before posting here. Nothing helped.

    $pip install --upgrade certifi --trusted-host pypi.org --trusted-host files.pythonhosted.org
    Requirement already up-to-date: certifi in /Users/xxx/Desktop/xx/venv/lib/python3.7/site-packages (2020.6.20)
  • rakeshr
    Seems to be Self-signed SSL certificates issues for requests. Maybe this can help.
  • VJ8403
    @rakeshr Thank you so much for the link. After copying the root certificates, it worked. Spent more than 16 hours on this. You saved my time.
This discussion has been closed.