
Security News
Django Joins curl in Pushing Back on AI Slop Security Reports
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
An unofficial Python API for the NSE India stock exchange.
Python version: >= 3.8
If you ❤️ my work so far, please 🌟 this repo.
https://bennythadikaran.github.io/NseIndiaApi
All requests through NSE are rate limited or throttled to 3 requests per second. This allows making large number of requests without overloading the server or getting blocked.
v1.2.0 NSE package now works in server environments like AWS. See PR #10 for details.
To install on local machine or PC
pip install nse[local]
To install in a server environment like AWS (Works on local too)
pip install nse[server]
The class accepts two arguments (As of 1.2.0)
download_folder
- a str
filepath, or a pathlib object
. The folder stores cookie and any downloaded files.server
- If False (default), use the requests module to make requests. Else uses the httpx module with http2 support for running on server.Note: server=True
works both locally and on servers. httpx[http2]
module is required to be installed for this to work.
Simple example
from nse import NSE
from pathlib import Path
# Working directory
DIR = Path(__file__).parent
nse = NSE(download_folder=DIR, server=False)
status = nse.status()
advDec = nse.advanceDecline()
nse.exit() # close requests session
Using with statement
with NSE(download_folder=DIR, server=False) as nse:
status = nse.status()
advDec = nse.advanceDecline()
Catching errors
from nse import NSE
from datetime import datetime
with NSE('./') as nse:
try:
bhavFile = nse.equityBhavcopy(date=datetime.now())
dlvFile = nse.deliveryBhavcopy(date=datetime.now())
raise RuntimeError('Some error') # force an exception
except RuntimeError as e:
# continue execution or exit the script
print(repr(e))
# execution continues if handled without exit
actions = nse.actions()
# NSE request session closed - continue processing
The src/samples
folder contains sample outputs of various methods. The filenames match the method names. The output has been truncated in some places but demonstrates the overall structure of responses.
FAQs
Unofficial Python Api for NSE India stock exchange
We found that nse demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.