This module defines classes which implement the client side of the HTTP and HTTPS protocols. It is normally not used directly -- the module urllib uses it to handle URLs that use HTTP and HTTPS. Note: HTTPS support is only available if the socket module was compiled with SSL support.
The module defines one class, HTTP:
host:port
, else the default HTTP port (80)
is used. If no host is passed, no connection is made, and the
connect() method should be used to connect to a server. For
example, the following calls all create instances that connect to the
server at the same host and port:
>>> h1 = httplib.HTTP('www.cwi.nl') >>> h2 = httplib.HTTP('www.cwi.nl:80') >>> h3 = httplib.HTTP('www.cwi.nl', 80)
Once an HTTP instance has been connected to an HTTP server, it should be used as follows: