ERROR:root:Exception in dhanhq>>get_positions

Hi,

I am observing an Error while fetching data from library

Code:
from dhanhq import dhanhq
client_id=“1104246630”
access_token=“eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJkaGFuIiwicGFydG5lcklkIjoiIiwiZXhwIjoxNzM3Mzg1NDc5LCJ0b2tlbkNvbnN1bWVyVHlwZSI6IlNFTEYiLCJ3ZWJob29rVXJsIjoiIiwiZGhhbkNsaWVudElkIjoiMTEwNDI0NjYzMCJ9.2oScV4lhVvYDA0jM8blFcrqKWlCRgDbjB5-U9-oCeo280ps4dNK7XZYbh136kq9Iqdwbztdxed0uIceRF6pQOg”

dhan = dhanhq(client_id,access_token)
print(dhan.get_positions())

ERROR DESCRIPTION:
PS C:\Users\anupojs\AppData\Local\Programs\Python\Python313\Scripts> & C:/Users/anupojs/AppData/Local/Programs/Python/Python313/python.exe c:/Users/anupojs/AppData/Local/Programs/Python/Python313/Scripts/ConnectDhan.py
ERROR:root:Exception in dhanhq>>get_positions: HTTPSConnectionPool(host=‘api.dhan.co’, port=443): Max retries exceeded with url: /v2/positions (Caused by SSLError(SSLCertVerificationError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: Basic Constraints of CA cert not marked critical (_ssl.c:1018)’)))
{‘status’: ‘failure’, ‘remarks’: “HTTPSConnectionPool(host=‘api.dhan.co’, port=443): Max retries exceeded with url: /v2/positions (Caused by SSLError(SSLCertVerificationError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: Basic Constraints of CA cert not marked critical (_ssl.c:1018)’)))”, ‘data’: ‘’}

Please help me to solve this error

Hi @Srinivasu

Do check this link : https://www.youtube.com/watch?v=DPWU5wLuYcQ&list=PLnuHyqUCoJsPA4l9KRLrNpWLIfZ9ucLxx&index=7

Also, do post all your queries on this thread: Learn Algo Trading with Python | Codes | Youtube Series

This helps me keep track of questions and ensures other traders benefit as well, as they might be facing similar issues…