Index_history is not working

Tried to see once. Your collab said I don’t have access. So I forgot afterwards. They may have changed something in middle.

Use this for meanwhile.

import requests


headers = {
    'Accept': 'application/json, text/javascript, */*; q=0.01',
    'Accept-Language': 'en-US,en;q=0.9',
    'Connection': 'keep-alive',
    'Content-Type': 'application/json; charset=UTF-8',
    'DNT': '1',
    'Origin': 'https://niftyindices.com',
    'Referer': 'https://niftyindices.com/reports/historical-data',
    'Sec-Fetch-Dest': 'empty',
    'Sec-Fetch-Mode': 'cors',
    'Sec-Fetch-Site': 'same-origin',
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36',
    'X-Requested-With': 'XMLHttpRequest',
    'sec-ch-ua': '"Google Chrome";v="123", "Not:A-Brand";v="8", "Chromium";v="123"',
    'sec-ch-ua-mobile': '?0',
    'sec-ch-ua-platform': '"Windows"',
}

json_data = {
    'cinfo': "{'name':'NIFTY 50','startDate':'01-Jan-2023','endDate':'26-Apr-2024'}",
}

response = requests.post(
    'https://niftyindices.com/Backpage.aspx/getHistoricaldatatabletoString',
    headers=headers,
    json=json_data,
)
response.text