I'm setting up a database(Pandas Dataframe) to store the news weblinks of the news articles(past week articles) for the list of companies. I have written a python code but the code gets executed for sometime and sometimes not , also it does not produce any error. Since it is not producing any log or error, i am finding difficult to understand the background on this issue.
I tried removing the cache from the browser since i am using Jupyter notebook and i tried with other application like Sypder. I have same problem with the Jupyter notebook and other application
links_output=[]
class Newspapr:
    def __init__(self,term):
        self.term=term
        self.url='https://www.google.com/search?q={0}&safe=active&tbs=qdr:w,sdb:1&tbm=nws&source=lnt&dpr=1'.format(self.term)
    def NewsArticlerun(self):
        response=requests.get(self.url)
        soup=BeautifulSoup(response.text,'html.parser')
        links=soup.select(".r a")
        numOpen = min(5, len(links))
        for i in range(numOpen):
            response_links = "https://www.google.com" + links[i].get("href")
            print(response_links)
            links_output.append({"Weblink":response_links})
        pd.DataFrame.from_dict(links_output)
list_of_companies=["Wipro","Reliance","icici bank","vedanta", "DHFL","yesbank","tata motors","tata steel","IL&FS","Jet airways","apollo tyres","ashok leyland","Larson & Turbo","Mindtree","Infosys","TCS","AxisBank","Mahindra & Mahindra"]
for i in list_of_companies:
    comp_list = str('"'+ i + '"')
    call_code=Newspapr(comp_list)
    call_code.NewsArticlerun()
I expect to print the weblink and as a pandas dataframe
 
     
     
    