The httplib Module

Implements the HTTP 1.0 protocol

  • Can use to talk to a web server.

HTTP in two bullets

  • Client (e.g., a browser) sends a request to the server
     GET /index.html HTTP/1.0
     Connection: Keep-Alive
     Host: www.python.org
     User-Agent: Mozilla/4.61 [en] (X11; U; SunOS 5.6 sun4u)
     [blank line] 
  • Server responds with something like this:
     HTTP/1.0 200 OK
     Content-type: text/html
     Content-length: 72883
     Headers: blah
     [blank line]
     Data
     ...
<<< O'Reilly OSCON 2000, Advanced Python Programming, Slide 93
July 17, 2000, beazley@cs.uchicago.edu
>>>