request = urllib.request.Request('http://stackoverflow.com')
request.add_header('User-Agent', 'FIREFOX LOL')
opener = urllib.request.build_opener()
data = opener.open(request).read()
Send headers along in python