fix warning:YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe

pull/271/head
mlhl 2019-05-07 11:06:34 +08:00
parent fd2f691ce3
commit a3bdb1c96c
1 changed files with 2 additions and 2 deletions

View File

@ -14,10 +14,10 @@ def _get_yaml():
path = os.path.join(os.path.dirname(__file__) + '/ticket_config.yaml')
try: # 兼容2和3版本
with open(path, encoding="utf-8") as f:
s = yaml.load(f)
s = yaml.load(f, Loader=yaml.FullLoader)
except Exception:
with open(path) as f:
s = yaml.load(f)
s = yaml.load(f, Loader=yaml.FullLoader)
return s.decode() if isinstance(s, bytes) else s