# Python X2Go (Client) API Documentation (v0.6.1.3)

## x2go.session module

X2GoSession class - a public API of Python X2Go, handling standalone X2Go sessions.

This class is normally embedded into the context of an `x2go.client.X2GoClient` instance, but it is also possible to address an `x2go.session.X2GoSession` directly via this class.

To launch a session manually from the Python interactive shell, perform these simple steps:

    Python 3.5.3 (default, Jan 19 2017, 14:11:04)
    [GCC 6.3.0 20170118] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import x2go
    >>> import gevent
    >>> s = x2go.session.X2GoSession()
    >>> s.set_server('<my.x2go.server>')
    >>> s.set_port(<ssh-port>)
    >>> s.connect('<my-login>', '<my-password>')
    [<pidno>] (x2gocontrolsession-pylib) NOTICE: connecting to [<my.x2go.server>]:<ssh-port>
    [<pidno>] (x2gosession-pylib) NOTICE: SSH host key verification for host [<my.x2go.server>]:<ssh-port> with SSH-RSA fingerprint ,,<ssh-fingerprint>'' initiated. We are seeing this X2Go server for the first time.
    [<pidno>] (x2gosession-pylib) WARN: HOOK_check_host_dialog: host check requested for [<my.x2go.server>]:<ssh-port> with SSH-RSA fingerprint: ,,<ssh-fingerprint>''. Automatically adding host as known host.
    True
    >>> s.start(cmd="LXDE")
    True
    >>> while True: gevent.sleep(1)

class `x2go.session.``X2GoSession`(server=None, port=22, control_session=None, use_sshproxy=False, sshproxy_reuse_authinfo=False, profile_id=None, profile_name='UNKNOWN', session_name=None, auto_start_or_resume=False, auto_connect=False, printing=False, allow_mimebox=False, mimebox_extensions=[], mimebox_action='OPEN', allow_share_local_folders=False, share_local_folders=[], restore_shared_local_folders=False, control_backend='PLAIN', terminal_backend='PLAIN', info_backend='PLAIN', list_backend='PLAIN', proxy_backend='NX3', settings_backend='FILE', printing_backend='FILE', client_rootdir='/sbuild-nonexistent/.x2goclient', sessions_rootdir='/sbuild-nonexistent/.x2go', ssh_rootdir='/sbuild-nonexistent/.ssh', keep_controlsession_alive=False, add_to_known_hosts=False, known_hosts=None, forward_sshagent=False, logger=None, loglevel=56, connected=False, activated=False, virgin=True, running=None, suspended=None, terminated=None, faulty=None, client_instance=None, **params)

  Bases: `object`

  Public API class for launching X2Go sessions. Recommended is to manage X2Go sessions from within an `x2go.client.X2GoClient` instance. However, Python X2Go is designed in a way that it also allows the management of singel `x2go.session.X2GoSession` instance.

  Thus, you can use the `x2go.session.X2GoSession` class to manually set up X2Go sessions without `x2go.client.X2GoClient` context (session registry, session list cache, auto-registration of new sessions etc.).

  `HOOK_auto_connect`()

    HOOK method: called if the session demands to auto connect.

  `HOOK_check_host_dialog`(host, port, fingerprint='no fingerprint', fingerprint_type='UNKNOWN')

    HOOK method: called if a host check is requested. This hook has to either return `True` (default) or `False`.

    Parameters:

    - host (`str`) – SSH server name to validate
    - port (`int`) – SSH server port to validate
    - fingerprint (`str`) – the server’s fingerprint (Default value = ‘no fingerprint’)
    - fingerprint_type (`str`) – finger print type (like RSA, DSA, …) (Default value = ‘UNKNOWN’)

    Returns: | if host validity is verified, this hook method should return `True`
    Return type: | `bool`

  `HOOK_desktop_sharing_denied`()

    HOOK method: called if the startup of a shadow session was denied by the other user.

  `HOOK_foldersharing_not_available`()

    HOOK method: called if X2Go client-side folder-sharing is not available.

  `HOOK_forwarding_tunnel_setup_failed`(chain_host='UNKNOWN', chain_port=0, subsystem=None)

    HOOK method: called if a port forwarding tunnel setup failed.

    Parameters:

    - chain_host (`str`) – hostname of chain host (forwarding tunnel end point) (Default value = ‘UNKNOWN’)
    - chain_port (`str`) – port of chain host (forwarding tunnel end point) (Default value = 0)
    - subsystem (`str`) – information on the subsystem that provoked this hook call (Default value = None)

  `HOOK_list_desktops_timeout`()

    HOOK method: called if the x2golistdesktops command generates a timeout due to long execution time.

  `HOOK_mimebox_not_available`()

    HOOK method: called if the X2Go MIME box is not available.

  `HOOK_no_such_desktop`(desktop='UNKNOWN')

    HOOK method: called if it is tried to connect to a shared desktop that’s not available (anymore).

    Parameters: | desktop (`str`) – the could-not-be-shared desktop’s name or other identifier (Default value = ‘UNKNOWN’)

  `HOOK_on_control_session_death`()

    HOOK method: called if a control session (server connection) has unexpectedly encountered a failure.

  `HOOK_on_failing_SFTP_client`()

    HOOK method: called SFTP client support is unavailable for the session.

  `HOOK_printing_not_available`()

    HOOK method: called if X2Go client-side printing is not available.

  `HOOK_rforward_request_denied`(server_port=0)

    HOOK method: called if a reverse port forwarding request has been denied.

    Parameters: | server_port (`str`) – remote server port (starting point of reverse forwarding tunnel) (Default value = 0)

  `HOOK_session_startup_failed`()

    HOOK method: called if the startup of a session failed.

  `HOOK_sshfs_not_available`()

    HOOK method: called if the X2Go server denies SSHFS access.

  `can_auto_connect`()

    Check if a session is configured adequately to be able to auto-connect to the X2Go server (e.g. public key authentication).

    Returns: | returns `True` if the session can auto-connect, `False` otherwise, `None` if no control session has been set up yet.
    Return type: | `bool`

  `can_sshproxy_auto_connect`()

    Check if a session’s SSH proxy (if used) is configured adequately to be able to auto-connect to the SSH proxy server (e.g. by public key authentication).

    Returns: | returns `True` if the session’s SSH proxy can auto-connect, `False` otherwise, `None` if no SSH proxy is used for this session, `None` is returned.
    Return type: | `bool`

  `check_host`()

    Provide a host check mechanism. This method basically calls the `HOOK_check_host_dialog()` method which by itself calls the `X2GoClient.HOOK_check_host_dialog()` method. Make sure you override any of these to enable user interaction on X2Go server validity checks.

    Returns: | returns `True` if an X2Go server host is valid for authentication
    Return type: | `bool`

  `clean_sessions`(destroy_terminals=True, published_applications=False)

    Clean all running sessions for the authenticated user on the remote X2Go server.

    Parameters:

    - destroy_terminals (`bool`) – destroy associated terminal sessions (Default value = True)
    - published_applications (`bool`) – clean sessions that are published applications providers, too (Default value = False)

  `color_depth_from_session_name`()

    Extract color depth from session name.

    Returns: | the session’s color depth (as found in the session name)
    Return type: | `str`

  `connect`(username=None, password=None, passphrase=None, add_to_known_hosts=None, force_password_auth=None, look_for_keys=None, allow_agent=None, use_sshproxy=None, sshproxy_user=None, sshproxy_password=None, sshproxy_passphrase=None, sshproxy_force_password_auth=None, sshproxy_reuse_authinfo=None)

    Connects to the `x2go.session.X2GoSession`’s server host. This method basically wraps around the `X2GoControlSession*.connect()` method.

    Parameters:

    - username (`str`) – the username for the X2Go server that is going to be connected to (as a last minute way of changing the session username) (Default value = None)
    - password (`str`) – the user’s password for the X2Go server that is going to be connected to (Default value = None)
    - passphrase (`str`) – a passphrase to use for unlocking a private key in case the password is already needed for two-factor authentication (Default value = None)
    - add_to_known_hosts (`bool`) – non-paramiko option, if `True` paramiko.AutoAddPolicy() is used as missing-host-key-policy. If set to `False` paramiko.RejectPolicy() is used (Default value = None)
    - force_password_auth (`bool`) – disable SSH pub/priv key authentication mechanisms completely (Default value = None)
    - look_for_keys (`bool`) – set to `True` to enable searching for discoverable private key files in `~/.ssh/` (Default value = None)
    - allow_agent (`bool`) – set to `True` to enable connecting to a local SSH agent for acquiring authentication information (Default value = None)
    - use_sshproxy (`bool`) – use an SSH proxy host for connecting the target X2Go server (Default value = None)
    - sshproxy_reuse_authinfo (`bool`) – for proxy authentication re-use the X2Go session’s password / key file (Default value = None)
    - sshproxy_user (`str`) – username for authentication against the SSH proxy host (Default value = None)
    - sshproxy_password (`str`) – password for authentication against the SSH proxy host (Default value = None)
    - sshproxy_passphrase (`str`) – a passphrase to use for unlocking a private key needed for the SSH proxy host in case the sshproxy_password is already needed for two-factor authentication (Default value = None)
    - sshproxy_force_password_auth (`bool`) – enforce password authentication even is a key(file) is present (Default value = None)

    Returns: | returns `True` is the connection to the X2Go server has been successful
    Return type: | `bool`

    Raises:

    - X2GoSessionException – on control session exceptions
    - X2GoRemoteHomeException – if the remote home directory does not exist
    - Exception – any other exception during connecting is passed through

  `disconnect`()

    Disconnect this `x2go.session.X2GoSession` instance.

    Returns: | returns `True` if the disconnect operation has been successful
    Return type: | `bool`

  `do_auto_connect`(redirect_to_client=True)

    Automatically connect this session.

    Parameters: | redirect_to_client (`True`) – Pass this request through to the `x2go.client.X2GoClient` instance, if given (Default value = True)
    Returns: | Return success (or failure) of connecting this sessions
    Return type: | `bool`

  `do_auto_start_or_resume`(newest=True, oldest=False, all_suspended=False, start=True, redirect_to_client=True)

    Automatically start or resume this session, if already associated with a server session. Otherwise resume a server-side available/suspended session (see options to declare which session to resume). If no session is available for resuming a new session will be launched.

    Sessions in published applications mode are not resumed/started by this method.

    Parameters:

    - newest (`bool`) – if resuming, only resume newest/youngest session (Default value = True)
    - oldest (`bool`) – if resuming, only resume oldest session (Default value = False)
    - all_suspended (`bool`) – if resuming, resume all suspended sessions (Default value = False)
    - start (`bool`) – is no session is to be resumed, start a new session (Default value = True)
    - redirect_to_client (`bool`) – redirect this call to the `x2go.client.X2GoClient` instance (if available) to allow frontend interaction (Default value = True)

    Returns: | returns success (or failure) of starting/resuming this sessions
    Return type: | `bool`

  `exec_published_application`(exec_name, timeout=20)

    Execute an application while in published application mode.

    Parameters:

    - exec_name (`str`) – command to execute on server
    - timeout (`int`) – time in secs to wait for server query to reply (Default value = 20)

  `get_client_instance`()

    Return parent `x2go.client.X2GoClient` instance if avaiable.

    Returns: | `x2go.client.X2GoClient` instance this session is associated with
    Return type: | `obj`

  `get_control_session`()

    Retrieve the control session (`X2GoControlSession*` backend) of this `x2go.session.X2GoSession`.

    Returns: | the `x2go.session.X2GoSession`’s control session
    Return type: | `X2GoControlSession*` instance

  `get_password`()

    After a session has been setup up you can query the username’s password from the session.

    Returns: | the username’s password
    Return type: | `str`

  `get_profile_id`()

    Retrieve the profile ID of this `x2go.session.X2GoSession` instance.

    Returns: | the session profile’s id
    Return type: | `str`

  `get_profile_name`()

    Retrieve the profile name of this `x2go.session.X2GoSession` instance.

    Returns: | X2Go client profile name of the session
    Return type: | `str`

  `get_progress_status`()

    Retrieve session startup/resumption progress status.

    Returns: | returns an `int` value between 0 and 100 reflecting the session startup/resumption status
    Return type: | `int`

  `get_published_applications`(lang=None, refresh=False, raw=False, very_raw=False, max_no_submenus=10)

    Return a list of published menu items from the X2Go server for session type published applications.

    Parameters:

    - lang (`str`) – locale/language identifier (Default value = None)
    - refresh (`bool`) – force reload of the menu tree from X2Go server (Default value = False)
    - raw (`bool`) – retrieve a raw output of the server list of published applications (Default value = False)
    - very_raw (`bool`) – retrieve a very raw output of the server list of published applications (as-is output of x2gogetapps script) (Default value = False)
    - max_no_submenus (`int`) – Number of applications before applications are put into XDG category submenus (Default value = defaults.PUBAPP_MAX_NO_SUBMENUS)

    Returns: | A `list` of `dict` elements. Each `dict` elements has a `desktop` key containing the text output of a .desktop file and an `icon` key which contains the desktop icon data base64 encoded
    Return type: | `list`

  `get_remote_home`()

    After a session has been set up you can query the remote user’s home directory path.

    Returns: | the remote home directory path
    Return type: | `str`

  `get_server_features`()

    Return a list of X2Go server-sides features (supported functionalities).

    Returns: | a `list` of X2Go feature names
    Return type: | `list`

  `get_server_hostname`()

    After a session has been setup up you can query the hostname of the host this session is connected to (or about to connect to).

    Returns: | the hostname of the server the X2Go session is connected to / about to connect to
    Return type: | `str`

  `get_server_peername`()

    After a session has been setup up you can query the peername of the host this session is connected to (or about to connect to).

    Returns: | the address of the server the X2Go session is connected to (as an `(addr,port)` tuple)
    Return type: | `tuple`

  `get_server_port`()

    After a session has been setup up you can query the IP socket port used for connecting the remote X2Go server.

    Returns: | the server-side IP socket port that is used by the X2Go session to connect to the server
    Return type: | `str`

  `get_session_cmd`()

    Retrieve the server-side command that is used to start a session on the remote X2Go server.

    Returns: | server-side session command
    Return type: | `str`

  `get_session_info`()

    Retrieve the server-side X2Go session info object for this session.

    Returns: | X2Go session info
    Return type: | `obj`

  `get_session_name`()

    Retrieve the server-side X2Go session name for this session.

    Returns: | X2Go session name
    Return type: | `str`

  `get_session_profile_option`(option)

    Retrieve a specific profile parameter for this session.

    Parameters: | option (`str`) – name of a specific profile option to be queried.
    Returns: | value for profile option `<option>`
    Return type: | `bool,str,int`
    Raises: | X2GoProfileException – if the session profile option is unknown

  `get_session_title`()

    Retrieve the session window title of this session.

    Returns: | session window title
    Return type: | `str`

  `get_session_type`()

    Retrieve the session type of a session (R, D, S or P).

    > - R: rootless session
    > - D: desktop session
    > - S: shadow session
    > - P: session in published applications mode

    Returns: | session type
    Return type: | `str`

  `get_shared_folders`(check_list_mounts=False, mounts=None)

    Get a list of local folders mounted within this X2Go session from this client.

    Parameters:

    - check_list_mounts (`bool`) – if set to `True` the list of shared folders is referenced against the latest status of the server-side mount list. (Default value = False)
    - mounts (`dict`) – a server-side dictionary of session name keys and lists of mounted shares (server-side mount points) (Default value = None)

    Returns: | returns a `list` of those local folder names that are mounted with this X2Go session.
    Return type: | `list`

  `get_terminal_session`()

    Retrieve the terminal session (`X2GoTerminalSession*` backend) of this `x2go.session.X2GoSession`.

    Returns: | the `x2go.session.X2GoSession`’s terminal session
    Return type: | `X2GoControlTerminal*` instance

  `get_username`()

    After a session has been set up you can query the username the session runs as.

    Returns: | the remote username the X2Go session runs as
    Return type: | `str`

  `get_uuid`()

    Retrieve session UUID hash for this `x2go.session.X2GoSession`.

    Returns: | the session’s UUID hash
    Return type: | `str`

  `has_control_session`()

    Check if this `x2go.session.X2GoSession` instance has an associated control session.

    Returns: | returns `True` if this `x2go.session.X2GoSession` has a control session associated to itself
    Return type: | `bool`

  `has_server_feature`(feature)

    Check if `feature` is a present feature of the connected X2Go server.

    Parameters: | feature (`str`) – an X2Go server feature as found in `$SHAREDIR/x2go/feature.d/*`
    Returns: | returns `True` if the feature is present
    Return type: | `bool`

  `has_terminal_session`()

    Check if this `x2go.session.X2GoSession` instance has an associated terminal session.

    Returns: | returns `True` if this `x2go.session.X2GoSession` has a terminal session associated to itself
    Return type: | `bool`

  `has_terminated`(update_status=False)

    Test if the `x2go.session.X2GoSession`’s terminal session has terminated.

    Parameters: | update_status (`bool`) – if `True`, the status is updated by a server call (Default value = False)
    Returns: | `True` if session has terminated, `False` otherwise
    Return type: | `bool`

  `init_control_session`()

    Initialize a new control session (`X2GoControlSession*`).

  `is_alive`()

    Find out if this X2Go session is still alive (that is: connected to the server).

    Returns: | returns `True` if the server connection is still alive
    Return type: | `bool`

  `is_associated`()

    Check if this `x2go.session.X2GoSession` instance has an associated terminal session.

    Returns: | returns `True` if this `x2go.session.X2GoSession` has a terminal session associated to itself
    Return type: | `bool`

  `is_color_depth_ok`()

    Check if this session will display properly with the local screen’s color depth.

    Returns: | `True` if the session will display on this client screen, `False` otherwise. If no terminal session is yet registered with this session, `None` is returned.
    Return type: | `bool`

  `is_connected`()

    Test if the `x2go.session.X2GoSession`’s control session is connected to the remote X2Go server.

    Returns: | `True` if session is connected, `False` otherwise
    Return type: | `bool`

  `is_desktop_session`()

    Test if this X2Go session is a desktop session.

    Returns: | `True` if this session is of session type desktop (‘D’ or ‘K’).
    Return type: | `bool`

  `is_folder_sharing_available`()

    Test if the remote session allows sharing of local folders with the session.

    Returns: | returns `True` if local folder sharing is available in the remote session
    Return type: | `bool`

  `is_locked`()

    Test if the session is lock at the moment. This normally occurs if there is some action running that will result in a session status change.

    Returns: | returns `True` if the session is locked
    Return type: | `bool`

  `is_master_session`()

    Is this session a/the master session of sessions.

    The master session is the session has been launched first for a specific connection, it also is _the_ session that controls the client-side shared folders.

    If this `x2go.session.X2GoSession` instance is a standalone instance (without parent `x2go.client.X2GoClient`) this method will always return `True`.

    Returns: | returns `True` if this session is a master session
    Return type: | `bool`

  `is_pubapp_session`()

    Test if this X2Go session is a published applications session.

    Returns: | `True` if this session is of session type published applications (‘P’).
    Return type: | `bool`

  `is_published_applications_provider`()

    Returns true if this session runs in published applications mode.

    Returns: | returns `True` if this session is a provider session for published applications.
    Return type: | `bool`

  `is_rootless_session`()

    Test if this X2Go session is a rootless session.

    Returns: | `True` if this session is of session type rootless (‘R’).
    Return type: | `bool`

  `is_running`(update_status=False)

    Test if the `x2go.session.X2GoSession`’s terminal session is up and running.

    Parameters: | update_status (`bool`) – if `True`, the status is updated by a server call (Default value = False)
    Returns: | `True` if session is running, `False` otherwise
    Return type: | `bool`

  `is_shadow_session`()

    Test if this X2Go session is a desktop sharing (aka shadow) session.

    Returns: | `True` if this session is of session type shadow (‘S’).
    Return type: | `bool`

  `is_suspended`(update_status=False)

    Test if the `x2go.session.X2GoSession`’s terminal session is in suspended state.

    Parameters: | update_status (`bool`) – if `True`, the status is updated by a server call (Default value = False)
    Returns: | `True` if session is suspended, `False` otherwise
    Return type: | `bool`

  `list_desktops`(raw=False)

    List X2Go desktops sessions available for desktop sharing on the remote X2Go server.

    Parameters: | raw (`bool`) – if `True` the output of this method equals the output of the server-side `x2golistdesktops` command (Default value = False)
    Returns: | a list of strings representing available desktop sessions
    Return type: | `list`

  `list_mounts`(raw=False)

    Use the X2Go session registered under `session_uuid` to retrieve its list of mounted client shares for that session.

    Parameters: | raw (`bool`) – output the list of mounted client shares in X2Go’s raw `x2golistmounts` format (Default value = False)
    Returns: | a list of strings representing mounted client shares for this session
    Return type: | `list`

  `list_sessions`(raw=False)

    List all sessions on the remote X2Go server that are owned by the authenticated user

    Parameters: | raw (`bool`) – if `True` the output of this method equals the output of the server-side `x2golistsessions` command (Default value = False)
    Returns: | a session list (as data object or list of strings when called with `raw=True` option)
    Return type: | `X2GoServerSessionList*` instance or `list`

  `raise_session_window`()

    Try to lift the session window above all other windows and bring it to focus.

  `remote_peername`()

    After a session has been setup up you can query the peername of the host this session is connected to (or about to connect to).

    Returns: | the address of the server the X2Go session is connected to (as an `(addr,port)` tuple)
    Return type: | `tuple`

  `reset_progress_status`()

    Reset session startup/resumption progress status.

  `resume`(session_name=None, session_list=None, cmd=None, progress_event=None)

    Resume or continue a suspended / running X2Go session on the remote X2Go server.

    Parameters:

    - session_name (`str`) – the server-side name of an X2Go session (Default value = None)
    - session_list (`dict`) – a session list to avoid a server-side session list query (Default value = None)
    - cmd (`str`) – if starting a new session, manually hand over the command to be launched in the new session (Default value = None)
    - progress_event (`obj`) – a `thread.Event` object that notifies a status object like the one in `x2go.utils.ProgressStatus`. (Default value = None)

    Returns: | returns `True` if resuming the session has been successful, `False` otherwise
    Return type: | `bool`
    Raises: | Exception – any exception that occurs during published application menu retrieval is passed through

  `retrieve_server_features`()

    Query the X2Go server for a list of supported features.

  `reuses_sshproxy_authinfo`()

    Check if a session is configured to re-use the X2Go session’s password / key for proxy authentication, as well.

    Returns: | returns `True` if the session is configured to re-use session password / key for proxy authentication
    Return type: | `bool`

  `session_cleanup`()

    Clean up X2Go session.

  `session_ok`()

    Test if this `X2GoSession` is in a healthy state.

    Returns: | `True` if session is ok, `False` otherwise
    Return type: | `bool`

  `set_master_session`(wait=0, max_wait=20)

    Declare this as a master session of a connection channel.

    This method gets called by the `x2go.registry.X2GoSessionRegistry` while sessions are starting or resuming and it relies on an already set-up terminal session.

    Parameters:

    - wait (`int`) – wait for <wait> seconds before sharing local folders via the new master session of the corresponding session profile. (Default value = 0)
    - max_wait (`int`) – wait for <max_wait> seconds for the terminal session to appear (Default value = 20)

  `set_port`(port)

    Modify server port after `x2go.session.X2GoSession` has already been initialized.

    Parameters: | port (`int`) – socket port of server to connect to

  `set_print_action`(print_action, **kwargs)

    If X2Go client-side printing is enable within this X2Go session you can use this method to alter the way how incoming print spool jobs are handled/processed.

    For further information, please refer to the documentation of the `X2GoClient.set_session_print_action()` method.

    Parameters:

    - print_action (`str` or `instance`) – one of the named above print actions, either as string or class instance
    - kwargs (`dict`) – additional information for the given print action (print action arguments), for possible print action arguments and their values see each individual print action class

  `set_profile_name`(profile_name)

    Modify session profile name after `x2go.session.X2GoSession` has already been initialized.

    Parameters: | profile_name (`str`) – new session profile name

  `set_server`(server)

    Modify server name after `x2go.session.X2GoSession` has already been initialized.

    Parameters: | server (`str`) – new server name

  `set_session_name`(session_name)

    Manipulate the `x2go.session.X2GoSession`’s session name.

    Parameters: | session_name (`str`) – the new session name to be set

  `set_session_window_title`(title='')

    Modify session window title. If the session ID does not occur in the given title, it will be prepended, so that every X2Go session window always contains the X2Go session ID of that window.

    Parameters: | title (`str`) – new title for session window (Default value = ‘’)

  `share_all_local_folders`(update_exported_folders=True)

    Share all local folders configured to be mounted within this X2Go session.

    Parameters: | update_exported_folders (`bool`) – do an update of the session profile option ,,export’’ after the operation (Default value = True)
    Returns: | returns `True` if all local folders could be successfully mounted inside this X2Go session
    Return type: | `bool`

  `share_desktop`(desktop=None, user=None, display=None, share_mode=0, check_desktop_list=True, progress_event=None)

    Share an already running X2Go session on the remote X2Go server locally. The shared session may be either owned by the same user or by a user that grants access to his/her desktop session by the local user.

    Parameters:

    - desktop (`str`) – desktop ID of a sharable desktop in format <user>@<display> (Default value = None)
    - user (`str`) – user name and display number can be given separately, here give the name of the user who wants to share a session with you. (Default value = None)
    - display (`str`) – user name and display number can be given separately, here give the number of the display that a user allows you to be shared with. (Default value = None)
    - share_mode (`int`) – desktop sharing mode, 0 is VIEW-ONLY, 1 is FULL-ACCESS. (Default value = 0)
    - check_desktop_list (`bool`) – check if the given desktop is available on the X2Go server; handle with care as the server-side `x2golistdesktops` command might block client I/O. (Default value = True)
    - progress_event (`obj`) – a `thread.Event` object that notifies a status object like the one in `x2go.utils.ProgressStatus`. (Default value = None)

    Returns: | returns `True` if starting the session has been successful, `False` otherwise
    Return type: | `bool`

    Raises:

    - X2GoDesktopSharingException – if a given desktop ID does not specify an available desktop session
    - X2GoSessionException – if the available desktop session appears to be dead, in fact

  `share_local_folder`(local_path=None, folder_name=None, update_exported_folders=True)

    Share a local folder with this registered X2Go session.

    Parameters:

    - local_path (`str`) – the full path to an existing folder on the local file system (Default value = None)
    - folder_name (`str`) – synonymous to `local_path` (Default value = None)
    - update_exported_folders (`bool`) – do an update of the session profile option ,,export’’ after the operation (Default value = True)

    Returns: | returns `True` if the local folder has been successfully mounted within this X2Go session
    Return type: | `bool`
    Raises: | X2GoSessionException – if this `x2go.session.X2GoSession` does not have an associated terminal session

  `start`(cmd=None, progress_event=None)

    Start a new X2Go session on the remote X2Go server.

    Parameters:

    - cmd (`str`) – manually hand over the command that is to be launched in the new session (Default value = None)
    - progress_event (`obj`) – a `thread.Event` object that notifies a status object like the one in `x2go.utils.ProgressStatus`. (Default value = None)

    Returns: | returns `True` if starting the session has been successful, `False` otherwise
    Return type: | `bool`

  `suspend`()

    Suspend this X2Go session.

    Returns: | returns `True` if suspending the session has been successful, `False` otherwise
    Return type: | `bool`
    Raises: | X2GoSessionException – if the session could not be suspended

  `terminate`()

    Terminate this X2Go session.

    Returns: | returns `True` if terminating the session has been successful, `False` otherwise
    Return type: | `bool`
    Raises: | X2GoSessionException – if the session could not be terminated

  `unset_master_session`()

    Declare this as a non-master session of a connection channel.

  `unshare_all_local_folders`(force_all=False, update_exported_folders=True)

    Unshare all local folders mounted within this X2Go session.

    Parameters:

    - force_all (`bool`) – Really unmount _all_ shared folders, including the print spool folder and the MIME box spool dir (not recommended). (Default value = False)
    - update_exported_folders (`bool`) – do an update of the session profile option ,,export’’ after the operation (Default value = True)

    Returns: | returns `True` if all local folders could be successfully unmounted inside this X2Go session
    Return type: | `bool`
    Raises: | X2GoSessionException – if this `x2go.session.X2GoSession` does not have an associated terminal session

  `unshare_local_folder`(local_path=None, update_exported_folders=True)

    Unshare a local folder that is mounted within this X2Go session.

    Parameters:

    - local_path (`str`) – the full path to an existing folder on the local file system that is mounted in this X2Go session and shall be unmounted (Default value = None)
    - update_exported_folders (`bool`) – do an update of the session profile option ,,export’’ after the operation (Default value = True)

    Returns: | returns `True` if all local folders could be successfully unmounted inside this X2Go session
    Return type: | `bool`
    Raises: | X2GoSessionException – if this `x2go.session.X2GoSession` does not have an associated terminal session

  `update_params`(params)

    This method can be used to modify `x2go.session.X2GoSession` parameters after the `x2go.session.X2GoSession` instance has already been initialized.

    Parameters: | params (`dict`) – a Python dictionary with `x2go.session.X2GoSession` parameters

  `update_status`(session_list=None, force_update=False)

    Update the current session status. The `x2go.session.X2GoSession` instance uses an internal session status cache that allows to query the session status without the need of retrieving data from the remote X2Go server for each query.

    The session status (if initialized properly with the `x2go.client.X2GoClient` constructor gets updated in regularly intervals.

    In case you use the `x2go.session.X2GoSession` class in standalone instances (that is: without being embedded into an `x2go.session.X2GoSession` context) then run this method in regular intervals to make sure the `x2go.session.X2GoSession`’s internal status cache information is always up-to-date.

    Parameters:

    - session_list (`X2GoServerSessionList*` instance) – provide an `X2GoServerSessionList*` that refers to X2Go sessions we want to update. This option is mainly for reducing server/client traffic. (Default value = None)
    - force_update (`bool`) – force a session status update, if if the last update is less then 1 second ago (Default value = False)

    Raises: | Exception – any exception is passed through in case the session disconnected surprisingly or has been marked as faulty

  `user_is_x2gouser`(username=None)

    Check if a given user is valid server-side X2Go user.

    Parameters: | username (`str`) – username to check validity for (Default value = None)
    Returns: | `True` if the username is allowed to launch X2Go sessions
    Return type: | `bool`

  `uses_sshproxy`()

    Check if a session is configured to use an intermediate SSH proxy server.

    Returns: | returns `True` if the session is configured to use an SSH proxy, `False` otherwise.
    Return type: | `bool`