From bcb9dcdc9b28b6d54c996287f471717677454ebe Mon Sep 17 00:00:00 2001 From: Lukas Metzger Date: Wed, 1 Jul 2020 16:10:22 +0200 Subject: Fixed import script to use correct data --- import/import.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/import/import.py b/import/import.py index 1e29451..68324c5 100644 --- a/import/import.py +++ b/import/import.py @@ -7,6 +7,8 @@ import re import pymysql import configparser +import datetime + def default(x, default): return default if x is None else x @@ -19,7 +21,9 @@ c.read('config.ini') filename = os.path.basename(sys.argv[1]) date = re.search('^[0-9]{4}-[0-9]{2}-[0-9]{2}', filename).group(0) -ip = re.search('_([0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3})_', filename).group(1) +date = datetime.datetime.fromtimestamp(int(data['days7']['tsTo'])).date() + +ip = re.search('_([0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3})[_\.]', filename).group(1) db = pymysql.connect(c.get('db', 'host'), c.get('db', 'username'), c.get('db', 'password'), c.get('db', 'name'), cursorclass=pymysql.cursors.DictCursor) cursor = db.cursor() -- cgit v1.2.3-55-g7522