[jhbuild/pre-3-cleanup: 8/16] httpcache: use parsedate_tz(), mktime_tz() from the email package



commit bf5ab7dfe1e9bfceb590397c41e0dc632baa716a
Author: Christoph Reiter <reiter christoph gmail com>
Date:   Sat Sep 21 22:52:15 2019 +0200

    httpcache: use parsedate_tz(), mktime_tz() from the email package
    
    This works with both Python 2 and 3

 jhbuild/utils/httpcache.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/jhbuild/utils/httpcache.py b/jhbuild/utils/httpcache.py
index 5f92939d..0a0c818b 100644
--- a/jhbuild/utils/httpcache.py
+++ b/jhbuild/utils/httpcache.py
@@ -33,7 +33,7 @@ import sys
 import urllib2
 import urlparse
 import time
-import rfc822
+from email.utils import parsedate_tz, mktime_tz
 import StringIO
 import gzip
 
@@ -52,9 +52,9 @@ def _format_isotime(tm):
     return time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime(tm))
 
 def _parse_date(date):
-    tm = rfc822.parsedate_tz(date)
+    tm = parsedate_tz(date)
     if tm:
-        return rfc822.mktime_tz(tm)
+        return mktime_tz(tm)
     return 0
 
 class CacheEntry:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]