Bare except clause removed from SMTPHandler.emit(). Now, only ImportError is trapped.
[python.git] / Doc / lib / libnetrc.tex
blobf2a0c1cf388cefb46efabec5644626c974a023bd
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{NetrcParseError} with diagnostic information including the
22 file name, line number, and terminating token.
23 \end{classdesc}
25 \begin{excdesc}{NetrcParseError}
26 Exception raised by the \class{netrc} class when syntactical errors
27 are encountered in source text. Instances of this exception provide
28 three interesting attributes: \member{msg} is a textual explanation
29 of the error, \member{filename} is the name of the source file, and
30 \member{lineno} gives the line number on which the error was found.
31 \end{excdesc}
34 \subsection{netrc Objects \label{netrc-objects}}
36 A \class{netrc} instance has the following methods:
38 \begin{methoddesc}{authenticators}{host}
39 Return a 3-tuple \code{(\var{login}, \var{account}, \var{password})}
40 of authenticators for \var{host}. If the netrc file did not
41 contain an entry for the given host, return the tuple associated with
42 the `default' entry. If neither matching host nor default entry is
43 available, return \code{None}.
44 \end{methoddesc}
46 \begin{methoddesc}{__repr__}{}
47 Dump the class data as a string in the format of a netrc file.
48 (This discards comments and may reorder the entries.)
49 \end{methoddesc}
51 Instances of \class{netrc} have public instance variables:
53 \begin{memberdesc}{hosts}
54 Dictionary mapping host names to \code{(\var{login}, \var{account},
55 \var{password})} tuples. The `default' entry, if any, is represented
56 as a pseudo-host by that name.
57 \end{memberdesc}
59 \begin{memberdesc}{macros}
60 Dictionary mapping macro names to string lists.
61 \end{memberdesc}
63 \note{Passwords are limited to a subset of the ASCII character set.
64 Versions of this module prior to 2.3 were extremely limited. Starting with
65 2.3, all ASCII punctuation is allowed in passwords. However, note that
66 whitespace and non-printable characters are not allowed in passwords. This
67 is a limitation of the way the .netrc file is parsed and may be removed in
68 the future.}