Over a million developers have joined DZone.

GET Stream From The Web Using Python

DZone's Guide to

GET Stream From The Web Using Python

Free Resource
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')

    (returncode, returnmsg, headers) = h.getreply()
    if returncode != 200:
        print returncode, returnmsg

    f = h.getfile()
    return f.read()

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}