diff options
Diffstat (limited to 'import/import.py')
-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() |