Hi I have taken subscription to Beginner account and I am trying to fetch data from my broker via API.
This is the documentation of my brokers python library : https://dhanhq.co/docs/v2/
However whenever I try to fetch live data I get a forbidden error either 401 or some other connection error. Can you kindly whitelist this if possible.
Sharing a sample code
url = 'https://api.dhan.co/v2/optionchain'
headers = {
'access-token': access_token,
'client-id': client_id,
'Content-Type': 'application/json'
}
payload = {
'UnderlyingScrip': underlying_secid, # 13, 25
'UnderlyingSeg': exch_seg, # 'AAPL', 'TCS'
'Expiry': expiry # '2024-12-26'
}
response = requests.post(url, headers=headers, json=payload)
Getting 401 error; whereas its 200 in Local
Please let me know for any other details you would require.