You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Multiple functions broken or missing: get_beta (KeyError), dividend_timeline, share_holding do not exist #75
Several functions referenced in documentation and examples are either broken at runtime or do not exist in nsepython 2.97. This was verified against live NSE API responses on 2026-04-27.
Environment
nsepython: 2.97 (latest)
Python: 3.13
OS: Windows 11
Date: 2026-04-27
Issue 1: get_beta() throws KeyError: 'data' at runtime
This is the same root cause as #74 — the underlying NSE API endpoint returns a response without a data key, and nsepython doesn't handle the missing key.
Expected: Return beta value or raise a descriptive exception. Actual: Unhandled KeyError: 'data'.
Issue 2: dividend_timeline() does not exist
importnsepythonresult=nsepython.dividend_timeline('RELIANCE')
# AttributeError: module 'nsepython' has no attribute 'dividend_timeline'
This function is referenced in various examples and community posts but does not exist in the current module. If it was removed, the removal should be documented. If it was never implemented, the references should be corrected.
Issue 3: share_holding() does not exist
importnsepythonresult=nsepython.share_holding('RELIANCE')
# AttributeError: module 'nsepython' has no attribute 'share_holding'
Same as above — referenced but not implemented. The NSE API does have a shareholding endpoint (/api/corporates-holdings) so this could be implemented.
Issue 4: nse_eq() metadata does not include P/B ratio
importnsepythonmeta=nsepython.nse_eq('RELIANCE')
# meta['metadata'] has: pdSymbolPe, pdSectorPe# But NO pdSymbolPb or any book value field
The metadata dict includes P/E (pdSymbolPe) but not P/B. The NSE quote page shows P/B ratio, so the data exists on the website — it may be available from a different API endpoint or field name.
Suggested Fix
For issues 1-3, add defensive error handling — check for key existence before accessing, and raise descriptive exceptions (NSEEndpointError or similar) instead of raw KeyError/AttributeError.
For issue 4, investigate whether the NSE API exposes P/B in a different endpoint or field.
Activity
4arjun commentedon May 31, 2026
@aeron7
techraiders commentedon Jul 5, 2026
index_pe_pb_div function has stopped working on 03-July-2026. Now, it throws following error on Ubuntu 26.04 LTS.
Traceback (most recent call last):
File "/home/navneet-prakash/python-projects/wealth-management-system/.venv/lib/python3.14/site-packages/requests/models.py", line 1116, in json
return complexjson.loads(self.text, **kwargs)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.14/json/init.py", line 352, in loads
return _default_decoder.decode(s)
~~~~~~~~~~~~~~~~~~~~~~~^^^
File "/usr/lib/python3.14/json/decoder.py", line 345, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.14/json/decoder.py", line 363, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 2 (char 1)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/navneet-prakash/python-projects/wealth-management-system/experiments.py", line 13, in
data = index_pe_pb_div('Nifty 50', start_date, end_date)
File "/home/navneet-prakash/python-projects/wealth-management-system/.venv/lib/python3.14/site-packages/nsepython/rahu.py", line 785, in index_pe_pb_div
payload = requests.post('https://niftyindices.com/Backpage.aspx/getpepbHistoricaldataDBtoString', headers=niftyindices_headers, json=data).json()
File "/home/navneet-prakash/python-projects/wealth-management-system/.venv/lib/python3.14/site-packages/requests/models.py", line 1120, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 2 (char 1)
Fix Akamai transport block + 8 broken endpoints
Fix Akamai transport block + 8 broken endpoints