def info_dict(headers): rv = {"headers": headers, "metadata": headers_metadata(headers)} if "content-length" in headers: rv["size"] = int(headers["content-length"]) if "content-type" in headers: rv["mimetype"] = headers["content-type"] if "date" in headers: rv["date"] = rfc822_parsedate(headers["date"]) if "last-modified" in headers: rv["modify"] = rfc822_parsedate(headers["last-modified"]) return rv
def test_rfc822(): s = rfc822_fmtdate() dt = rfc822_parsedate(s) eq_(s, rfc822_fmtdate(dt)) eq_(dt, rfc822_parsedate(s))