Copyright (C) 2000-2012 |
GNU Info (python2.1-lib.info)HTTP ObjectsHTTP Objects ------------ `HTTP' instances have the following methods: `set_debuglevel(level)' 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])' 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)' 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)' 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[, ...])' 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()' Send a blank line to the server, signalling the end of the headers. `getreply()' 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 HEADERS is an instance of the class `mimetools.Message' containing the headers received from the server. See the description of the `mimetools' module. `getfile()' Return a file object from which the data returned by the server can be read, using the `read()', `readline()' or `readlines()' methods. automatically generated by info2www version 1.2.2.9 |