How to parse HTTP time header?
Philip Semanchuk
philip at semanchuk.com
Sat Nov 7 22:48:28 EST 2009
On Nov 7, 2009, at 10:39 PM, Kevin Ar18 wrote:
>
> Basically, I'm wondering if it is part of the standard library
> somewhere before I code my own.
>
> Page 20 of RFC2616 (HTTP) describes the format(s) for the time
> header. It wouldn't be too difficult for me to code up a solution
> for the 3 standard formats, but what get's me is the little note
> about how some servers may still send badly format time headers. :(
> So, I'm curious if this has already been done in the standard Python
> library?
The parsedate() function in the rfc822 module does this and claims to
be tolerant of slightly malformed dates, but that module is deprecated
as of Python 2.5 in favor of the email module which hopefully has an
equivalent function.
HTH
Philip
More information about the Python-list
mailing list