Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(15604)

Side by Side Diff: Lib/poplib.py

Issue 21804: Implement thr UTF8 command (RFC 6856) in poplib.
Patch Set: Created 5 years, 3 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Doc/library/poplib.rst ('k') | Lib/test/test_poplib.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 """A POP3 client class. 1 """A POP3 client class.
2 2
3 Based on the J. Myers POP3 draft, Jan. 96 3 Based on the J. Myers POP3 draft, Jan. 96
4 """ 4 """
5 5
6 # Author: David Ascher <david_ascher@brown.edu> 6 # Author: David Ascher <david_ascher@brown.edu>
7 # [heavily stealing from nntplib.py] 7 # [heavily stealing from nntplib.py]
8 # Updated: Piers Lauder <piers@cs.su.oz.au> [Jul '97] 8 # Updated: Piers Lauder <piers@cs.su.oz.au> [Jul '97]
9 # String method conversion and test jig improvements by ESR, February 2001. 9 # String method conversion and test jig improvements by ESR, February 2001.
10 # Added the POP3_SSL class. Methods loosely based on IMAP_SSL. Hector Urtubia <u rtubia@mrbook.org> Aug 2003 10 # Added the POP3_SSL class. Methods loosely based on IMAP_SSL. Hector Urtubia <u rtubia@mrbook.org> Aug 2003
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 NOOP noop() 63 NOOP noop()
64 RSET rset() 64 RSET rset()
65 QUIT quit() 65 QUIT quit()
66 66
67 Optional Commands (some servers support these): 67 Optional Commands (some servers support these):
68 RPOP name rpop(name) 68 RPOP name rpop(name)
69 APOP name digest apop(name, digest) 69 APOP name digest apop(name, digest)
70 TOP msg n top(msg, n) 70 TOP msg n top(msg, n)
71 UIDL [msg] uidl(msg = None) 71 UIDL [msg] uidl(msg = None)
72 CAPA capa() 72 CAPA capa()
73 STLS stls() 73 STLS stls()
Jim.J.Jewett 2014/06/23 15:24:37 Should UTF8 be added to this list?
zvyn 2014/07/02 02:03:31 Yes, I missed that.
74 74
75 Raises one exception: 'error_proto'. 75 Raises one exception: 'error_proto'.
76 76
77 Instantiate with: 77 Instantiate with:
78 POP3(hostname, port=110) 78 POP3(hostname, port=110)
79 79
80 NB: the POP protocol locks the mailbox from user 80 NB: the POP protocol locks the mailbox from user
81 authorization until QUIT, so be sure to get in, suck 81 authorization until QUIT, so be sure to get in, suck
82 the messages, and quit, each time you access the 82 the messages, and quit, each time you access the
83 mailbox. 83 mailbox.
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 def uidl(self, which=None): 334 def uidl(self, which=None):
335 """Return message digest (unique id) list. 335 """Return message digest (unique id) list.
336 336
337 If 'which', result contains unique id for that message 337 If 'which', result contains unique id for that message
338 in the form 'response mesgnum uid', otherwise result is 338 in the form 'response mesgnum uid', otherwise result is
339 the list ['response', ['mesgnum uid', ...], octets] 339 the list ['response', ['mesgnum uid', ...], octets]
340 """ 340 """
341 if which is not None: 341 if which is not None:
342 return self._shortcmd('UIDL %s' % which) 342 return self._shortcmd('UIDL %s' % which)
343 return self._longcmd('UIDL') 343 return self._longcmd('UIDL')
344
345
346 def utf8(self):
347 """Enter UTF-8 mode if supported by the server. Return server
348 response. Specified in RFC 6856.
349 """
350 return self._shortcmd('UTF8')
Jim.J.Jewett 2014/06/23 15:24:37 What happens if the server does not support UTF-8
zvyn 2014/07/02 02:03:31 The server responds with an error. (I'll try to ma
344 351
345 352
346 def capa(self): 353 def capa(self):
347 """Return server capabilities (RFC 2449) as a dictionary 354 """Return server capabilities (RFC 2449) as a dictionary
348 >>> c=poplib.POP3('localhost') 355 >>> c=poplib.POP3('localhost')
349 >>> c.capa() 356 >>> c.capa()
350 {'IMPLEMENTATION': ['Cyrus', 'POP3', 'server', 'v2.2.12'], 357 {'IMPLEMENTATION': ['Cyrus', 'POP3', 'server', 'v2.2.12'],
351 'TOP': [], 'LOGIN-DELAY': ['0'], 'AUTH-RESP-CODE': [], 358 'TOP': [], 'LOGIN-DELAY': ['0'], 'AUTH-RESP-CODE': [],
352 'EXPIRE': ['NEVER'], 'USER': [], 'STLS': [], 'PIPELINING': [], 359 'EXPIRE': ['NEVER'], 'USER': [], 'STLS': [], 'PIPELINING': [],
353 'UIDL': [], 'RESP-CODES': []} 360 'UIDL': [], 'RESP-CODES': []}
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 a.pass_(sys.argv[3]) 459 a.pass_(sys.argv[3])
453 a.list() 460 a.list()
454 (numMsgs, totalSize) = a.stat() 461 (numMsgs, totalSize) = a.stat()
455 for i in range(1, numMsgs + 1): 462 for i in range(1, numMsgs + 1):
456 (header, msg, octets) = a.retr(i) 463 (header, msg, octets) = a.retr(i)
457 print("Message %d:" % i) 464 print("Message %d:" % i)
458 for line in msg: 465 for line in msg:
459 print(' ' + line) 466 print(' ' + line)
460 print('-----------------------') 467 print('-----------------------')
461 a.quit() 468 a.quit()
OLDNEW
« no previous file with comments | « Doc/library/poplib.rst ('k') | Lib/test/test_poplib.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+