📄 netrc-objects.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>12.17.1 netrc Objects </title>
<META NAME="description" CONTENT="12.17.1 netrc Objects ">
<META NAME="keywords" CONTENT="lib">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="STYLESHEET" href="lib.css" tppabs="http://www.python.org/doc/current/lib/lib.css">
<LINK REL="previous" href="module-netrc.html" tppabs="http://www.python.org/doc/current/lib/module-netrc.html">
<LINK REL="up" href="module-netrc.html" tppabs="http://www.python.org/doc/current/lib/module-netrc.html">
<LINK REL="next" href="module-robotparser.html" tppabs="http://www.python.org/doc/current/lib/module-robotparser.html">
</head>
<body>
<DIV CLASS="navigation"><table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><A href="module-netrc.html" tppabs="http://www.python.org/doc/current/lib/module-netrc.html"><img src="previous.gif" tppabs="http://www.python.org/doc/current/icons/previous.gif" border="0" height="32"
alt="Previous Page" width="32"></A></td>
<td><A href="module-netrc.html" tppabs="http://www.python.org/doc/current/lib/module-netrc.html"><img src="up.gif" tppabs="http://www.python.org/doc/current/icons/up.gif" border="0" height="32"
alt="Up One Level" width="32"></A></td>
<td><A href="module-robotparser.html" tppabs="http://www.python.org/doc/current/lib/module-robotparser.html"><img src="next.gif" tppabs="http://www.python.org/doc/current/icons/next.gif" border="0" height="32"
alt="Next Page" width="32"></A></td>
<td align="center" width="100%">Python Library Reference</td>
<td><A href="contents.html" tppabs="http://www.python.org/doc/current/lib/contents.html"><img src="contents.gif" tppabs="http://www.python.org/doc/current/icons/contents.gif" border="0" height="32"
alt="Contents" width="32"></A></td>
<td><a href="modindex.html" tppabs="http://www.python.org/doc/current/lib/modindex.html" title="Module Index"><img src="modules.gif" tppabs="http://www.python.org/doc/current/icons/modules.gif" border="0" height="32"
alt="Module Index" width="32"></a></td>
<td><A href="genindex.html" tppabs="http://www.python.org/doc/current/lib/genindex.html"><img src="index.gif" tppabs="http://www.python.org/doc/current/icons/index.gif" border="0" height="32"
alt="Index" width="32"></A></td>
</tr></table>
<b class="navlabel">Previous:</b> <a class="sectref" href="module-netrc.html" tppabs="http://www.python.org/doc/current/lib/module-netrc.html">12.17 netrc </A>
<b class="navlabel">Up:</b> <a class="sectref" href="module-netrc.html" tppabs="http://www.python.org/doc/current/lib/module-netrc.html">12.17 netrc </A>
<b class="navlabel">Next:</b> <a class="sectref" href="module-robotparser.html" tppabs="http://www.python.org/doc/current/lib/module-robotparser.html">12.18 robotparser </A>
<br><hr></DIV>
<!--End of Navigation Panel-->
<H2>
<BR>
12.17.1 netrc Objects
</H2>
<P>
A <tt class="class">netrc</tt> instance has the following methods:
<P>
<dl><dt><b><a name='l2h-2543'><tt class='method'>authenticators</tt></a></b> (<var>host</var>)
<dd>
Return a 3-tuple <code>(<var>login</var>, <var>account</var>, <var>password</var>)</code>
of authenticators for <var>host</var>. 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</code>.
</dl>
<P>
<dl><dt><b><a name='l2h-2544'><tt class='method'>__repr__</tt></a></b> ()
<dd>
Dump the class data as a string in the format of a netrc file.
(This discards comments and may reorder the entries.)
</dl>
<P>
Instances of <tt class="class">netrc</tt> have public instance variables:
<P>
<dl><dt><b><a name='l2h-2545'><tt class='member'>hosts</tt></a></b>
<dd>
Dictionary mapping host names to <code>(<var>login</var>, <var>account</var>,
<var>password</var>)</code> tuples. The `default' entry, if any, is represented
as a pseudo-host by that name.
</dl>
<P>
<dl><dt><b><a name='l2h-2546'><tt class='member'>macros</tt></a></b>
<dd>
Dictionary mapping macro names to string lists.
</dl>
<DIV CLASS="navigation"><p><hr><table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><A href="module-netrc.html" tppabs="http://www.python.org/doc/current/lib/module-netrc.html"><img src="previous.gif" tppabs="http://www.python.org/doc/current/icons/previous.gif" border="0" height="32"
alt="Previous Page" width="32"></A></td>
<td><A href="module-netrc.html" tppabs="http://www.python.org/doc/current/lib/module-netrc.html"><img src="up.gif" tppabs="http://www.python.org/doc/current/icons/up.gif" border="0" height="32"
alt="Up One Level" width="32"></A></td>
<td><A href="module-robotparser.html" tppabs="http://www.python.org/doc/current/lib/module-robotparser.html"><img src="next.gif" tppabs="http://www.python.org/doc/current/icons/next.gif" border="0" height="32"
alt="Next Page" width="32"></A></td>
<td align="center" width="100%">Python Library Reference</td>
<td><A href="contents.html" tppabs="http://www.python.org/doc/current/lib/contents.html"><img src="contents.gif" tppabs="http://www.python.org/doc/current/icons/contents.gif" border="0" height="32"
alt="Contents" width="32"></A></td>
<td><a href="modindex.html" tppabs="http://www.python.org/doc/current/lib/modindex.html" title="Module Index"><img src="modules.gif" tppabs="http://www.python.org/doc/current/icons/modules.gif" border="0" height="32"
alt="Module Index" width="32"></a></td>
<td><A href="genindex.html" tppabs="http://www.python.org/doc/current/lib/genindex.html"><img src="index.gif" tppabs="http://www.python.org/doc/current/icons/index.gif" border="0" height="32"
alt="Index" width="32"></A></td>
</tr></table>
<b class="navlabel">Previous:</b> <a class="sectref" href="module-netrc.html" tppabs="http://www.python.org/doc/current/lib/module-netrc.html">12.17 netrc </A>
<b class="navlabel">Up:</b> <a class="sectref" href="module-netrc.html" tppabs="http://www.python.org/doc/current/lib/module-netrc.html">12.17 netrc </A>
<b class="navlabel">Next:</b> <a class="sectref" href="module-robotparser.html" tppabs="http://www.python.org/doc/current/lib/module-robotparser.html">12.18 robotparser </A>
</DIV>
<!--End of Navigation Panel-->
<ADDRESS>
<hr>See <i><a href="about.html" tppabs="http://www.python.org/doc/current/lib/about.html">About this document...</a></i> for information on suggesting changes.
</ADDRESS>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -