| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <link rel="STYLESHEET" href="lib.css" type='text/css' /> |
| 5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> |
| 6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> |
| 7 | <link rel="first" href="lib.html" title='Python Library Reference' /> |
| 8 | <link rel='contents' href='contents.html' title="Contents" /> |
| 9 | <link rel='index' href='genindex.html' title='Index' /> |
| 10 | <link rel='last' href='about.html' title='About this document...' /> |
| 11 | <link rel='help' href='about.html' title='About this document...' /> |
| 12 | <link rel="prev" href="module-netrc.html" /> |
| 13 | <link rel="parent" href="module-netrc.html" /> |
| 14 | <link rel="next" href="module-robotparser.html" /> |
| 15 | <meta name='aesop' content='information' /> |
| 16 | <title>12.18.1 netrc Objects </title> |
| 17 | </head> |
| 18 | <body> |
| 19 | <DIV CLASS="navigation"> |
| 20 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> |
| 21 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 22 | <tr> |
| 23 | <td class='online-navigation'><a rel="prev" title="12.18 netrc " |
| 24 | href="module-netrc.html"><img src='../icons/previous.png' |
| 25 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 26 | <td class='online-navigation'><a rel="parent" title="12.18 netrc " |
| 27 | href="module-netrc.html"><img src='../icons/up.png' |
| 28 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 29 | <td class='online-navigation'><a rel="next" title="12.19 robotparser " |
| 30 | href="module-robotparser.html"><img src='../icons/next.png' |
| 31 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 32 | <td align="center" width="100%">Python Library Reference</td> |
| 33 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 34 | href="contents.html"><img src='../icons/contents.png' |
| 35 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 36 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 37 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 38 | <td class='online-navigation'><a rel="index" title="Index" |
| 39 | href="genindex.html"><img src='../icons/index.png' |
| 40 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 41 | </tr></table> |
| 42 | <div class='online-navigation'> |
| 43 | <b class="navlabel">Previous:</b> |
| 44 | <a class="sectref" rel="prev" href="module-netrc.html">12.18 netrc </A> |
| 45 | <b class="navlabel">Up:</b> |
| 46 | <a class="sectref" rel="parent" href="module-netrc.html">12.18 netrc </A> |
| 47 | <b class="navlabel">Next:</b> |
| 48 | <a class="sectref" rel="next" href="module-robotparser.html">12.19 robotparser </A> |
| 49 | </div> |
| 50 | <hr /></div> |
| 51 | </DIV> |
| 52 | <!--End of Navigation Panel--> |
| 53 | |
| 54 | <H2><A NAME="SECTION00141810000000000000000"></A><A NAME="netrc-objects"></A> |
| 55 | <BR> |
| 56 | 12.18.1 netrc Objects |
| 57 | </H2> |
| 58 | |
| 59 | <P> |
| 60 | A <tt class="class">netrc</tt> instance has the following methods: |
| 61 | |
| 62 | <P> |
| 63 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 64 | <td><nobr><b><tt id='l2h-4197' xml:id='l2h-4197' class="method">authenticators</tt></b>(</nobr></td> |
| 65 | <td><var>host</var>)</td></tr></table></dt> |
| 66 | <dd> |
| 67 | Return a 3-tuple <code>(<var>login</var>, <var>account</var>, <var>password</var>)</code> |
| 68 | of authenticators for <var>host</var>. If the netrc file did not |
| 69 | contain an entry for the given host, return the tuple associated with |
| 70 | the `default' entry. If neither matching host nor default entry is |
| 71 | available, return <code>None</code>. |
| 72 | </dl> |
| 73 | |
| 74 | <P> |
| 75 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 76 | <td><nobr><b><tt id='l2h-4198' xml:id='l2h-4198' class="method">__repr__</tt></b>(</nobr></td> |
| 77 | <td><var></var>)</td></tr></table></dt> |
| 78 | <dd> |
| 79 | Dump the class data as a string in the format of a netrc file. |
| 80 | (This discards comments and may reorder the entries.) |
| 81 | </dl> |
| 82 | |
| 83 | <P> |
| 84 | Instances of <tt class="class">netrc</tt> have public instance variables: |
| 85 | |
| 86 | <P> |
| 87 | <dl><dt><b><tt id='l2h-4199' xml:id='l2h-4199' class="member">hosts</tt></b></dt> |
| 88 | <dd> |
| 89 | Dictionary mapping host names to <code>(<var>login</var>, <var>account</var>, |
| 90 | <var>password</var>)</code> tuples. The `default' entry, if any, is represented |
| 91 | as a pseudo-host by that name. |
| 92 | </dl> |
| 93 | |
| 94 | <P> |
| 95 | <dl><dt><b><tt id='l2h-4200' xml:id='l2h-4200' class="member">macros</tt></b></dt> |
| 96 | <dd> |
| 97 | Dictionary mapping macro names to string lists. |
| 98 | </dl> |
| 99 | |
| 100 | <P> |
| 101 | <span class="note"><b class="label">Note:</b> |
| 102 | Passwords are limited to a subset of the ASCII character set. |
| 103 | Versions of this module prior to 2.3 were extremely limited. Starting with |
| 104 | 2.3, all ASCII punctuation is allowed in passwords. However, note that |
| 105 | whitespace and non-printable characters are not allowed in passwords. This |
| 106 | is a limitation of the way the .netrc file is parsed and may be removed in |
| 107 | the future.</span> |
| 108 | |
| 109 | <DIV CLASS="navigation"> |
| 110 | <div class='online-navigation'> |
| 111 | <p></p><hr /> |
| 112 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 113 | <tr> |
| 114 | <td class='online-navigation'><a rel="prev" title="12.18 netrc " |
| 115 | href="module-netrc.html"><img src='../icons/previous.png' |
| 116 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 117 | <td class='online-navigation'><a rel="parent" title="12.18 netrc " |
| 118 | href="module-netrc.html"><img src='../icons/up.png' |
| 119 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 120 | <td class='online-navigation'><a rel="next" title="12.19 robotparser " |
| 121 | href="module-robotparser.html"><img src='../icons/next.png' |
| 122 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 123 | <td align="center" width="100%">Python Library Reference</td> |
| 124 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 125 | href="contents.html"><img src='../icons/contents.png' |
| 126 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 127 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 128 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 129 | <td class='online-navigation'><a rel="index" title="Index" |
| 130 | href="genindex.html"><img src='../icons/index.png' |
| 131 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 132 | </tr></table> |
| 133 | <div class='online-navigation'> |
| 134 | <b class="navlabel">Previous:</b> |
| 135 | <a class="sectref" rel="prev" href="module-netrc.html">12.18 netrc </A> |
| 136 | <b class="navlabel">Up:</b> |
| 137 | <a class="sectref" rel="parent" href="module-netrc.html">12.18 netrc </A> |
| 138 | <b class="navlabel">Next:</b> |
| 139 | <a class="sectref" rel="next" href="module-robotparser.html">12.19 robotparser </A> |
| 140 | </div> |
| 141 | </div> |
| 142 | <hr /> |
| 143 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> |
| 144 | </DIV> |
| 145 | <!--End of Navigation Panel--> |
| 146 | <ADDRESS> |
| 147 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. |
| 148 | </ADDRESS> |
| 149 | </BODY> |
| 150 | </HTML> |