You can use NSE API
import datetime
import pandas as pd
import requests
def is_holiday(date: datetime.date):
headers = {'user-agent': 'PostmanRuntime/7.26.5'}
endpoint = "https://www.nseindia.com/api/holiday-master?type=trading"
response = requests.get(endpoint, headers=headers)
assert response.status_code == 200, response.json()
holidays_json = response.json()['FO']
holidays_df = pd.DataFrame(holidays_json)
holidays_df['tradingDate'] = pd.to_datetime(holidays_df['tradingDate'])
return pd.Timestamp(date) in holidays_df['tradingDate'].values