python-dateutil suggestiopn
Chris Angelico
rosuav at gmail.com
Fri Aug 29 19:40:27 EDT 2014
On Sat, Aug 30, 2014 at 9:35 AM, Skip Montanaro <skip at pobox.com> wrote:
> I'm using imaplib to download and process messages from Gmail. I use
> dateutil.parser.parse to parse the Date header into a datetime object, then
> use the most recent date I've seen to decide where to start up on the next
> run.
>
> Every once in awhile, I encountered a Date header I couldn't parse. The
> couple I've seen so far have the same problem: two different spellings of
> the timezone offset.
>
> Sat, 23 Aug 2014 16:42:08 -0700 (GMT-07:00)
> Fri, 22 Aug 2014 18:14:46 -0700 (GMT-07:00)
That's an RFC 822 comment attached to the Date header. I've no idea
why you're seeing that - which client feels the need to adorn the date
like that??? - but I think it would be appropriate to remove anything
in parentheses before attempting to parse the date.
ChrisA
More information about the Python-list
mailing list