Forums

Cannot run the nsepy code

the below code returns me an empty dataframe. But on my local, it works perfectly.

from nsepy import get_history as data

from datetime import datetime as date

sbin = data(symbol='SBIN', start=date(2015,1,1), end=date(2015,1,10))

print(sbin)

My guess would be that nsepy relies on importing data from our site that's not on our whitelist. If you can find out what sites it's pulling its data from, we may be able to add them?

The code is mainly pulling data from www.nseindia.com.

Could you please let me know if this can be added to the list?

I couldn't find any API documentation. Send a link to the API documentation. If there is no public API documentation, then it's not a candidate for the whitelist.

http://nsepy.readthedocs.io/en/latest/

https://pypi.python.org/pypi/nsepy/0.4

Git Hub: https://github.com/swapniljariwala/nsepy

No, those are a Python library for using the site - we need the API docs for the site.

https://www.nseindia.com/ provided data to be used by people or any script. Kindly whitelist this website.

If you can provide us with a link to API documentation on their site (not a link to an unofficial API) then we can whitelist it.

My program based on NSEpy python libraries not working in PythonAnywhere server. Does anyone have work around or recommendations. PythonAnywhere allow me to install NSEpy using pip but during execution it throws error - "ImportError: No module named nsepy"

The "No module named nsepy" error sounds like you might have installed it for a different version of Python to the one that you are using -- you should use pip3.7 if you are running Python 3.7, pip3.8 if you're using 3.8, and so on.

However, nseindia.com is not on the list of whitelisted websites for free accounts, and we have also been informed that it blocks incoming requests from cloud computing platforms like PythonAnywhere, so even if you were able to import it, it would not work.

I'm facing a similar issue with nsepy. The nsepy module takes data from http://www1.nseindia.com directly and not from API. It scraps the website and returns the data we need. Is it possible to whitelist the website?

@Raghuram as we pointed multiple times above, we ONLY whitelist APIs.