Learn Algo Trading with Python | Codes | Youtube Series

Hi @Dinesh_Sharma @ddeogharkar @Abhishek_Konda @ShantiPar66

In case of SSL: CERTIFICATE_VERIFY_FAILED Use below methods one by one,
after completing each method try to run the code again to check if SSL issue is still there, if it is… then goto next step

SSL issue is mostly created when we use office laptop or vpn

  1. Install CERTIFI
    Press Windows + R.
    Type cmd and hit Enter. This opens the Command Prompt.
    In the Command Prompt window, type the following command
    pip install certifi --upgrade
    and press Enter, (this will update cerifi package)

  2. Disable SSL check
    I am giving you a new file Dhan_websocket SSL_issue_fixed.py
    instead of running Dhan_websocket.py, now run Dhan_websocket SSL_issue_fixed.py
    Dhan_websocket SSL_issue_fixed.py - Google Drive

  3. Update Certificates
    Press Win + S to open the search bar.
    Type PowerShell.
    Right-click on Windows PowerShell from the search results.
    Select Run as administrator.
    If prompted by User Account Control (UAC), click Yes.

    Now run following two commands one by one:
    certutil -generateSSTFromWU roots.sst
    certutil -addstore -f root roots.sst

    Thanks @ABCDIt for PowerShell solution

  4. Change Laptop and Network
    Most probably the issue is fixed by now, but if we still we find SSL issue, maybe a quicker method would be to

    a) run the code on your home laptop and your home internet

    b) install files on AWS free 2GB server and test the same. There we would have a Free + Dedicated + Secure + Enough Bandwidth environment, and the files would run normally there.

5 Likes