Add forgotten initialization. Fixes bug #120994, "Traceback with
[python/dscho.git] / Doc / lib / libnetrc.tex
blobd11ed0101f2b81b0d411e55e8d39ea161825691a
1 \section{\module{netrc} ---
2 netrc file processing}
4 \declaremodule{standard}{netrc}
5 % Note the \protect needed for \file... ;-(
6 \modulesynopsis{Loading of \protect\file{.netrc} files.}
7 \moduleauthor{Eric S. Raymond}{esr@snark.thyrsus.com}
8 \sectionauthor{Eric S. Raymond}{esr@snark.thyrsus.com}
11 \versionadded{1.5.2}
13 The \class{netrc} class parses and encapsulates the netrc file format
14 used by the \UNIX{} \program{ftp} program and other FTP clients.
16 \begin{classdesc}{netrc}{\optional{file}}
17 A \class{netrc} instance or subclass instance encapsulates data from
18 a netrc file. The initialization argument, if present, specifies the
19 file to parse. If no argument is given, the file \file{.netrc} in the
20 user's home directory will be read. Parse errors will raise
21 \exception{SyntaxError} with diagnostic information including the file
22 name, line number, and terminating token.
23 \end{classdesc}
26 \subsection{netrc Objects \label{netrc-objects}}
28 A \class{netrc} instance has the following methods:
30 \begin{methoddesc}{authenticators}{host}
31 Return a 3-tuple \code{(\var{login}, \var{account}, \var{password})}
32 of authenticators for \var{host}. If the netrc file did not
33 contain an entry for the given host, return the tuple associated with
34 the `default' entry. If neither matching host nor default entry is
35 available, return \code{None}.
36 \end{methoddesc}
38 \begin{methoddesc}{__repr__}{}
39 Dump the class data as a string in the format of a netrc file.
40 (This discards comments and may reorder the entries.)
41 \end{methoddesc}
43 Instances of \class{netrc} have public instance variables:
45 \begin{memberdesc}{hosts}
46 Dictionary mapping host names to \code{(\var{login}, \var{account},
47 \var{password})} tuples. The `default' entry, if any, is represented
48 as a pseudo-host by that name.
49 \end{memberdesc}
51 \begin{memberdesc}{macros}
52 Dictionary mapping macro names to string lists.
53 \end{memberdesc}