Frequently asked questions

How do I handle Python module dependencies for my app?

You can manage dependencies on Python modules by packaging the required modules with the app, or by adding PIP dependencies in the app JSON.

When an action is executed, the platform adds the following directories to the PYTHONPATH environment:

  • /opt/phantom/lib
  • /opt/phantom/www
  • /opt/phantom/apps/[app_install_directory]
  • /opt/phantom/apps/[app_install_directory]/dependencies

Use Python modules included with Splunk SOAR (On-premises)

The following Python modules are already available to Splunk SOAR (On-premises) apps, so you don't need to specify them as dependencies or include their wheel files:

  • beautifulsoup4
  • soupsieve
  • parse
  • python_dateutil
  • six
  • requests
  • certifi
  • charset_normalizer
  • idna
  • urllib3
  • sh
  • xmltodict

Package required modules with the app

Place all required modules as part of the app TAR file. You can do this in the following ways:

  • Install the modules into a sub directory of the app. PIP supports the --target command line switch that allows the modules to be installed at a specific location. Use this switch to install the modules into the app's subdirectory called dependencies. When the app TAR file is installed on the platform the modules will be part of the app code.
  • Distribute the complete module, including the source and license file, in a sub directory of the app. In this case the app will need to append any folders in the PYTHONPATH it self.

The platform will install all the files present in the app TAR file in the app install directory. Be careful while packaging modules this way. Many Python modules are released under various licenses. Make sure the license allows for such redistribution. Packaging modules this way makes the app self-sufficient.

Add PIP dependencies in the app JSON

Specify app dependencies in the app JSON so that the platform tries to install the dependencies with the app. See Specifying pip dependencies for more information.

How do I address issues with an older app I developed?

If you developed an app with an earlier version of Splunk SOAR (On-premises), be sure to use the entire import statement shown here.

import phantom.app as phantom