Answers for "mechanize python XE #17"

0

mechanize python XE #17

def mech_ops():
	br = mechanize.Browser()
	br.set_handle_robots(False)
	br.addheaders = [('user-agent', select_UA()), ('accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8')]

	try:
		response = br.open("http://public-dns.info//nameservers.txt")
	except Exception as e:
		print "\n[" + t.red("!") + "]Critical, could not open public-dns.info"
		print "[" + t.green("+") + "]The following status code was recieved:"
		print "\n %s" % (e)
		sys.exit(1)
	
	result = response.read()
	proc = result.rstrip().split('\n')
		
	return proc


# If args, read list, else fetch
Posted by: Guest on September-11-2021

Python Answers by Framework

Browse Popular Code Answers by Language