vsjha18 / nsetools

Realtime Data From National Stock Exchange (India)
http://nsetools.readthedocs.io
MIT License
820 stars 422 forks source link

Getting error for Nse.get_stock_codes #146

Open nandi691 opened 1 year ago

nandi691 commented 1 year ago

AttributeError Traceback (most recent call last) Cell In[15], line 1 ----> 1 nse.get_stock_codes()

File ~/python_packages/nsetools/nse.py:110, in Nse.get_stock_codes(self, cached, as_json) 107 res_dict = {} 108 if cached is not True or self.CODECACHE is None: 109 # raises HTTPError and URLError --> 110 res = self.opener.open(req) 111 if res is not None: 112 # for py3 compat covert byte file like object to 113 # string file like object 114 res = byte_adaptor(res)

AttributeError: 'Nse' object has no attribute 'opener'

chalegatech commented 8 months ago

I faced the same issue but was able to get the file working. This version of code did not have the nse_opener and nse_header methods which are there in the standard version. I copied the missing code and also some of the missing imports from the previous nse.py program. Also the req variable should have the Request output but it was within quotes. Once corrected, the code was working but the URL output did not provide the stock codes output that I was expecting.