home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / p / python / pyhtmldoc / g / gopherlib < prev   
Encoding:
Text File  |  1996-11-14  |  1.7 KB  |  30 lines

  1. <TITLE>gopherlib -- Python library reference</TITLE>
  2. Next: <A HREF="../n/nntplib" TYPE="Next">nntplib</A>  
  3. Prev: <A HREF="../f/ftplib" TYPE="Prev">ftplib</A>  
  4. Up: <A HREF="../i/internet_and_www" TYPE="Up">Internet and WWW</A>  
  5. Top: <A HREF="../t/top" TYPE="Top">Top</A>  
  6. <H1>10.5. Standard Module <CODE>gopherlib</CODE></H1>
  7. This module provides a minimal implementation of client side of the
  8. the Gopher protocol.  It is used by the module <CODE>urllib</CODE> to handle
  9. URLs that use the Gopher protocol.
  10. <P>
  11. The module defines the following functions:
  12. <P>
  13. <DL><DT><B>send_selector</B> (<VAR>selector</VAR>, <VAR>host</VAR>[, <VAR>port</VAR>]) -- function of module gopherlib<DD>
  14. Send a <VAR>selector</VAR> string to the gopher server at <VAR>host</VAR> and
  15. <VAR>port</VAR> (default 70).  Return an open file object from which the
  16. returned document can be read.
  17. </DL>
  18. <DL><DT><B>send_query</B> (<VAR>selector</VAR>, <VAR>query</VAR>, <VAR>host</VAR>[, <VAR>port</VAR>]) -- function of module gopherlib<DD>
  19. Send a <VAR>selector</VAR> string and a <VAR>query</VAR> string to a gopher
  20. server at <VAR>host</VAR> and <VAR>port</VAR> (default 70).  Return an open file
  21. object from which the returned document can be read.
  22. </DL>
  23. Note that the data returned by the Gopher server can be of any type,
  24. depending on the first character of the selector string.  If the data
  25. is text (first character of the selector is `<SAMP>0</SAMP>'), lines are
  26. terminated by CRLF, and the data is terminated by a line consisting of
  27. a single `<SAMP>.</SAMP>', and a leading `<SAMP>.</SAMP>' should be stripped from
  28. lines that begin with `<SAMP>..</SAMP>'.  Directory listings (first charactger
  29. of the selector is `<SAMP>1</SAMP>') are transferred using the same protocol.
  30.