CreateFileFromPathObject

This automation is being executed by the "GetFilePathPreProcessing" pre-processing script that collects the paths and names of attachments of an incoming incident, then passes it to this automation that reads the files and creates them in an existing incident.

python · Community Common Scripts

Details

IDCreateFileFromPathObject
Languagepython
From Version6.2.0
Docker Imagedemisto/python3:3.12.13.11879924

README

This automation is being executed by the “GetFilePathPreProcessing” pre-processing script that collects the paths and names of attachments of an incoming incident, then passes it to this automation that reads the files and creates them in an existing incident.

Script Data


Name Description
Script Type python3
Tags  

Inputs


Argument Name Description
object path and name object passed by the “GetFilePathPreProcessing” pre-processing script

Outputs


There are no outputs for this script.

import demistomock as demisto  # noqa: F401
from CommonServerPython import *  # noqa: F401

obj = json.loads(demisto.args()["object"])
for attachment in obj:
    filePath = demisto.getFilePath(attachment["path"])["path"]
    with open(filePath, "rb") as f:
        data = f.read()
        demisto.results(fileResult(attachment["name"], data))