config.ini
[db]
server =
username =
password =
database =
driver = {ODBC Driver 17 for SQL Server}
configparser_test.py
from configparser import ConfigParser
def load_config(self):
cf = ConfigParser()
cf.read('config.ini')
server = cf.get('db', 'server')
username = cf.get('db', 'username')
password = cf.get('db', 'password')
database = cf.get('db', 'database')
driver = cf.get('db', 'driver')
return server, username, password, database, driver