blob: 4d23769a953df5d0dc5ebe75d1a598e06b026811 [file] [log] [blame]
Guido van Rossum5e97c9d1998-12-22 05:18:24 +00001% Module and documentation by Eric S. Raymond, 21 Dec 1998
2\section{Standard Module \module{netrc}}
3\stmodindex{netrc}
4\label{module-netrc}
5
6The \code{netrc} class parses and encapsulates the netrc file format
7used by Unix's ftp(1) and other FTP clientd
8
9\begin{classdesc}{netrc}{\optional{file}}
10A \class{netrc} instance or subclass instance enapsulates data from
11a netrc file. The initialization argument, if present, specifies the file
12to parse. If no argument is given, the file .netrc in the user's home
13directory will be read. Parse errors will throw a SyntaxError
14exception with associated diagnostic information including the file
15name, line number, and terminating token.
16\end{classdesc}
17
18\subsection{netrc Objects}
19\label{netrc-objects}
20
21A \class{netrc} instance has the following methods:
22
23\begin{methoddesc}{authenticators}{}
24Return a 3-tuple (login, account, password) of authenticators for the
25given host. If the netrc file did not contain an entry for the given
26host, return the tuple associated with the `default' entry. If
27neither matching host nor default entry is available, return None.
28\end{methoddesc}
29
30\begin{methoddesc}{__repr__}{host}
31Dump the class data as a string in the format of a netrc file.
32(This discards comments and may reorder the entries.)
33\end{methoddesc}
34
35Instances of \class{netrc} have public instance variables:
36
37\begin{memberdesc}{hosts}
38Dictionmary mapping host names to login/account/password tuples. The
39`default' entry, if any, is represented as a pseudo-host by that name.
40\end{memberdesc}
41
42\begin{memberdesc}{macros}
43Dictionary mapping macro names to string lists.
44\end{memberdesc}
45
46
47