The httplib Module (cont)Making an HTTP connection
import httplib
h = httplib.HTTP("www.python.org")
h.putrequest('GET','/index.html')
h.putheader('User-Agent','Lame Tutorial Code')
h.putheader('Accept','text/html')
h.endheaders()
errcode,errmsg, headers = h.getreply()
f = h.getfile() # Get file object for reading data
data = f.read()
f.close()
Comments
|
| <<< | O'Reilly OSCON 2000, Advanced Python Programming, Slide 94 July 17, 2000, beazley@cs.uchicago.edu |
>>> |