|
@@ -19,6 +19,7 @@ from .qr import get_qr_code
|
|
|
from .bar import get_bar_code
|
|
|
from json import dumps, load, loads
|
|
|
from sqlite3 import connect
|
|
|
+from datetime import datetime, timezone
|
|
|
|
|
|
SCHEME = "https://"
|
|
|
HOST = ""
|
|
@@ -40,7 +41,7 @@ def parse_data_uri(content):
|
|
|
return {
|
|
|
'mimetype': mimetype,
|
|
|
'params': dict(map(lambda x: x.split('='), params)),
|
|
|
- 'encoding': None,
|
|
|
+ 'encoding': encoding,
|
|
|
'data': data,
|
|
|
}
|
|
|
|
|
@@ -148,6 +149,7 @@ LIMIT 1;
|
|
|
finally:
|
|
|
con.close()
|
|
|
|
|
|
+ created = datetime.strptime(created, '%Y-%m-%d %H:%M:%S').replace(tzinfo=timezone.utc).timestamp()
|
|
|
data = parse_data_uri(content)
|
|
|
assert data['mimetype'].split(';', 1)[0] == mimetype.split(';', 1)[0], f"mimetype in db and data uri differ"
|
|
|
charset = data['params'].get('charset', None)
|