py4cytoscape.commands.commands_post

commands_post(cmd, base_url='http://127.0.0.1:1234/v1')[source]

Commands POST.

Using the same syntax as Cytoscape’s Command Line Dialog, this function converts a command string into a CyREST query URL, executes a POST request, and parses the result content into a dict 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 structured command reply

Return type

dict or list

Raises
  • CyError – if command has an error

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

Examples

>>> commands_post('apps status app="Network Merge"')
{'appName': 'Network Merge', 'status': 'Installed'}
>>> commands_post('apps list available')
[{appName: 'CHAT', 'description': 'Identify contextually relevant hubs in biological networks', 'details': ''},
 {'appName': 'AgilentLiteratureSearch', 'description': 'Mines scientific literature to ... ', 'details': ''} ...]