RcGcDb/src/config.py

10 lines
446 B
Python
Raw Normal View History

2020-07-09 22:24:23 +00:00
import json, sys, logging
try: # load settings
2020-12-13 21:01:51 +00:00
with open("settings.json", encoding="utf8") as sfile:
2020-07-09 22:24:23 +00:00
settings = json.load(sfile)
if "user-agent" in settings["header"]:
2021-03-16 20:46:31 +00:00
settings["header"]["user-agent"] = settings["header"]["user-agent"].format(version="1.1") # set the version in the useragent
2020-07-09 22:24:23 +00:00
except FileNotFoundError:
logging.critical("No config file could be found. Please make sure settings.json is in the directory.")
sys.exit(1)