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
1tcex = TcEx()
2
3<...snipped>
4
5try:
6 with open(datafile, 'r') as fh:
7 data = fh.read()
8except:
9 tcex.message_tc('Failed to open datafile for reading.')
10 tcex.exit_code = 1
11
12<snipped...>
13
14tcex.message_tc('File successfully read.')
15tcex.exit()