gesomax / httplib2

Automatically exported from code.google.com/p/httplib2
0 stars 0 forks source link

Badly formatted dates cause exceptions #52

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
The date parsing code looks like this:

    elif response_headers.has_key('date'):
        date =
calendar.timegm(email.Utils.parsedate_tz(response_headers['date']))

This doesn't catch errors.  You'll get a confusing exception about tuples
if you have a parsing error (I think parsedate_tz returns None).  I think
it should simply swallow errors for this, but at least a preferable result
would be a more sensible error (ideally showing the problematic date).

Original issue reported on code.google.com by ianbick...@gmail.com on 31 Mar 2009 at 6:28