diff options
author | Lukas Metzger | 2020-07-01 16:10:22 +0200 |
---|---|---|
committer | Lukas Metzger | 2020-07-01 16:10:22 +0200 |
commit | bcb9dcdc9b28b6d54c996287f471717677454ebe (patch) | |
tree | 3f831016aec1d8b0d5bb1daa15be29f09057bbbc /import | |
parent | Fixes for vms (diff) | |
download | bwlp-statistics-bcb9dcdc9b28b6d54c996287f471717677454ebe.tar.gz bwlp-statistics-bcb9dcdc9b28b6d54c996287f471717677454ebe.tar.xz bwlp-statistics-bcb9dcdc9b28b6d54c996287f471717677454ebe.zip |
Fixed import script to use correct data
Diffstat (limited to 'import')
-rw-r--r-- | import/import.py | 6 |
1 files changed, 5 insertions, 1 deletions
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() |