def get_config(config_path): if os.path.isfile(config_path): if os.stat(config_path).st_size > 0: json_config = json.load(open(config_path)) else: json_config = {} else: json_config = {} file_name = os.path.basename(config_path) if file_name == "config.json": json_config2 = json.loads( json.dumps(make_settings.config(**json_config), default=lambda o: o.__dict__)) else: if "onlyfans" in json_config: new = {} new["supported"] = json_config json_config = new json_config2 = json.loads( json.dumps(make_settings.extra_auth(**json_config), default=lambda o: o.__dict__)) if json_config != json_config2: update_config(json_config2, file_name=file_name) if not json_config: input( f"The .settings\\{file_name} file has been created. Fill in whatever you need to fill in and then press enter when done.\n" ) json_config2 = json.load(open(config_path)) json_config = copy.deepcopy(json_config2) return json_config, json_config2
def get_config(config_path): if os.path.exists(config_path): json_config = json.load(open(config_path)) else: json_config = {} json_config2 = copy.deepcopy(json_config) json_config, string = make_settings.fix(json_config) file_name = os.path.basename(config_path) json_config = json.loads(json.dumps(make_settings.config( **json_config), default=lambda o: o.__dict__)) hashed = DeepHash(json_config)[json_config] hashed2 = DeepHash(json_config2)[json_config2] if hashed != hashed2: update_config(json_config, file_name=file_name) if not json_config: input( f"The .settings\\{file_name} file has been created. Fill in whatever you need to fill in and then press enter when done.\n") json_config = json.load(open(config_path)) return json_config, json_config2
def get_config(config_path): if os.path.exists(config_path): json_config = ujson.load(open(config_path)) else: json_config = {} json_config2 = copy.deepcopy(json_config) json_config = make_settings.fix(json_config) file_name = os.path.basename(config_path) json_config = ujson.loads(json.dumps(make_settings.config( **json_config), default=lambda o: o.__dict__)) updated = False if json_config != json_config2: updated = True filepath = os.path.join(".settings", "config.json") export_data(json_config, filepath) if not json_config: input( f"The .settings\\{file_name} file has been created. Fill in whatever you need to fill in and then press enter when done.\n") json_config = ujson.load(open(config_path)) return json_config, updated