from datetime import date
from nsepython import *
from nsepython import equity_history
sbin = equity_history("SBIN","EQ",
str(date(2020,1,1).strftime("%d-%m-%Y")),"10-10-2020")
I am getting error from API side for this code
SONDecodeError Traceback (most recent call last)
File D:\anaconda3\lib\site-packages\requests\models.py:971, in Response.json(self, **kwargs)
970 try:
--> 971 return complexjson.loads(self.text, **kwargs)
972 except JSONDecodeError as e:
973 # Catch JSON-related errors and raise as requests.JSONDecodeError
974 # This aliases json.JSONDecodeError and simplejson.JSONDecodeError
File D:\anaconda3\lib\json\__init__.py:346, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
343 if (cls is None and object_hook is None and
344 parse_int is None and parse_float is None and
345 parse_constant is None and object_pairs_hook is None and not kw):
--> 346 return _default_decoder.decode(s)
347 if cls is None:
File D:\anaconda3\lib\json\decoder.py:337, in JSONDecoder.decode(self, s, _w)
333 """Return the Python representation of ``s`` (a ``str`` instance
334 containing a JSON document).
335
336 """
--> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end())
338 end = _w(s, end).end()
File D:\anaconda3\lib\json\decoder.py:355, in JSONDecoder.raw_decode(self, s, idx)
354 except StopIteration as err:
--> 355 raise JSONDecodeError("Expecting value", s, err.value) from None
356 return obj, end
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
JSONDecodeError Traceback (most recent call last)
Cell In[27], line 4
2 from nsepython import *
3 from nsepython import equity_history
----> 4 sbin = equity_history("SBIN","EQ",
5 str(date(2020,1,1).strftime("%d-%m-%Y")),"10-10-2020")
File D:\anaconda3\lib\site-packages\nsepython\rahu.py:549, in equity_history(symbol, series, start_date, end_date)
545 logging.info("====")
547 #total=total.append(equity_history_virgin(symbol,series,start_date,temp_date))
548 #total=total.concat(equity_history_virgin(symbol,series,start_date,temp_date))
--> 549 total = pd.concat([total, equity_history_virgin(symbol, series, start_date, temp_date)])
552 logging.info("Length of the Table: "+ str(len(total)))
554 #Preparation for the next loop
File D:\anaconda3\lib\site-packages\nsepython\rahu.py:517, in equity_history_virgin(symbol, series, start_date, end_date)
513 def equity_history_virgin(symbol,series,start_date,end_date):
514 #url="https://www.nseindia.com/api/historical/cm/equity?symbol="+symbol+"&series=[%22"+series+"%22]&from="+str(start_date)+"&to="+str(end_date)+""
515 url = 'https://www.nseindia.com/api/historical/cm/equity?symbol=' + symbol + '&series=["' + series + '"]&from=' + start_date + '&to=' + end_date
--> 517 payload = nsefetch(url)
518 return pd.DataFrame.from_records(payload["data"])
File D:\anaconda3\lib\site-packages\nsepython\rahu.py:18, in nsefetch(payload)
17 def nsefetch(payload):
---> 18 output = requests.get(payload,headers=headers).json()
19 return output
File D:\anaconda3\lib\site-packages\requests\models.py:975, in Response.json(self, **kwargs)
971 return complexjson.loads(self.text, **kwargs)
972 except JSONDecodeError as e:
973 # Catch JSON-related errors and raise as requests.JSONDecodeError
974 # This aliases json.JSONDecodeError and simplejson.JSONDecodeError
--> 975 raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
JSONDecodeError: Expecting value: line 1 column 1 (char 0)