Hello Dear wile trying to fetch using
from nsepython import *
url = 'https://www.nseindia.com/api/quote-equity?symbol=TCS§ion=trade_info'
data = nsefetch(url)
print(data)
using this code getting error output :
[C:\Users\B\AppData\Local\Programs\Python\Python311\python.exe C:\Users\B\AppData\Roaming\JetBrains\PyCharmCE2023.1\scratches\YFY.py
Traceback (most recent call last):
File "C:\Users\B\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\models.py", line 971, in json
return complexjson.loads(self.text, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\B\AppData\Local\Programs\Python\Python311\Lib\site-packages\simplejson\__init__.py", line 525, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\B\AppData\Local\Programs\Python\Python311\Lib\site-packages\simplejson\decoder.py", line 372, in decode
obj, end = self.raw_decode(s)
^^^^^^^^^^^^^^^^^^
File "C:\Users\B\AppData\Local\Programs\Python\Python311\Lib\site-packages\simplejson\decoder.py", line 402, in raw_decode
return self.scan_once(s, idx=_w(s, idx).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
simplejson.errors.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:\Users\B\AppData\Roaming\JetBrains\PyCharmCE2023.1\scratches\YFY.py", line 4, in <module>
data = nsefetch(url)
^^^^^^^^^^^^^
File "C:\Users\B\AppData\Local\Programs\Python\Python311\Lib\site-packages\nsepython\rahu.py", line 18, in nsefetch
output = requests.get(payload,headers=headers).json()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\B\AppData\Local\Programs\Python\Python311\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)
Process finished with exit code 1]. how to get it any ideas tried many things not working. i am not very very good in webscraping only know python to mediocre lavel.