summaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2018-04-09 21:29:47 +0100
committerV3n3RiX <venerix@redcorelinux.org>2018-04-09 21:29:47 +0100
commit2f8d2d0f382802815a947230c905abe82a9dc9db (patch)
tree5295339daf4f3b8c62e4ef97cf53fe47ad1b4c02 /src/backend
parentaf815fd33ccfc02002eb7b325ba9bcbe3b49aaab (diff)
use python-dateutil parser to parse remote timestamp (more reliable and safe)
Diffstat (limited to 'src/backend')
-rwxr-xr-xsrc/backend/libsisyphus.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/backend/libsisyphus.py b/src/backend/libsisyphus.py
index 36a2dce..59bf310 100755
--- a/src/backend/libsisyphus.py
+++ b/src/backend/libsisyphus.py
@@ -9,7 +9,9 @@ import subprocess
import sys
import urllib3
import io
+
from datetime import datetime
+from dateutil import parser
redcore_portage_config_path = '/opt/redcore-build'
@@ -98,11 +100,11 @@ def syncAll():
http = urllib3.PoolManager()
reqRmtPkgTs = http.request('HEAD',rmtCsvUrl)
- rmtPkgTs = int(datetime.strptime(reqRmtPkgTs.headers['last-modified'], '%a, %d %b %Y %H:%M:%S %Z').strftime("%s"))
+ rmtPkgTs = int(parser.parse(reqRmtPkgTs.headers['last-modified']).strftime("%s"))
lclPkgTs = int(datetime.utcnow().strftime("%s"))
reqRmtDscTs = http.request('HEAD',rmtDscUrl)
- rmtDscTs = int(datetime.strptime(reqRmtDscTs.headers['last-modified'], '%a, %d %b %Y %H:%M:%S %Z').strftime("%s"))
+ rmtDscTs = int(parser.parse(reqRmtDscTs.headers['last-modified']).strftime("%s"))
lclDscTs = int(datetime.utcnow().strftime("%s"))
if rmtPkgTs > lclPkgTs or rmtDscTs > lclDscTs: