py4cytoscape.commands.commands_run

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

Run a Command.

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. Same as commandsGET.

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_run('session new destroyCurrentSession=true')
[]