diff --git a/fact_extractor/server.py b/fact_extractor/server.py index 03f894d5..a0625c50 100644 --- a/fact_extractor/server.py +++ b/fact_extractor/server.py @@ -1,3 +1,4 @@ +import logging import os import traceback from pathlib import Path @@ -13,7 +14,7 @@ app = Flask(__name__) api = Api(app) config = load_config('main.cfg') -setup_logging(debug=False) +setup_logging(False, log_level=int(os.getenv('LOG_LEVEL', logging.WARNING))) # pylint: disable=invalid-envvar-default @api.resource('/start/', methods=['GET']) @@ -25,10 +26,10 @@ def get(self, folder): input_dir = Path(config.get('unpack', 'data_folder'), folder, 'input') try: input_file = list(input_dir.iterdir())[0] - unpack(file_path=input_file, config=config, folder=folder) + unpack(file_path=str(input_file), config=config, folder=folder) if self.owner: change_owner_of_output_files(input_dir.parent, self.owner) - except Exception: + except Exception: # pylint: disable=broad-except return str(traceback.format_exc()), 400 return '', 200