py4cytoscape.commands.cyrest_get¶
-
cyrest_get
(operation=None, parameters=None, base_url='http://127.0.0.1:1234/v1', require_json=True, raw_get=False)[source]¶ Construct a query, make GET call and process the result.
- Parameters
operation (str) – A string to be converted to the REST query namespace
parameters (dict) – A named list of values to be converted to REST query parameters
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.
require_json (bool) – True if only JSON is accepted as a response; otherwise, return non-JSON if response is non-JSON
raw_get (bool) – False for normal calls; otherwise, True to skip trying to set the sandbox first
- Returns
a dict if result was JSON; otherwise a string
- Return type
str or dict
- Raises
ValueError – if JSON is expected and response is not JSON
requests.exceptions.RequestException – if can’t connect to Cytoscape or Cytoscape returns an error
Examples
>>> cyrest_get('gc', require_json=False) # starts Cytoscape garbage collection '' >>> cyrest_get('version') # fetches CyREST version {'apiVersion': 'v1', 'cytoscapeVersion': '3.8.0'}