1 % Module and documentation by Eric S. Raymond, 21 Dec 1998
3 \section{\module{netrc
} ---
6 \declaremodule{standard
}{netrc
}
7 % Note the \protect needed for \file... ;-(
8 \modulesynopsis{Loading of
\protect\file{.netrc
} files.
}
9 \moduleauthor{Eric S. Raymond
}{esr@snark.thyrsus.com
}
10 \sectionauthor{Eric S. Raymond
}{esr@snark.thyrsus.com
}
15 The
\class{netrc
} class parses and encapsulates the netrc file format
16 used by the
\UNIX{} \program{ftp
} program and other FTP clients.
18 \begin{classdesc
}{netrc
}{\optional{file
}}
19 A
\class{netrc
} instance or subclass instance enapsulates data from
20 a netrc file. The initialization argument, if present, specifies the
21 file to parse. If no argument is given, the file
\file{.netrc
} in the
22 user's home directory will be read. Parse errors will raise
23 \exception{SyntaxError
} with diagnostic information including the file
24 name, line number, and terminating token.
28 \subsection{netrc Objects
\label{netrc-objects
}}
30 A
\class{netrc
} instance has the following methods:
32 \begin{methoddesc
}{authenticators
}{host
}
33 Return a
3-tuple
\code{(
\var{login
},
\var{account
},
\var{password
})
}
34 of authenticators for
\var{host
}. If the netrc file did not
35 contain an entry for the given host, return the tuple associated with
36 the `default' entry. If neither matching host nor default entry is
37 available, return
\code{None
}.
40 \begin{methoddesc
}{__repr__
}{}
41 Dump the class data as a string in the format of a netrc file.
42 (This discards comments and may reorder the entries.)
45 Instances of
\class{netrc
} have public instance variables:
47 \begin{memberdesc
}{hosts
}
48 Dictionmary mapping host names to
\code{(
\var{login
},
\var{account
},
49 \var{password
})
} tuples. The `default' entry, if any, is represented
50 as a pseudo-host by that name.
53 \begin{memberdesc
}{macros
}
54 Dictionary mapping macro names to string lists.