Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nifty Website not Accessible #55

Open
UditGupta10 opened this issue Sep 25, 2023 · 1 comment
Open

Nifty Website not Accessible #55

UditGupta10 opened this issue Sep 25, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@UditGupta10
Copy link
Contributor

Issue description

The website: https://niftyindices.com is not working. Is this temporary or has there been a migration to some other url. If so, the code needs to be updated to reflect that.
Specifically, I'm accessing:

class NSEIndexHistory(NSEHistory):
.

The returned response code is 403.

Example Code

nifty_50 = index_df(symbol="NIFTY 50",
	           from_date='2023-09-01',
		   to_date='2023-09-20')

Error snippet

Traceback (most recent call last):
  File "/Users/uditg/anaconda3/envs/ny/lib/python3.11/site-packages/requests/models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/uditg/anaconda3/envs/ny/lib/python3.11/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/uditg/anaconda3/envs/ny/lib/python3.11/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/uditg/anaconda3/envs/ny/lib/python3.11/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/uditg/Documents/dummy/ny.py", line 391, in <module>
    main(args=parser.parse_args())
  File "/Users/uditg/Documents/dummy/ny.py", line 301, in main
    nifty_50 = index_df(symbol="NIFTY 50",
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/uditg/anaconda3/envs/ny/lib/python3.11/site-packages/jugaad_data/nse/history.py", line 371, in index_df
    raw = index_raw(symbol, from_date, to_date)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/uditg/anaconda3/envs/ny/lib/python3.11/site-packages/jugaad_data/nse/history.py", line 321, in index_raw
    return list(itertools.chain.from_iterable(chunks))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/uditg/anaconda3/envs/ny/lib/python3.11/concurrent/futures/_base.py", line 619, in result_iterator
    yield _result_or_cancel(fs.pop())
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/uditg/anaconda3/envs/ny/lib/python3.11/concurrent/futures/_base.py", line 317, in _result_or_cancel
    return fut.result(timeout)
           ^^^^^^^^^^^^^^^^^^^
  File "/Users/uditg/anaconda3/envs/ny/lib/python3.11/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/Users/uditg/anaconda3/envs/ny/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/Users/uditg/anaconda3/envs/ny/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/uditg/anaconda3/envs/ny/lib/python3.11/site-packages/jugaad_data/util.py", line 109, in wrapper
    j = function(**kw)
        ^^^^^^^^^^^^^^
  File "/Users/uditg/anaconda3/envs/ny/lib/python3.11/site-packages/jugaad_data/nse/history.py", line 315, in _index
    return json.loads(self.r.json()['d'])
                      ^^^^^^^^^^^^^
  File "/Users/uditg/anaconda3/envs/ny/lib/python3.11/site-packages/requests/models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
@UditGupta10 UditGupta10 added the bug Something isn't working label Sep 25, 2023
@devfinwiz
Copy link

Faced similar issues related to indices modules across many libraries. It is because nse made modifications to its request payload a few days back and the code isn't updated for the same.

You can track this alternative api for various stuff and not just data gathering: https://github.com/devfinwiz/Fin-Maestro-Kin
It is presently in it's early stages of development. Active work on it is in progress. Once this is deployed, you can simply send your request to specific endpoints to receive results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants