From 0647156ed167449546f529ca354cf1c3282a698e Mon Sep 17 00:00:00 2001 From: Lukas Metzger Date: Thu, 28 May 2020 14:28:43 +0200 Subject: Read config from file --- db.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'db.py') diff --git a/db.py b/db.py index 583dfd5..b417cfd 100644 --- a/db.py +++ b/db.py @@ -1,9 +1,13 @@ #!/usr/bin/env python3 import pymysql +import configparser + +c = configparser.ConfigParser() +c.read('config.ini') def getConnection(): - db = pymysql.connect('mysql.oebsrv.int.intranet', 'bwlehrpool', 'weav3Nu8ShaifaePh6aiqu6aetei7e', 'bwlehrpool', cursorclass=pymysql.cursors.DictCursor) + 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): -- cgit v1.2.3-55-g7522