🛠️ fix(utils.py): 更新配置文件,添加MySQL连接信息说明
This commit is contained in:
parent
354c45356f
commit
7717ccac07
15
utils.py
15
utils.py
@ -8,11 +8,22 @@ from datetime import datetime, timedelta
|
|||||||
def load_config():
|
def load_config():
|
||||||
config_path = 'config.yaml'
|
config_path = 'config.yaml'
|
||||||
if not os.path.exists(config_path):
|
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:
|
with open(config_path, 'w') as f:
|
||||||
yaml.dump(config, f)
|
yaml.dump(config, f)
|
||||||
print(f"请在 {config_path} 中填入您的 tushare token")
|
print(f"请在 {config_path} 中填入您的 tushare token 和 MySQL 连接信息")
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
with open(config_path, 'r') as f:
|
with open(config_path, 'r') as f:
|
||||||
config = yaml.safe_load(f)
|
config = yaml.safe_load(f)
|
||||||
return config
|
return config
|
||||||
|
Loading…
Reference in New Issue
Block a user