cookielib.http2time()
¶
Returns time in seconds since epoch of time represented by a string.
Return value is an integer.
None is returned if the format of str is unrecognized, the time is outside the representable range, or the timezone string is not recognized. If the string contains no timezone, UTC is assumed.
The timezone in the string may be numerical (like “-0800” or “+0100”) or a string timezone (like “UTC”, “GMT”, “BST” or “EST”). Currently, only the timezone strings equivalent to UTC (zero offset) are known to the function.
The function loosely parses the following formats:
Wed, 09 Feb 1994 22:23:32 GMT – HTTP format Tuesday, 08-Feb-94 14:15:29 GMT – old rfc850 HTTP format Tuesday, 08-Feb-1994 14:15:29 GMT – broken rfc850 HTTP format 09 Feb 1994 22:23:32 GMT – HTTP format (no weekday) 08-Feb-94 14:15:29 GMT – rfc850 format (no weekday) 08-Feb-1994 14:15:29 GMT – broken rfc850 format (no weekday)
The parser ignores leading and trailing whitespace. The time may be absent.
If the year is given with only 2 digits, the function will select the century that makes the year closest to the current date.