readConfig.py 1.03 KB
# coding:utf-8
import os
import configparser

# 配置文件路径
# configPath = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) + '\\common' + '\\config' + '\\cfg.ini'
configPath = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) + '/common' + '/config' + '/cfg.ini'
conf = configparser.ConfigParser()
conf.read(configPath, encoding='utf-8')

title = conf.get("email", "title")

port = conf.get("email", "port")

smtp_service = conf.get("email", "smtp_service")

smtp_server = conf.get("email", "smtp_server")

user = conf.get("email", "sender_qq")

pwd = conf.get("email", "pwd")

sender_163 = conf.get("email", "sender_163")

pwd_163 = conf.get("email", "pwd_163")

to = conf.get("email", "receiver")

email_text = conf.get("email", "email_text")

email_task = conf.get("email", "email_task")

MySQL_host = conf.get('MySQL', 'MySQL_host')

MySQL_user = conf.get('MySQL', 'MySQL_user')

MySQL_pwd = conf.get('MySQL', 'MySQL_pwd')

MySQL_database = conf.get('MySQL', 'MySQL_database')

MySQL_port = conf.get('MySQL', 'MySQL_port')