1 \section{\module{netrc
} ---
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
}
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.
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
}.
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.)
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.
51 \begin{memberdesc
}{macros
}
52 Dictionary mapping macro names to string lists.