MCPcopy Index your code
hub / github.com/fluentpython/example-code-2e / parse_date

Function parse_date

21-async/mojifinder/bottle.py:2550–2556  ·  view source on GitHub ↗

Parse rfc1123, rfc850 and asctime timestamps and return UTC epoch.

(ims)

Source from the content-addressed store, hash-verified

2548 return value
2549
2550def parse_date(ims):
2551 """ Parse rfc1123, rfc850 and asctime timestamps and return UTC epoch. """
2552 try:
2553 ts = email.utils.parsedate_tz(ims)
2554 return time.mktime(ts[:8] + (0,)) - (ts[9] or 0) - time.timezone
2555 except (TypeError, ValueError, IndexError, OverflowError):
2556 return None
2557
2558def parse_auth(header):
2559 """ Parse rfc2617 HTTP authentication header string (basic) and return (user,pass) tuple or None"""

Callers 2

BaseResponseClass · 0.85
static_fileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected