mechanize python xe 2315

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

showing results for - "mechanize python xe 2315"
Julia
26 Jul 2016
1def cli(scores, transfers):
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(scores):		#Called after score option is called
9		soup = find_soup(browser,'http://www.goal.com/en-in/live-scores')	#Gets HTML of entire page
10		score_box = soup.find_all('div',attrs={'class':'match-main-data'})	#Navigating to where the score is available in the page
11		click.echo("\nThe scores of all matches being played currently is displayed below:")
12		click.echo("--------------------------------------------------------------------")
13		for i in score_box:		#To get the score of all live matches and recently done matches
14			print i.text
15			click.echo("--------------------------------------------------------------------")
16		click.echo("\n\nNOTE: ALL THE MATCH TIMINGS ARE IN GMT\n\n")
17
18	if(transfers):
19		soup = find_soup(browser,'http://www.goal.com/en-us/transfer-rumours/1')	#Gets HTML of entire page
20		rumours = soup.select(".transfer-card__desc p")
21		click.echo("\nThe latest Transfer news & rumours are displayed below:")
22		click.echo("--------------------------------------------------------------------")
23		for i in rumours:
24			print("->"+i.text)
25			click.echo("--------------------------------------------------------------------") 
similar questions
queries leading to this page
mechanize python xe 2315