HTTP Objects -- Python library reference



Next: HTTP Example Prev: httplib Up: httplib Top: Top

11.3.1. HTTP Objects

HTTP instances have the following methods:

set_debuglevel (level) -- Method on HTTP
Set the debugging level (the amount of debugging output printed). The default debug level is 0, meaning no debugging output is printed.
connect (host[, port]) -- Method on HTTP
Connect to the server given by host and port. See the intro for the default port. This should be called directly only if the instance was instantiated without passing a host.
send (data) -- Method on HTTP
Send data to the server. This should be used directly only after the endheaders() method has been called and before getreply() has been called.
putrequest (request, selector) -- Method on HTTP
This should be the first call after the connection to the server has been made. It sends a line to the server consisting of the request string, the selector string, and the HTTP version (HTTP/1.0).
putheader (header, argument[, ...]) -- Method on HTTP
Send an RFC-822 style header to the server. It sends a line to the server consisting of the header, a colon and a space, and the first argument. If more arguments are given, continuation lines are sent, each consisting of a tab and an argument.
endheaders () -- Method on HTTP
Send a blank line to the server, signalling the end of the headers.
getreply () -- Method on HTTP
Complete the request by shutting down the sending end of the socket, read the reply from the server, and return a triple (replycode, message, headers). Here replycode is the integer reply code from the request (e.g. 200 if the request was handled properly); message is the message string corresponding to the reply code; and header is an instance of the class rfc822.Message containing the headers received from the server. See the description of the rfc822 module.
getfile () -- Method on HTTP
Return a file object from which the data returned by the server can be read, using the read(), readline() or readlines() methods.


Next: HTTP Example Prev: httplib Up: httplib Top: Top