Hi Dexter, You are right about the fact some users are cursed. I am one among the them. I wish you break it.
It is occurring to most of the users I believe seeing the comments.
Could you please check this and Praty has said something about using requests.session(), but even that didn’t work for me.
Is it possible for a retry mechanism till a valid response is received. I am not great at programming. Just a novice.
I am also receiving the same error.
Req :
symbol = “SBIN”
series = “EQ”
start_date = “08-06-2022”
end_date =“14-04-2023”
print(equity_history(symbol,series,start_date,end_date))
Response:
Traceback (most recent call last):
File “C:\Software\NSE_Analytics\Nsepython_new\venvCH\lib\site-packages\requests\models.py”, line 971, in json
return complexjson.loads(self.text, **kwargs)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\json_init_.py”, line 346, in loads
return _default_decoder.decode(s)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\json\decoder.py”, line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\json\decoder.py”, line 355, in raw_decode
raise JSONDecodeError(“Expecting value”, s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “C:\Software\NSE_Analytics\Nsepython_new\runner1.py”, line 10, in
print(equity_history(symbol,series,start_date,end_date))
File “C:\Software\NSE_Analytics\Nsepython_new\venvCH\lib\site-packages\nsepython\rahu.py”, line 551, in equity_history
total = pd.concat([total, equity_history_virgin(symbol, series, start_date, temp_date)])
File “C:\Software\NSE_Analytics\Nsepython_new\venvCH\lib\site-packages\nsepython\rahu.py”, line 519, in equity_history_virgin
payload = nsefetch(url)
File “C:\Software\NSE_Analytics\Nsepython_new\venvCH\lib\site-packages\nsepython\rahu.py”, line 20, in nsefetch
output = s.get(payload,headers=headers).json()
File “C:\Software\NSE_Analytics\Nsepython_new\venvCH\lib\site-packages\requests\models.py”, line 975, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)