| 
									
										
										
										
											1998-12-22 18:24:13 +00:00
										 |  |  | \section{\module{netrc} --- | 
					
						
							| 
									
										
										
										
											1999-01-12 19:22:11 +00:00
										 |  |  |          netrc file processing} | 
					
						
							| 
									
										
										
										
											1998-12-22 18:24:13 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | \declaremodule{standard}{netrc} | 
					
						
							| 
									
										
										
										
											1999-01-12 19:22:11 +00:00
										 |  |  | % Note the \protect needed for \file... ;-(
 | 
					
						
							|  |  |  | \modulesynopsis{Loading of \protect\file{.netrc} files.} | 
					
						
							| 
									
										
										
										
											1998-12-22 18:24:13 +00:00
										 |  |  | \moduleauthor{Eric S. Raymond}{esr@snark.thyrsus.com} | 
					
						
							|  |  |  | \sectionauthor{Eric S. Raymond}{esr@snark.thyrsus.com} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1998-12-22 18:40:50 +00:00
										 |  |  | \versionadded{1.5.2} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1998-12-22 18:24:13 +00:00
										 |  |  | The \class{netrc} class parses and encapsulates the netrc file format | 
					
						
							|  |  |  | used by the \UNIX{} \program{ftp} program and other FTP clients. | 
					
						
							| 
									
										
										
										
											1998-12-22 05:18:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | \begin{classdesc}{netrc}{\optional{file}} | 
					
						
							| 
									
										
										
										
											2000-07-16 19:01:10 +00:00
										 |  |  | A \class{netrc} instance or subclass instance encapsulates data from  | 
					
						
							| 
									
										
										
										
											1998-12-22 18:24:13 +00:00
										 |  |  | a netrc file.  The initialization argument, if present, specifies the | 
					
						
							|  |  |  | file to parse.  If no argument is given, the file \file{.netrc} in the | 
					
						
							|  |  |  | user's home directory will be read.  Parse errors will raise | 
					
						
							| 
									
										
										
										
											2001-03-06 06:55:18 +00:00
										 |  |  | \exception{NetrcParseError} with diagnostic information including the | 
					
						
							|  |  |  | file name, line number, and terminating token. | 
					
						
							| 
									
										
										
										
											1998-12-22 05:18:24 +00:00
										 |  |  | \end{classdesc} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-03-06 06:55:18 +00:00
										 |  |  | \begin{excdesc}{NetrcParseError} | 
					
						
							|  |  |  | Exception raised by the \class{netrc} class when syntactical errors | 
					
						
							|  |  |  | are encountered in source text.  Instances of this exception provide | 
					
						
							|  |  |  | three interesting attributes:  \member{msg} is a textual explanation | 
					
						
							|  |  |  | of the error, \member{filename} is the name of the source file, and | 
					
						
							|  |  |  | \member{lineno} gives the line number on which the error was found. | 
					
						
							|  |  |  | \end{excdesc} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1999-04-23 17:03:21 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											1998-12-22 18:24:13 +00:00
										 |  |  | \subsection{netrc Objects \label{netrc-objects}} | 
					
						
							| 
									
										
										
										
											1998-12-22 05:18:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | A \class{netrc} instance has the following methods: | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1998-12-22 18:24:13 +00:00
										 |  |  | \begin{methoddesc}{authenticators}{host} | 
					
						
							|  |  |  | Return a 3-tuple \code{(\var{login}, \var{account}, \var{password})} | 
					
						
							|  |  |  | of authenticators for \var{host}.  If the netrc file did not | 
					
						
							|  |  |  | contain an entry for the given host, return the tuple associated with | 
					
						
							|  |  |  | the `default' entry.  If neither matching host nor default entry is | 
					
						
							|  |  |  | available, return \code{None}. | 
					
						
							| 
									
										
										
										
											1998-12-22 05:18:24 +00:00
										 |  |  | \end{methoddesc} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1999-04-23 17:03:21 +00:00
										 |  |  | \begin{methoddesc}{__repr__}{} | 
					
						
							| 
									
										
										
										
											1998-12-22 05:18:24 +00:00
										 |  |  | Dump the class data as a string in the format of a netrc file. | 
					
						
							|  |  |  | (This discards comments and may reorder the entries.) | 
					
						
							|  |  |  | \end{methoddesc} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Instances of \class{netrc} have public instance variables: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | \begin{memberdesc}{hosts} | 
					
						
							| 
									
										
										
										
											2000-04-03 20:13:55 +00:00
										 |  |  | Dictionary mapping host names to \code{(\var{login}, \var{account}, | 
					
						
							| 
									
										
										
										
											1998-12-22 18:24:13 +00:00
										 |  |  | \var{password})} tuples.  The `default' entry, if any, is represented | 
					
						
							|  |  |  | as a pseudo-host by that name. | 
					
						
							| 
									
										
										
										
											1998-12-22 05:18:24 +00:00
										 |  |  | \end{memberdesc} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | \begin{memberdesc}{macros} | 
					
						
							|  |  |  | Dictionary mapping macro names to string lists. | 
					
						
							|  |  |  | \end{memberdesc} |