Solution: equity_history() function doesn't work

I have started using the NSEpython library since yesterday. I found a bug. Please find the fix. I am not aware who and how to update the fix to the master. Kindly someone please do the needful.

Bug: nsefetch() function doesn’t work.
Explantion: the function equity_history() and many oher functions use a function called “nsefetch()”. This function uses ‘requests’ to scrape data from nse website. But the problem what I observed is it’s not working. At this moment this function “nsefetch()” doesn’t use ‘session()’ concept to scrape data from nse.

Solution: implement the ‘sessions()’ concept of requests library. I did following modification and it started working as expected.

fix: the highlighted in bold are my changes.
s = requests.session()
mode =‘local’

def nsefetch(payload):
output = s.get(payload,headers=headers).json()
return output

So the beginning part of “” file should be something as follows-

import os,sys
# os.chdir(os.path.dirname(os.path.abspath(__file__)))
# sys.path.insert(1, os.path.join(sys.path[0], '..'))

import requests
import pandas as pd
import json
import random
import datetime,time
import logging
import re
import urllib.parse

headers = {
    'Connection': 'keep-alive',
    'Cache-Control': 'max-age=0',
    'DNT': '1',
    'Upgrade-Insecure-Requests': '1',
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Safari/537.36',
    'Sec-Fetch-User': '?1',
    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
    'Sec-Fetch-Site': 'none',
    'Sec-Fetch-Mode': 'navigate',
    'Accept-Encoding': 'gzip, deflate, br',
    'Accept-Language': 'en-US,en;q=0.9,hi;q=0.8',

s = requests.session()
url_nse = ""
r = s.get(url_nse, headers=headers)

mode ='local'

    def nsefetch(payload):
        output = s.get(payload,headers=headers).json()
        return output