NSEPython & NSEPythonServer 2.101 — Fixing a Real Regression From the Akamai Fix

v2.101 — Fixing a Real Regression From the Akamai Fix (Found by a Reader-Requested Audit)

Someone asked me directly: “is the documentation actually correct, is GitHub actually correct, is
anything that used to work now broken?” So I ran a proper independent audit instead of just assuming
v2.98-2.100 were fine. GitHub and PyPI checked out clean (commits, tags, releases, and the published
wheel bytes all verified to match). The documentation and code did not come back clean. Here’s what was
actually wrong, and what’s fixed now.


The real regression

nse_eq()/nse_fno() were rerouted off NSE’s dead /api/quote-equity endpoint back in v2.98 — but the
new endpoint returns data in a different shape, and nobody added a compatibility layer. That means the
classic, long-documented pattern:

print(nse_eq("JUSTDIAL")['priceInfo']['lastPrice'])
print(nse_fno("BANKNIFTY")['underlyingValue'])

has been raising KeyError since v2.98 — silently, with no one reporting it until this audit actually
ran the unofficed.com docs page’s own examples against the real package. Fixed in v2.101: both
functions now reshape the new response back into the old key layout, so bracket access works again
exactly as documented.

nse_quote(section=X) was also narrower than claimed

The docs said 7 section values worked (trade_info, info, metadata, priceInfo, securityInfo,
industryInfo, preOpenMarket). In nsepython, only 3 actually did — the other 4 raised ValueError.
Turns out nsepythonserver already had the correct, working implementation for all 7; nsepython just
never got it. Ported across — all 7 genuinely work now, in both packages.

Cross-package gaps closed

  • dividend_timeline()/share_holding() (new in v2.98) existed only in nsepython, despite the docs
    telling people to install either package for them. Now in both.
  • nse_mcp_lookup_symbol was named inconsistently between the two packages for the identical MCP tool
    — renamed to nse_mcp_nse_lookup_symbol in nsepythonserver to match nsepython’s convention (old
    name kept working as an alias, nothing breaks for anyone already using it).
  • __version__ was hardcoded "0.1" in both packages since forever — now reads the real installed
    version.

Documentation fixes (unofficed.com)

  • Fixed 3 broken code examples on the new MCP docs page (a wrong kwarg name, a list_tools() loop that
    crashed, a call() example missing a required arg).
  • Added documentation for nse_annual_reports() (v2.100’s new function), which had zero coverage.
  • Refreshed the Custom Functions page (untouched since 2021): swapped a stale embedded source-code dump
    for a link to the real GitHub source, updated a strike-price example that was 32,000 points stale, and
    added an honest note that bid/ask lookups currently always return None — NSE’s live option-chain feed
    carries no bid/ask fields at all anymore. That’s a genuine upstream data gap, not a bug here, but the
    docs never said so until now.
  • Fixed two stale sample outputs (one showing fabricated-looking data, one showing an old MongoDB
    document shape NSE no longer returns).
  • Fixed a blog post’s broken CSV link (NSE moved the host; added a pointer to the already-working
    nse_get_fno_lot_sizes() as a more reliable alternative to raw IMPORTDATA).

Links

If you were using the bracket-access pattern on nse_eq()/nse_fno() and gave up on it after it broke
silently — sorry about that, and thanks for the push to actually go check rather than assume it was fine.