🛠️ fix(utils.py): 更新配置文件,添加MySQL连接信息说明

This commit is contained in:
Qihang Zhang 2025-04-05 01:02:15 +08:00
parent 354c45356f
commit 7717ccac07

View File

@ -8,11 +8,22 @@ from datetime import datetime, timedelta
def load_config():
config_path = 'config.yaml'
if not os.path.exists(config_path):
config = {'tushare_token': 'sk - tushare token'}
config = {
'tushare_token': 'your_token_here',
'mysql': {
'user': 'user',
'password': 'password',
'host': '127.0.0.1',
'port': 3306,
'database': 'tushare',
'charset': 'utf8'
}
}
with open(config_path, 'w') as f:
yaml.dump(config, f)
print(f"请在 {config_path} 中填入您的 tushare token")
print(f"请在 {config_path} 中填入您的 tushare token 和 MySQL 连接信息")
exit(1)
with open(config_path, 'r') as f:
config = yaml.safe_load(f)
return config