Skip to content

index_total_returns fails with JSONDecodeError #78

Description

@vikaskojha

Calling index_total_returns throws a JSONDecodeError. The endpoint https://niftyindices.com/Backpage.aspx/getTotalReturnIndexString seems to return non‑JSON (possibly empty or HTML).

Steps to Reproduce:

from nsepython import index_total_returns
symbol = "NIFTY 50"
start_date = "06-Jul-2026"
end_date = "06-Jul-2026"
print(index_total_returns(symbol,start_date,end_date))

Error:
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 2 (char 1)

Environment:
Windows 11
Python 3.13
nsepython 2.97

Expected:
Function should print total return index values.

Actual:
Fails with JSONDecodeError.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions