Error - requests.exceptions.JSONDecodeError

Hi in my app I am getting the folloring error.

requests.exceptions.JSONDecodeError: This app has encountered an error. The original error message is redacted to prevent data leaks. Full error details have been recorded in the logs (if you're on Streamlit Cloud, click on 'Manage app' in the lower right of your app).


File "/home/appuser/venv/lib/python3.7/site-packages/streamlit/", line 430, in _run_script
    exec(code, module.__dict__)File "/app/orbpython/", line 19, in <module>
    gainers = nse_get_top_gainers()File "/home/appuser/venv/lib/python3.7/site-packages/nsepython/", line 439, in nse_get_top_gainers
    positions = nsefetch('')File "/home/appuser/venv/lib/python3.7/site-packages/nsepython/", line 38, in nsefetch
    output = s.get(payload,headers=headers).json()File "/home/appuser/.conda/lib/python3.7/site-packages/requests/", line 917, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)

My github repositary is at

This code is running fine in my local machine. Can someone plz help?

Hi @stockmaniacs -

If this works locally, but not on Streamlit Cloud, it might be the case that blocks traffic from Google Cloud. This occasionally happens when sites think people are running web scraping, and unfortunately, there’s no way for us to appeal to them.

Since this error is happening at the JSONDecode step, rather than the actual call, I would dump the requests object to see what the return code was, so that you can hopefully get a better idea of what’s happening. I would guess that you are getting a 4xx error of some sort.