[Update] NSEPython not working in AWS, Google Cloud and WebServers

why its not working on AWS Lambda …when i tried to get option chain data always showing timeout error even i provide full time limit i.e 15 min on Aws.

Mother NSE has blocked all server requests.

is there any solution for that?

CURL Method. When I get time to update ; I will update this library with that.

You can’t do this as per the SEBI circular. https://archives.nseindia.com/content/circulars/WEB45032.pdf

The SEBI mandated Website Security Policy has been enforced on the new NSE website to
protect Investor data and prevent misuse or theft of information.
 Using scripts to download information or scrapping data from NSE website is not
permitted. Hence most pages have a “Download in (.csv)” option enabled on the front

They are free to file legal suit lol on a small retailer like me :stuck_out_tongue: .

1 Like

Hahaha :smiley:

I tried with curl… But seems they blocked that also…

From Friday yes. Now two methods work -

Just get the cookies from Curl session


Json Token using Python

I will update later.

did you try with https://alternativeto.net/software/httpie/about/

I have really no clue what is it

Hi Dexter/Aeron,

Hope you are doing well.

Thanks for this wonderful library but I need some help with this. I am able to access it from a local machine but from amazon AWS (AWS Linux/RHEL) servers, I am getting the timeout exception.
Please help me out. Thanks in advance.

Kapil Badlani

It is not a problem of Python Request. Nse’s robots.txt has blocked all webservers all together. See here

User-agent: *

Disallow: /static/htmls/
Disallow: /static/src/
Disallow: /server/
Disallow: /api/

Sitemap: https://www.nseindia.com/sitemap.xml
Sitemap: https://www.nseindia.com/sitemap-stocks.xml

You can use the curl method and initiate shell commands using Python if you want to do it.


Thanks for your Youtube videos I was able to code my Trading setup.
Also deployed on AWS but getting timeout error as mentioned

Can you please guide on how to fetch data by curl method? or suggest some alternative.

I am new to coding field :slight_smile:

You don’t need to be master of anything. Google away
How to use Python to execute a cURL command? - Stack Overflow

Amazing library and I am using it for my Option Strategy analysis.

But doesn’t work on a server.

Have you got time to work on the CURL option yet?

Can you let me know how it is done, if you dont’ have time to modify the library?

Daughter disrupting my timeline.

I do not plan to add Curl Method in the library unless I see some other library doing it. It is because - That will increase the load in NSE servers and they will guard up their firewalls causing lots of problems for general scavengers like us like they did with their old website.

OK. Thank you. Looking forward to it. :+1:

Hi Dexter!

Your code is working great on local environment. But it is not working on Google cloud functions even with the same code.

Can you please help? I’m getting timeout exception. I’ve tried with NodeJs api as well. I can post both code if you want.

Thanks in advance!

1 Like

While working google colab, it throws the following error:

DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): www.nseindia.com:443

Can anyone please help?

It does not allow.

If I make NSEPython compatible for servers, it will not work in windows laptops.
If I make NSEPython compatible for laptops, it will not work in server.

Now, tell me how I will solve this.