Option Chain data fetch

Hello Team ,

New bie here.

My authorization requests turns out to be successful , but while
I am trying to fetch option chain data by using the code used in the examples

url = ‘https://api.upstox.com/v2/option/chain
params = {
‘instrument_key’: ‘NSE_INDEX|Nifty 50’,
‘expiry_date’: ‘2025-01-30’
}
headers = {
‘Accept’: ‘application/json’,
‘Authorization’: f’Bearer {{access_token}}’
}

response = requests.get(url, params=params, headers=headers)

print(response.json())

I am getting the following error

status’: ‘error’, ‘errors’: [{‘errorCode’: ‘UDAPI100050’, ‘message’: ‘Invalid token used to access API’, ‘propertyPath’: None, ‘invalidValue’: None, ‘error_code’: ‘UDAPI100050’, ‘property_path’: None, ‘invalid_value’: None}]

Please help me to fix the error

Hello @jose_john,

We are checking this and will get back to you soon, thanks.

Hi @jose_john
I see a potential issue here,

The syntax for an f-string in Python should be: 'Authorization': f'Bearer {access_token}'. Please update your code with this change and try again.

Thank you.

1 Like

Dear Team,

Now its working fine ,Thanks for your support .

Regards
Jose
,

1 Like