py4cytoscape.commands.commands_get

commands_get(cmd_string, base_url='http://127.0.0.1:1234/v1')[source]

Commands GET.

Using the same syntax as Cytoscape’s Command Line Dialog, this function converts a command string into a CyREST query URL, executes a GET request, and parses the result content into a list object.

Parameters
  • cmd_string (str) – command

  • base_url (str) – Ignore unless you need to specify a custom domain, port or version to connect to the CyREST API. Default is http://127.0.0.1:1234 and the latest version of the CyREST API supported by this version of py4cytoscape.

Returns

a list of lines in the command result (omitting the “Finished” line at the end)

Return type

list

Raises
  • CyError – if command has an error

  • requests.exceptions.RequestException – if can’t connect to Cytoscape or Cytoscape returns an error

Examples

>>> commands_get('command sleep duration=5')
[]
>>> commands_get('apps status app="Network Merge"')
['app: Network Merge, status: Installed']
>>> commands_get('view')
["Available commands for 'view':", 'create', 'destroy', 'export', 'fit content', 'fit selected', ...]