not tested but try:
server_type = "server_type2" try: data_config = json.load(json_file) except ValueError: logging.critical("Data were not valid json for %s", data_config) else: if server_type not in data_config['server_model'].keys(): logging.critical("We can not continue: Server type %s not present in config file", server_type)depending on what you would do further it may be better to try to access data you want with
data_config['server_model'].get(server_type)
and act accordingly from there
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs