Py3k,email header handling

TheSaint nobody at nowhere.net.no
Wed May 11 12:27:22 EDT 2011


Steven D'Aprano wrote:

> Before you re-write it, you should run 2to3 over it and see how much it
> can do automatically:

Widely done, only the results from some query has radically changed on 
favour of unicode. Errors raising about results which are not strings 
anymore.
 
> I'm afraid I don't understand the question.

Making an example :

from poplib import POP3 as pop3
pop3.user('userid')
pop3.pass_('password')
numMsg, total = pop3.stat()
for cnt in numMsgs:
   header = pop3.top(cnt)
   # here I'd like to pass the header to some function that will return
   # a dictionary filling
   # from', 'to', 'cc', 'bcc', 'date', 'subject', 'reply-to', 'message-id'
   # keys, if nothing the leave empty string or None
   dict = email.header,decode_header(header) # but might not my result
   # Should I subclass this?

The same would be from the IMAP4 message parsing. Some different process 
would take, would it ?

> If you have any more concrete questions, please ask.

If these aren't concrete questions, forgive me, I perhaps got into wrong 
news group.
In the other and I hugely apreciated your clues. I'll see the docs some more 
long to achieve a clear learning.

-- 
goto /dev/null



More information about the Python-list mailing list