py4cytoscape.session.close_session

close_session(save_before_closing, filename=None, base_url='http://127.0.0.1:1234/v1')[source]

Close the current session in Cytoscape, destroying all unsaved work.

A boolean for whether to save before closing is required since you could lose data by closing without saving.

Parameters
  • save_before_closing (bool) – Whether to save before closing the current session. If False, then all unsaved work will be lost.

  • filename (str) – If save_before_closing is True and the session has not previously been saved, then the path and name of the session file to save should be provided.

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

Returns

{} empty

Return type

dict

Raises
  • CyError – if filename is invalid

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

Examples

>>> close_session(False) # delete the current session without saving it first
{}
>>> close_session(True) # delete the current session after saving it to the file it came from
{}
>>> close_session(True, 'new') # delete the current session after saving it to 'new.cys'
{}