Message TC

All ThreatConnect ™ Exchange Apps should write an exit message on successful or failed execution. The TcEx Frameworks provides the message_tc() method to handle writing this message. The contents of message_tc are shown in the ThreatConnect UI and should provide a meaning message to the user.

Warning

The Message TC exit message only supports up to 255 characters. All data added after that will be truncated.

Hint

A successful execution might output: A total of 132 Indicators were written to Acme Corp.

Hint

A failed execution might output: Invalid API key provided for remote service.

Example Exit Message

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
tcex = TcEx()

<...snipped>

try:
    with open(datafile, 'r') as fh:
        data = fh.read()
except:
    tcex.message_tc('Failed to open datafile for reading.')
    tcex.exit_code(1)

<snipped...>

tcex.message_tc('File successfully read.')
tcex.exit()