def handle_post()

in src/dlp-runner/main.py [0:0]


def handle_post():
    # Read inputs
    req = request.get_json()
    project_id = req["project_id"]
    input_file = req["input_file"]
    input_file_bucket = req["input_file_bucket"]
    output_file = req["output_file"]
    output_file_bucket = req["output_file_bucket"]
    dlp_template = req["dlp_template"]
    include_quotes_in_findings = req["include_quote_in_findings"]
    findings_labels = req["findings_labels"]

    try:
        result = process_image(input_file_bucket=input_file_bucket,
                               input_file=input_file,
                               output_file_bucket=output_file_bucket,
                               output_file=output_file,
                               project=project_id,
                               inspect_template=dlp_template,
                               include_quotes=include_quotes_in_findings,
                               labels=findings_labels)
        return jsonify(result)
    except Exception as e:
        print(f"error: {e}")
        return ("", 500)