Skip to content

Commit d5663a2

Browse files
committed
adopt session-based approach
1 parent 89d3cf6 commit d5663a2

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

fin_maestro_kin/modules/data_toolkit/nse/nse_operations.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -776,18 +776,14 @@ def get_pcr(self, symbol: str = Query(..., title="Symbol", description="Stock sy
776776

777777
def nse_equity_tickers(self):
778778
try:
779-
headers = {
780-
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'
781-
}
782-
783-
indices = ['NIFTY 50', 'NIFTY NEXT 50', 'NIFTY 500', 'NIFTY MIDSMALLCAP 400']
779+
indices = ['NIFTY 50', 'NIFTY NEXT 50', 'NIFTY 500']
784780
base_url = 'https://www.nseindia.com/api/equity-stockIndices?index='
785781

786782
tickers = []
787783

788784
for index in indices:
789785
url = base_url + index.replace(' ', '%20')
790-
response = requests.get(url, headers=headers)
786+
response = self.fetch_data_from_nse(url)
791787
response.raise_for_status()
792788
data = response.json()
793789

0 commit comments

Comments
 (0)