mechanize python xe 2316

Solutions on MaxInterview for mechanize python xe 2316 by the best coders in the world

showing results for - "mechanize python xe 2316"
Bradwin
10 Sep 2020
1def cli(google,wiki):
2	browser = mechanize.Browser()
3	browser.set_handle_robots(False)	#Allows everything to be written
4	cookies = mechanize.CookieJar()
5	browser.set_cookiejar(cookies)
6	browser.addheaders = [('User-agent', 'Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.517.41 Safari/534.7')]
7	browser.set_handle_refresh(False)	#Sometimes hangs without this
8	if(google):
9		query = raw_input("Enter the topic you want to search about: ")
10		for link in search(query, tld="co.in", num=10, stop=1, pause=2):
11			print link
12	if(wiki):
13		wiki_topic = raw_input('Enter the topic you want to read about: ')
14		result = wikipedia.page(title=wiki_topic,auto_suggest=True,redirect=True, preload=False)
15		wiki_content = result.content
16		print wiki_content 
similar questions
queries leading to this page
mechanize python xe 2316