Streamlit app not able to fetch data from nsepy (library for fetching stock data from Indian stock market web

I am building an application that uses the open-source library nsepy to fetch stock market data from
The same library seems to be working fine when used locally, however when used in Streamlit Cloud, the library is unable to fetch data.
Any fixes or workarounds for this? Would really be helpful!

Do you have it included in your requirements.txt file?

Yes. The library is included in my requirements.txt

Can you provide some code or error messages to clarify further? (Preferably a minimal snippet to show the function that doesn’t work.) Are the app and repository public to view?

These are the logs

and this is the code that fetches it:

from nsepy import get_history as gh
import datetime as dt
from datetime import date
stock=st.text_input('Enter a stock code to start: ')
if stock:

start =,11,1)
end =

while len(stk_data)<1:
 stk_data = gh(symbol=stock,start=start,end=end)  
 if len(stk_data)>1:
if len(stk_data)>0:
  st.subheader(f'Historical Price Data of {stock_to_show}')
  fig = go.Figure()
  fig.add_trace(go.Scatter(x=stk_data.index,y=stk_data['Open'],name='Open', mode="lines"))
  fig.add_trace(go.Scatter(x=stk_data.index,y=stk_data['Close'],name='Close', mode="lines"))
  yesno=st.text_input('Do you want to forecast future stock prices (Y/N)?')
  st.write('Error! If you have entered the wrong Stock Code, Please cross-check and enter the correct NSE stock code! Alternatively, if the server is down, kindly wait and try again after some time.')