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

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.

Just mentioned in the above post. I will sooner or later shoot a major update once I finish my work log. I have to do certain changes in our Leverage and Artemis project.

If I am not wrong request package lets you set useragent in the header write?
So basically can’t we bypas that robot block by setting useragent to something like webkit or something

Here is a hint

Use subprocess and curl

Now, this is the major update. Added a new library named “nsepythonserver” that will allow you to run nsepython library from Google Collab and other servers.

Just install nsepythonserver instead of nsepython

!pip install nsepythonserver

Will update more in documentation soon.

Refer NSEPython Documentation - #144

could you please address this:
New nsepythonserver not fetching option chain data. Will using a ROTATING PROXY be a good option to integrate with nsepythonserver? (nsepythonserver error)