def download_result(): """Download result file""" try: data = request.get_json() if not (data and data.get("fileId")): return jsonify({ 'error': True, 'errorMessage': "Missing fileId parameter" }), 400 file_id = data["fileId"] result_info = {"id": file_id} result = Result(current_app, session, result_info) if not result: return jsonify({ 'error': True, 'errorMessage': "You do not have access to this result" }), 401 dir_path = result.get_dir_path() file_name = result.get_file_name() except Exception as e: traceback.print_exc(file=sys.stdout) return jsonify({'error': True, 'errorMessage': str(e)}), 500 return (send_from_directory(dir_path, file_name))
def download_result(): """Download result file""" try: file_id = request.get_json()["fileId"] result_info = {"id": file_id} result = Result(current_app, session, result_info) dir_path = result.get_dir_path() file_name = result.get_file_name() except Exception as e: traceback.print_exc(file=sys.stdout) return jsonify({'error': True, 'errorMessage': str(e)}), 500 return (send_from_directory(dir_path, file_name))