import urllib2
def main():
print http_req("http://www.google.ca/", None, "")
def http_req(url, data, last_page):
req = urllib2.Request(url, data)
req.add_header("Referer", referer)
req.add_header("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.12) Gecko/20101026 AskTbBT5/3.9.1.14019 Firefox/3.6.12")
dpage = urllib2.urlopen(req)
resp_data = dpage.read()
return resp_date.encode('utf-8')
I was using some lines from a code that Artifeetfetish posted in this thread.
Anyways I'm not getting anything on the console except "Press any key to continue". I should be getting a print out of google's html shouldn't I?