mirror of https://github.com/testerSunshine/12306
Merge pull request #271 from taochenlove/master
fix warning:YAMLLoadWarning: calling yaml.load() without Loader=... i…pull/251/merge
commit
6fa4020593
|
@ -14,10 +14,10 @@ def _get_yaml():
|
||||||
path = os.path.join(os.path.dirname(__file__) + '/ticket_config.yaml')
|
path = os.path.join(os.path.dirname(__file__) + '/ticket_config.yaml')
|
||||||
try: # 兼容2和3版本
|
try: # 兼容2和3版本
|
||||||
with open(path, encoding="utf-8") as f:
|
with open(path, encoding="utf-8") as f:
|
||||||
s = yaml.load(f)
|
s = yaml.load(f, Loader=yaml.FullLoader)
|
||||||
except Exception:
|
except Exception:
|
||||||
with open(path) as f:
|
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
|
return s.decode() if isinstance(s, bytes) else s
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue