Files for 2.1b1 distribution.
[python/dscho.git] / Doc / lib / libgopherlib.tex
blobe2701f29be0a7a07420fe060a2aa3a0faf00e0f8
1 \section{\module{gopherlib} ---
2 Gopher protocol client}
4 \declaremodule{standard}{gopherlib}
5 \modulesynopsis{Gopher protocol client (requires sockets).}
7 \indexii{Gopher}{protocol}
9 This module provides a minimal implementation of client side of the
10 the Gopher protocol. It is used by the module \refmodule{urllib} to
11 handle URLs that use the Gopher protocol.
13 The module defines the following functions:
15 \begin{funcdesc}{send_selector}{selector, host\optional{, port}}
16 Send a \var{selector} string to the gopher server at \var{host} and
17 \var{port} (default \code{70}). Returns an open file object from
18 which the returned document can be read.
19 \end{funcdesc}
21 \begin{funcdesc}{send_query}{selector, query, host\optional{, port}}
22 Send a \var{selector} string and a \var{query} string to a gopher
23 server at \var{host} and \var{port} (default \code{70}). Returns an
24 open file object from which the returned document can be read.
25 \end{funcdesc}
27 Note that the data returned by the Gopher server can be of any type,
28 depending on the first character of the selector string. If the data
29 is text (first character of the selector is \samp{0}), lines are
30 terminated by CRLF, and the data is terminated by a line consisting of
31 a single \samp{.}, and a leading \samp{.} should be stripped from
32 lines that begin with \samp{..}. Directory listings (first character
33 of the selector is \samp{1}) are transferred using the same protocol.