HTTPError: HTTP Error 403: Forbidden

Hello,
I couldnā€™t fetch data, getting 403 error while deploying in Streamlit.
But works fine locally(shows 200 response in local)

Hereā€™s my code snippet

url = "https://www1.nseindia.com/content/historical/EQUITIES/2022/OCT/cm11OCT2022bhav.csv.zip"
r = requests.get(url)
print(r)
l1 = pd.read_csv(url)
l1 = l1.loc[l1['SERIES'].isin(['EQ','BE'])]
l1 = l1[['SYMBOL','CLOSE']]
l1

App link,
https://username06983-stock-stream-zrqzp2.streamlitapp.com/

Thank you!

The 403 error would indicate that the API youā€™re hitting is refusing to authorize the request ā€“ this would happen if the API only accepts requests from allow-listed IP addresses

Am facing the same issue
NSE site worked smooth yesterday but now throwing 403 error

Have you found any solution for this brother

Hi, I couldnā€™t solve this issue. Works fine sometimes, suddenly throws error.