Major Update — Akamai Transport Fix (both NSEPython and NSEPythonServer)
NSE tightened their Akamai Bot Manager protection and it quietly broke nsefetch() across both
libraries — plain requests/curl got blocked outright (403/404 Akamai challenge pages on
basically every API call). Rewrote the transport onto curl_cffi with real Chrome TLS
impersonation + a cookie warm-up, and rerouted a bunch of endpoints NSE quietly retired or moved
in the process. Live-tested end to end against the real site, not mocked.
Transport Fix
nsefetch()now usescurl_cffi(Chrome TLS fingerprint impersonation) instead of plain
requests/curl— this was the root cause, Akamai was blocking the old TLS fingerprint
outright regardless of User-Agent header.- Raises a proper
NSEEndpointErrornow instead of silently returning{}— if something’s
actually broken you get a real exception instead of a confusing downstreamKeyError. - New dependency:
curl_cffi(already in requirements.txt / setup.py — a normal
pip install -U nsepython/pip install -U nsepythonserverbrings it along). - (NSEPythonServer only) the old
mode="vpn"path shelled out viaos.popen()— that’s gone,
it was also a command-injection risk.
Endpoints NSE Moved/Retired, Now Rerouted
option-chain-indices,quote-equity,equity-stockIndices— all working again- Index family rerouted to
/api/allIndices(oldiislliveblob.niftyindices.comhost is dead) - FNO lot sizes rerouted to
nsearchives.nseindia.com’s new CSV layout - The
/api/historical/*family (equity_history,derivative_history,expiry_history,
nse_largedeals_historical,security_wise_archive) rerouted off the dead historical API onto
its live replacement nse_circular("latest")was hitting a dead no-wwwURL — fixednse_quote(section="trade_info")remapped onto the new quote endpoint’s own fields instead of
the deadsection=routeindex_history,index_pe_pb_div,index_total_returnsfixed against niftyindices’ new
Sitefinity-CMS backend
Bug Fixes
oi_chain_builder()now reports a real underlying value →
OI_Chain_builder does not fetch underlying value: Fix suggestion · Issue #80 · aeron7/nsepython · GitHubget_beta()KeyError fixed → Multiple functions broken or missing: get_beta (KeyError), dividend_timeline, share_holding do not exist · Issue #75 · aeron7/nsepython · GitHubdividend_timeline()andshare_holding()— these were documented on unofficed.com but never
actually existed in the code. Implemented for real now, via/api/top-corp-info.- NSEPythonServer
nse_marketStatusfixed → nse_marketStatus is not working as expected · Issue #3 · aeron7/nsepythonserver · GitHub - NSEPythonServer
nse_get_fno_lot_sizesfixed → nse_get_fno_lot_sizes not working · Issue #4 · aeron7/nsepythonserver · GitHub
Known Remaining Gaps (being upfront, not hiding anything)
nse_quote(section=...)for any value other than"trade_info"still hits a dead path — only
trade_infogot remapped this round.pcr()andnse_quote_meta()can mis-handle the flat-vs-nested option-chain data shape for
index/derivative symbols in some cases — noted in code comments, planned for a follow-up pass.
Links
- GitHub - aeron7/nsepython: The Unofficial Python Wrapper for NSEIndia API · GitHub — commit
02323dc,
release v2.98 - GitHub - aeron7/nsepythonserver: The Unofficial Python Wrapper for NSEIndia API For Servers · GitHub — commit
cea6061,
release v2.98 - Both live on PyPI right now:
pip install -U nsepython/pip install -U nsepythonserver
If you hit anything still broken, reply here with the exact function call and the error —
I’d rather know now than have it sit silently broken for another year.