blob: 6ae913c5ec957c732a1c4fd5ba5c08b803e3e9b7 [file] [log] [blame]
Guido van Rossum470be141995-03-17 16:07:09 +00001\section{Standard Module \sectcode{gopherlib}}
Guido van Rossume47da0a1997-07-17 16:34:52 +00002\label{module-gopherlib}
Guido van Rossuma12ef941995-02-27 17:53:25 +00003\stmodindex{gopherlib}
Guido van Rossum86751151995-02-28 17:14:32 +00004
5\renewcommand{\indexsubitem}{(in module gopherlib)}
6
Guido van Rossumcca8d2b1995-03-22 15:48:46 +00007This module provides a minimal implementation of client side of the
8the Gopher protocol. It is used by the module \code{urllib} to handle
9URLs that use the Gopher protocol.
10
11The module defines the following functions:
12
13\begin{funcdesc}{send_selector}{selector\, host\optional{\, port}}
14Send a \var{selector} string to the gopher server at \var{host} and
15\var{port} (default 70). Return an open file object from which the
16returned document can be read.
17\end{funcdesc}
18
19\begin{funcdesc}{send_query}{selector\, query\, host\optional{\, port}}
20Send a \var{selector} string and a \var{query} string to a gopher
21server at \var{host} and \var{port} (default 70). Return an open file
22object from which the returned document can be read.
23\end{funcdesc}
24
25Note that the data returned by the Gopher server can be of any type,
26depending on the first character of the selector string. If the data
27is text (first character of the selector is \samp{0}), lines are
28terminated by CRLF, and the data is terminated by a line consisting of
29a single \samp{.}, and a leading \samp{.} should be stripped from
30lines that begin with \samp{..}. Directory listings (first charactger
31of the selector is \samp{1}) are transferred using the same protocol.