home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / p / python / pyhtmldoc / h / http_objec < prev    next >
Text File  |  1996-11-14  |  3KB  |  54 lines

  1. <TITLE>HTTP Objects -- Python library reference</TITLE>
  2. Next: <A HREF="../h/http_example" TYPE="Next">HTTP Example</A>  
  3. Prev: <A HREF="../h/httplib" TYPE="Prev">httplib</A>  
  4. Up: <A HREF="../h/httplib" TYPE="Up">httplib</A>  
  5. Top: <A HREF="../t/top" TYPE="Top">Top</A>  
  6. <H2>10.3.1. HTTP Objects</H2>
  7. <CODE>HTTP</CODE> instances have the following methods:
  8. <P>
  9. <DL><DT><B>set_debuglevel</B> (<VAR>level</VAR>) -- Method on HTTP<DD>
  10. Set the debugging level (the amount of debugging output printed).
  11. The default debug level is <CODE>0</CODE>, meaning no debugging output is
  12. printed.
  13. </DL>
  14. <DL><DT><B>connect</B> (<VAR>host</VAR>[, <VAR>port</VAR>]) -- Method on HTTP<DD>
  15. Connect to the server given by <VAR>host</VAR> and <VAR>port</VAR>.  See the
  16. intro for the default port.  This should be called directly only if
  17. the instance was instantiated without passing a host.
  18. </DL>
  19. <DL><DT><B>send</B> (<VAR>data</VAR>) -- Method on HTTP<DD>
  20. Send data to the server.  This should be used directly only after the
  21. <CODE>endheaders()</CODE> method has been called and before
  22. <CODE>getreply()</CODE> has been called.
  23. </DL>
  24. <DL><DT><B>putrequest</B> (<VAR>request</VAR>, <VAR>selector</VAR>) -- Method on HTTP<DD>
  25. This should be the first call after the connection to the server has
  26. been made.  It sends a line to the server consisting of the
  27. <VAR>request</VAR> string, the <VAR>selector</VAR> string, and the HTTP version
  28. (<CODE>HTTP/1.0</CODE>).
  29. </DL>
  30. <DL><DT><B>putheader</B> (<VAR>header</VAR>, <VAR>argument</VAR>[, ...]) -- Method on HTTP<DD>
  31. Send an RFC-822 style header to the server.  It sends a line to the
  32. server consisting of the header, a colon and a space, and the first
  33. argument.  If more arguments are given, continuation lines are sent,
  34. each consisting of a tab and an argument.
  35. </DL>
  36. <DL><DT><B>endheaders</B> () -- Method on HTTP<DD>
  37. Send a blank line to the server, signalling the end of the headers.
  38. </DL>
  39. <DL><DT><B>getreply</B> () -- Method on HTTP<DD>
  40. Complete the request by shutting down the sending end of the socket,
  41. read the reply from the server, and return a triple (<VAR>replycode</VAR>,
  42. <VAR>message</VAR>, <VAR>headers</VAR>).  Here <VAR>replycode</VAR> is the integer
  43. reply code from the request (e.g. <CODE>200</CODE> if the request was
  44. handled properly); <VAR>message</VAR> is the message string corresponding
  45. to the reply code; and <VAR>header</VAR> is an instance of the class
  46. <CODE>rfc822.Message</CODE> containing the headers received from the server.
  47. See the description of the <CODE>rfc822</CODE> module.
  48. </DL>
  49. <DL><DT><B>getfile</B> () -- Method on HTTP<DD>
  50. Return a file object from which the data returned by the server can be
  51. read, using the <CODE>read()</CODE>, <CODE>readline()</CODE> or <CODE>readlines()</CODE>
  52. methods.
  53. </DL>
  54.