node252





11.4.1 HTTP Objects

















Python Library Reference




Previous: 11.4 httplib
Up: 11.4 httplib
Next: 11.4.2 Examples




11.4.1 HTTP 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.









Python Library Reference




Previous: 11.4 httplib
Up: 11.4 httplib
Next: 11.4.2 Examples



See About this document... for information on suggesting changes.





Wyszukiwarka

Podobne podstrony:
node257 6MKJ7DIZ7SQ5RNWQAR7JJYG2SCCE2WHEDKRRUZY
node250 IW4SVYVOQ6VDOKASRPAER7MOS3QMPARFNOXA2NY
node25
node25 A6EBBUA6Q4CP2CMH4DNVFPFXQ2GQJWUFVGTBZXI
node254 PEDKRMS4SZIIYFBVPSWK4Q4WKJQ2773SX645QMI
node25
node25
node25 1
node256 V6HZIESMYR2V25XEUAYFUAJ4DZXSLLVX74JGXCA
node253 YMLEWGBRCTRBJ33F2MKTMYWJIRHEUIBMCKQ73CA
node253 YMLEWGBRCTRBJ33F2MKTMYWJIRHEUIBMCKQ73CA
node25 RSWVRRTCMUVKMPATT2BAQH3WFDQ5C2BE5IAHBNI
node258 GILRTW6M52S7UY5GIDZMUQP7WRX53J6LD7USNQI
node252 E3PQHQPEHUWOTZYRUSEWMD4DIHVMGYUNRLPCSHI
node25
node259 BPF7WA32I34TG67SK2H2BA2V7D3XP7NI6MS7ZFQ
node251 33GYE233O3RSULSOGNHI2UFULD4PSTVTY5N3FII

więcej podobnych podstron