DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
GET Stream From The Web Using Python
GETs files from a remote webserver. I'm using it for streaming
def get(host,port,url):
h = httplib.HTTP(host, port)
h.putrequest('GET', url)
h.putheader('Host', host)
h.putheader('User-agent', 'python-httplib')
h.endheaders()
(returncode, returnmsg, headers) = h.getreply()
if returncode != 200:
print returncode, returnmsg
sys.exit()
f = h.getfile()
return f.read()





