def sensor_get_job(id):
    """user or agent requesting a job zip file"""
    # get the user (for logging)
    logger.debug("Dalton in sensor_get_job(): request for job zip file %s", id)
    if not validate_jobid(id):
        logger.error("Bad jobid given: '%s'. Possible hacking attempt.", id)
        return render_template(
            "/dalton/error.html",
            jid=id,
            msg=[f"Bad jobid, invalid characters in: '{id}'"],
        )
    path = f"{JOB_STORAGE_PATH}/{id}.zip"
    if os.path.exists(path):
        with open(path, "rb") as fh:
            logger.debug(f"Dalton in sensor_get_job(): sending job zip file {id}")
            return Response(
                fh.read(),
                mimetype="application/zip",
                headers={"Content-Disposition": f"attachment;filename={id}.zip"},
            )
    else:
        logger.error(f"Dalton in sensor_get_job(): could not find job {id} at {path}.")
        return render_template(
            "/dalton/error.html",
            jid=id,
            msg=[
                f"Job {id} does not exist on disk.  It is either invalid or has been deleted."
            ],
        )
user or agent requesting a job zip file
app/dalton.py