Commit | Line | Data |
---|---|---|
920dae64 AT |
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="next" href="pop3-example.html" /> | |
13 | <link rel="prev" href="module-poplib.html" /> | |
14 | <link rel="parent" href="module-poplib.html" /> | |
15 | <link rel="next" href="pop3-example.html" /> | |
16 | <meta name='aesop' content='information' /> | |
17 | <title>11.9.1 POP3 Objects </title> | |
18 | </head> | |
19 | <body> | |
20 | <DIV CLASS="navigation"> | |
21 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> | |
22 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
23 | <tr> | |
24 | <td class='online-navigation'><a rel="prev" title="11.9 poplib " | |
25 | href="module-poplib.html"><img src='../icons/previous.png' | |
26 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
27 | <td class='online-navigation'><a rel="parent" title="11.9 poplib " | |
28 | href="module-poplib.html"><img src='../icons/up.png' | |
29 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
30 | <td class='online-navigation'><a rel="next" title="11.9.2 POP3 Example" | |
31 | href="pop3-example.html"><img src='../icons/next.png' | |
32 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
33 | <td align="center" width="100%">Python Library Reference</td> | |
34 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
35 | href="contents.html"><img src='../icons/contents.png' | |
36 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
37 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
38 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
39 | <td class='online-navigation'><a rel="index" title="Index" | |
40 | href="genindex.html"><img src='../icons/index.png' | |
41 | border='0' height='32' alt='Index' width='32' /></A></td> | |
42 | </tr></table> | |
43 | <div class='online-navigation'> | |
44 | <b class="navlabel">Previous:</b> | |
45 | <a class="sectref" rel="prev" href="module-poplib.html">11.9 poplib </A> | |
46 | <b class="navlabel">Up:</b> | |
47 | <a class="sectref" rel="parent" href="module-poplib.html">11.9 poplib </A> | |
48 | <b class="navlabel">Next:</b> | |
49 | <a class="sectref" rel="next" href="pop3-example.html">11.9.2 POP3 Example</A> | |
50 | </div> | |
51 | <hr /></div> | |
52 | </DIV> | |
53 | <!--End of Navigation Panel--> | |
54 | ||
55 | <H2><A NAME="SECTION0013910000000000000000"></A><A NAME="pop3-objects"></A> | |
56 | <BR> | |
57 | 11.9.1 POP3 Objects | |
58 | </H2> | |
59 | ||
60 | <P> | |
61 | All POP3 commands are represented by methods of the same name, | |
62 | in lower-case; most return the response text sent by the server. | |
63 | ||
64 | <P> | |
65 | An <tt class="class">POP3</tt> instance has the following methods: | |
66 | ||
67 | <P> | |
68 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
69 | <td><nobr><b><tt id='l2h-3376' xml:id='l2h-3376' class="method">set_debuglevel</tt></b>(</nobr></td> | |
70 | <td><var>level</var>)</td></tr></table></dt> | |
71 | <dd> | |
72 | Set the instance's debugging level. This controls the amount of | |
73 | debugging output printed. The default, <code>0</code>, produces no | |
74 | debugging output. A value of <code>1</code> produces a moderate amount of | |
75 | debugging output, generally a single line per request. A value of | |
76 | <code>2</code> or higher produces the maximum amount of debugging output, | |
77 | logging each line sent and received on the control connection. | |
78 | </dl> | |
79 | ||
80 | <P> | |
81 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
82 | <td><nobr><b><tt id='l2h-3377' xml:id='l2h-3377' class="method">getwelcome</tt></b>(</nobr></td> | |
83 | <td><var></var>)</td></tr></table></dt> | |
84 | <dd> | |
85 | Returns the greeting string sent by the POP3 server. | |
86 | </dl> | |
87 | ||
88 | <P> | |
89 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
90 | <td><nobr><b><tt id='l2h-3378' xml:id='l2h-3378' class="method">user</tt></b>(</nobr></td> | |
91 | <td><var>username</var>)</td></tr></table></dt> | |
92 | <dd> | |
93 | Send user command, response should indicate that a password is required. | |
94 | </dl> | |
95 | ||
96 | <P> | |
97 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
98 | <td><nobr><b><tt id='l2h-3379' xml:id='l2h-3379' class="method">pass_</tt></b>(</nobr></td> | |
99 | <td><var>password</var>)</td></tr></table></dt> | |
100 | <dd> | |
101 | Send password, response includes message count and mailbox size. | |
102 | Note: the mailbox on the server is locked until <tt class="method">quit()</tt> is | |
103 | called. | |
104 | </dl> | |
105 | ||
106 | <P> | |
107 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
108 | <td><nobr><b><tt id='l2h-3380' xml:id='l2h-3380' class="method">apop</tt></b>(</nobr></td> | |
109 | <td><var>user, secret</var>)</td></tr></table></dt> | |
110 | <dd> | |
111 | Use the more secure APOP authentication to log into the POP3 server. | |
112 | </dl> | |
113 | ||
114 | <P> | |
115 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
116 | <td><nobr><b><tt id='l2h-3381' xml:id='l2h-3381' class="method">rpop</tt></b>(</nobr></td> | |
117 | <td><var>user</var>)</td></tr></table></dt> | |
118 | <dd> | |
119 | Use RPOP authentication (similar to UNIX r-commands) to log into POP3 server. | |
120 | </dl> | |
121 | ||
122 | <P> | |
123 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
124 | <td><nobr><b><tt id='l2h-3382' xml:id='l2h-3382' class="method">stat</tt></b>(</nobr></td> | |
125 | <td><var></var>)</td></tr></table></dt> | |
126 | <dd> | |
127 | Get mailbox status. The result is a tuple of 2 integers: | |
128 | <code>(<var>message count</var>, <var>mailbox size</var>)</code>. | |
129 | </dl> | |
130 | ||
131 | <P> | |
132 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
133 | <td><nobr><b><tt id='l2h-3383' xml:id='l2h-3383' class="method">list</tt></b>(</nobr></td> | |
134 | <td><var></var><big>[</big><var>which</var><big>]</big><var></var>)</td></tr></table></dt> | |
135 | <dd> | |
136 | Request message list, result is in the form | |
137 | <code>(<var>response</var>, ['mesg_num octets', ...], <var>octets</var>)</code>. | |
138 | If <var>which</var> is set, it is the message to list. | |
139 | </dl> | |
140 | ||
141 | <P> | |
142 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
143 | <td><nobr><b><tt id='l2h-3384' xml:id='l2h-3384' class="method">retr</tt></b>(</nobr></td> | |
144 | <td><var>which</var>)</td></tr></table></dt> | |
145 | <dd> | |
146 | Retrieve whole message number <var>which</var>, and set its seen flag. | |
147 | Result is in form <code>(<var>response</var>, ['line', ...], <var>octets</var>)</code>. | |
148 | </dl> | |
149 | ||
150 | <P> | |
151 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
152 | <td><nobr><b><tt id='l2h-3385' xml:id='l2h-3385' class="method">dele</tt></b>(</nobr></td> | |
153 | <td><var>which</var>)</td></tr></table></dt> | |
154 | <dd> | |
155 | Flag message number <var>which</var> for deletion. On most servers | |
156 | deletions are not actually performed until QUIT (the major exception is | |
157 | Eudora QPOP, which deliberately violates the RFCs by doing pending | |
158 | deletes on any disconnect). | |
159 | </dl> | |
160 | ||
161 | <P> | |
162 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
163 | <td><nobr><b><tt id='l2h-3386' xml:id='l2h-3386' class="method">rset</tt></b>(</nobr></td> | |
164 | <td><var></var>)</td></tr></table></dt> | |
165 | <dd> | |
166 | Remove any deletion marks for the mailbox. | |
167 | </dl> | |
168 | ||
169 | <P> | |
170 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
171 | <td><nobr><b><tt id='l2h-3387' xml:id='l2h-3387' class="method">noop</tt></b>(</nobr></td> | |
172 | <td><var></var>)</td></tr></table></dt> | |
173 | <dd> | |
174 | Do nothing. Might be used as a keep-alive. | |
175 | </dl> | |
176 | ||
177 | <P> | |
178 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
179 | <td><nobr><b><tt id='l2h-3388' xml:id='l2h-3388' class="method">quit</tt></b>(</nobr></td> | |
180 | <td><var></var>)</td></tr></table></dt> | |
181 | <dd> | |
182 | Signoff: commit changes, unlock mailbox, drop connection. | |
183 | </dl> | |
184 | ||
185 | <P> | |
186 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
187 | <td><nobr><b><tt id='l2h-3389' xml:id='l2h-3389' class="method">top</tt></b>(</nobr></td> | |
188 | <td><var>which, howmuch</var>)</td></tr></table></dt> | |
189 | <dd> | |
190 | Retrieves the message header plus <var>howmuch</var> lines of the message | |
191 | after the header of message number <var>which</var>. Result is in form | |
192 | <code>(<var>response</var>, ['line', ...], <var>octets</var>)</code>. | |
193 | ||
194 | <P> | |
195 | The POP3 TOP command this method uses, unlike the RETR command, | |
196 | doesn't set the message's seen flag; unfortunately, TOP is poorly | |
197 | specified in the RFCs and is frequently broken in off-brand servers. | |
198 | Test this method by hand against the POP3 servers you will use before | |
199 | trusting it. | |
200 | </dl> | |
201 | ||
202 | <P> | |
203 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
204 | <td><nobr><b><tt id='l2h-3390' xml:id='l2h-3390' class="method">uidl</tt></b>(</nobr></td> | |
205 | <td><var></var><big>[</big><var>which</var><big>]</big><var></var>)</td></tr></table></dt> | |
206 | <dd> | |
207 | Return message digest (unique id) list. | |
208 | If <var>which</var> is specified, result contains the unique id for that | |
209 | message in the form <code>'<var>response</var> <var>mesgnum</var> <var>uid</var></code>, | |
210 | otherwise result is list <code>(<var>response</var>, ['mesgnum uid', ...], | |
211 | <var>octets</var>)</code>. | |
212 | </dl> | |
213 | ||
214 | <P> | |
215 | Instances of <tt class="class">POP3_SSL</tt> have no additional methods. The | |
216 | interface of this subclass is identical to its parent. | |
217 | ||
218 | <P> | |
219 | ||
220 | <DIV CLASS="navigation"> | |
221 | <div class='online-navigation'> | |
222 | <p></p><hr /> | |
223 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
224 | <tr> | |
225 | <td class='online-navigation'><a rel="prev" title="11.9 poplib " | |
226 | href="module-poplib.html"><img src='../icons/previous.png' | |
227 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
228 | <td class='online-navigation'><a rel="parent" title="11.9 poplib " | |
229 | href="module-poplib.html"><img src='../icons/up.png' | |
230 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
231 | <td class='online-navigation'><a rel="next" title="11.9.2 POP3 Example" | |
232 | href="pop3-example.html"><img src='../icons/next.png' | |
233 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
234 | <td align="center" width="100%">Python Library Reference</td> | |
235 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
236 | href="contents.html"><img src='../icons/contents.png' | |
237 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
238 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
239 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
240 | <td class='online-navigation'><a rel="index" title="Index" | |
241 | href="genindex.html"><img src='../icons/index.png' | |
242 | border='0' height='32' alt='Index' width='32' /></A></td> | |
243 | </tr></table> | |
244 | <div class='online-navigation'> | |
245 | <b class="navlabel">Previous:</b> | |
246 | <a class="sectref" rel="prev" href="module-poplib.html">11.9 poplib </A> | |
247 | <b class="navlabel">Up:</b> | |
248 | <a class="sectref" rel="parent" href="module-poplib.html">11.9 poplib </A> | |
249 | <b class="navlabel">Next:</b> | |
250 | <a class="sectref" rel="next" href="pop3-example.html">11.9.2 POP3 Example</A> | |
251 | </div> | |
252 | </div> | |
253 | <hr /> | |
254 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> | |
255 | </DIV> | |
256 | <!--End of Navigation Panel--> | |
257 | <ADDRESS> | |
258 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. | |
259 | </ADDRESS> | |
260 | </BODY> | |
261 | </HTML> |