request = urllib.request.Request('http://www.google.com')
request.add_header('Accept', 'text/html')
request.get_header('Accept')
response = urllib.request.urlopen(request)
response.read()
How do I send a custom header with urllib2 in a HTTP Request?