Use ast parser to parse ETag, also in db.py.

This commit is contained in:
Michael Herzberg 2019-05-15 22:47:44 +01:00
parent 15f478ee78
commit 67d14bb7fb
1 changed files with 2 additions and 1 deletions

View File

@ -31,6 +31,7 @@ import glob
import datetime import datetime
import hashlib import hashlib
from jsmin import jsmin from jsmin import jsmin
import ast
def get_etag(ext_id, datepath, con): def get_etag(ext_id, datepath, con):
@ -48,7 +49,7 @@ def get_etag(ext_id, datepath, con):
with open(headerpath) as f: with open(headerpath) as f:
content = f.read() content = f.read()
try: try:
headers = eval(content) headers = ast.literal_eval(content)
if "ETag" in headers: if "ETag" in headers:
return headers["ETag"] return headers["ETag"]
except Exception: except Exception: