From 5c44f6a41885c439e526dc3c022ff7daaa43c2c6 Mon Sep 17 00:00:00 2001 From: Lukas Metzger Date: Wed, 10 Jun 2020 20:44:19 +0200 Subject: Move dashboard to subfolder --- dash/db.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 dash/db.py (limited to 'dash/db.py') diff --git a/dash/db.py b/dash/db.py new file mode 100644 index 0000000..b417cfd --- /dev/null +++ b/dash/db.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python3 + +import pymysql +import configparser + +c = configparser.ConfigParser() +c.read('config.ini') + +def getConnection(): + db = pymysql.connect(c.get('db', 'host'), c.get('db', 'username'), c.get('db', 'password'), c.get('db', 'name'), cursorclass=pymysql.cursors.DictCursor) + return db + +def closeConnection(db): + db.commit() + db.close() + + + + + -- cgit v1.2.3-55-g7522