Try the example as shown here NSEPy Functions - Unofficed and see if it it showing same error. And share.
Another way is to shift to nsepython’s server version which you can find here - [Update] NSEPython not working in AWS, Google Cloud and WebServers - #24 by dexter
Let me know if you face problem