Package x2go :: Module client :: Class X2GoClient
[frames] | no frames]

type X2GoClient

source code

object --+
         |
        X2GoClient

The X2GoClient implements _THE_ public Python X2Go API. With it you can construct your own X2Go client application in Python.

Most methods in this class require that you have registered a session with a remote X2Go server (passing of session options, initialization of the session object etc.) and connected to it (authentication). For these two steps use these methods: X2GoClient.register_session() and X2GoClient.connect_session().

Instance Methods
 
__init__(self, control_backend='PLAIN', terminal_backend='PLAIN', info_backend='PLAIN', list_backend='PLAIN', proxy_backend='NX3', profiles_backend='FILE', settings_backend='FILE', printing_backend='FILE', broker_url=None, broker_password=None, broker_noauth=False, client_rootdir=None, sessions_rootdir=None, ssh_rootdir=None, start_xserver=False, start_pulseaudio=False, use_cache=False, use_listsessions_cache=False, auto_update_listsessions_cache=False, auto_update_listdesktops_cache=False, auto_update_listmounts_cache=False, auto_update_sessionregistry=False, auto_register_sessions=False, no_auto_reg_pubapp_sessions=False, refresh_interval=5, pulseaudio_installdir='/builddir/build/BUILD/python-x2go-0.5.0.4/pulseaudio', logger=None, loglevel=56) source code
 
HOOK_profile_auto_connect(self, profile_name='UNKNOWN')
HOOK method: called if a session demands to auto connect the session profile.
source code
 
HOOK_broker_connection_exception(self, profile_name='UNKNOWN')
HOOK method: called if a session demands to auto connect the session profile.
source code
bool
HOOK_broker_ignore_connection_problems(self, profile_name='UNKNOWN', is_profile_connected=False)
HOOK method: called after a broker connection failed for a certain profile.
source code
 
HOOK_session_startup_failed(self, profile_name='UNKNOWN')
HOOK method: called if the startup of a session failed.
source code
 
HOOK_desktop_sharing_denied(self, profile_name='UNKNOWN')
HOOK method: called if the startup of a shadow session was denied by the other user.
source code
 
HOOK_list_desktops_timeout(self, profile_name='UNKNOWN')
HOOK method: called if the x2golistdesktops command generates a timeout due to long execution time.
source code
 
HOOK_no_such_desktop(self, profile_name='UNKNOWN', desktop='UNKNOWN')
HOOK method: called if it is tried to connect to a (seen before) sharable desktop that's not available (anymore).
source code
 
HOOK_no_known_xserver_found(self) source code
 
HOOK_no_installed_xservers_found(self)
HOOK method: called if the Python X2Go module could not find any usable XServer application to start.
source code
 
HOOK_open_print_dialog(self, profile_name='UNKNOWN', session_name='UNKNOWN')
HOOK method: called if an incoming print job has been detected by X2GoPrintQueue and a print dialog box is requested.
source code
 
HOOK_no_such_command(self, cmd, profile_name='UNKNOWN', session_name='UNKNOWN')
HOOK: the command <cmd> is not available on the connected X2Go server.
source code
 
HOOK_open_mimebox_saveas_dialog(self, filename, profile_name='UNKNOWN', session_name='UNKNOWN')
HOOK method: called on detection of an incoming MIME box job ,,<filename>''.
source code
 
HOOK_printaction_error(self, filename, profile_name='UNKNOWN', session_name='UNKNOWN', err_msg='GENERIC_ERROR', printer=None)
HOOK method: called if an incoming print job caused an error.
source code
bool
HOOK_check_host_dialog(self, profile_name='UNKNOWN', host='UNKNOWN', port=22, fingerprint='no fingerprint', fingerprint_type='UNKNOWN')
HOOK method: called if a host check is requested.
source code
 
HOOK_on_control_session_death(self, profile_name)
HOOK method: called if a control session (server connection) has unexpectedly encountered a failure.
source code
 
HOOK_on_failing_SFTP_client(self, profile_name, session_name)
HOOK method: called SFTP client support is unavailable for the session.
source code
 
HOOK_pulseaudio_not_supported_in_RDPsession(self)
HOOK method: called if trying to run the Pulseaudio daemon within an RDP session, which is not supported by Pulseaudio.
source code
 
HOOK_pulseaudio_server_startup_failed(self)
HOOK method: called if the Pulseaudio daemon startup failed.
source code
 
HOOK_pulseaudio_server_died(self)
HOOK method: called if the Pulseaudio daemon has died away unexpectedly.
source code
 
HOOK_on_sound_tunnel_failed(self, profile_name='UNKNOWN', session_name='UNKNOWN')
HOOK method: called if a sound tunnel setup failed.
source code
 
HOOK_rforward_request_denied(self, profile_name='UNKNOWN', session_name='UNKNOWN', server_port=0)
HOOK method: called if a reverse port forwarding request has been denied.
source code
 
HOOK_forwarding_tunnel_setup_failed(self, profile_name='UNKNOWN', session_name='UNKNOWN', chain_host='UNKNOWN', chain_port=0, subsystem=None)
HOOK method: called if a port forwarding tunnel setup failed.
source code
 
HOOK_on_session_has_started_by_me(self, session_uuid='UNKNOWN', profile_name='UNKNOWN', session_name='UNKNOWN')
HOOK method: called if a session has been started by this instance of X2GoClient.
source code
 
HOOK_on_session_has_started_by_other(self, session_uuid='UNKNOWN', profile_name='UNKNOWN', session_name='UNKNOWN')
HOOK method: called if a session has been started by another x2goclient.
source code
 
HOOK_on_session_has_resumed_by_me(self, session_uuid='UNKNOWN', profile_name='UNKNOWN', session_name='UNKNOWN')
HOOK method: called if a session has been resumed by this instance of X2GoClient.
source code
 
HOOK_on_session_has_resumed_by_other(self, session_uuid='UNKNOWN', profile_name='UNKNOWN', session_name='UNKNOWN')
HOOK method: called if a session has been resumed by another x2goclient.
source code
 
HOOK_on_found_session_running_after_connect(self, session_uuid='UNKNOWN', profile_name='UNKNOWN', session_name='UNKNOWN')
HOOK method: called after server connect if an already running session has been found.
source code
 
HOOK_on_session_has_been_suspended(self, session_uuid='UNKNOWN', profile_name='UNKNOWN', session_name='UNKNOWN')
HOOK method: called if a session has been suspended by this instance of X2GoClient.
source code
 
HOOK_on_session_has_terminated(self, session_uuid='UNKNOWN', profile_name='UNKNOWN', session_name='UNKNOWN')
HOOK method: called if a session has been suspended by another x2goclient.
source code
 
HOOK_printing_not_available(self, profile_name='UNKNOWN', session_name='UNKNOWN')
HOOK method: called if X2Go client-side printing is not available.
source code
 
HOOK_mimebox_not_available(self, profile_name='UNKNOWN', session_name='UNKNOWN')
HOOK method: called if the X2Go MIME box is not available.
source code
 
HOOK_foldersharing_not_available(self, profile_name='UNKNOWN', session_name='UNKNOWN')
HOOK method: called if X2Go client-side folder-sharing is not available.
source code
 
HOOK_sshfs_not_available(self, profile_name='UNKNOWN', session_name='UNKNOWN')
HOOK method: called if the X2Go server denies SSHFS access.
source code
str
get_client_rootdir(self)
Retrieve the settings root directory of this X2GoClient instance.
source code
str
get_sessions_rootdir(self)
Retrieve the sessions root directory of this X2GoClient instance.
source code
str
get_ssh_rootdir(self)
Retrieve the SSH client root dir used with this X2GoClient instance.
source code
str
get_client_username(self)
Query the local user's username (i.e.
source code
list
register_all_session_profiles(self, return_objects=False)
Register all session profiles found in the sessions configuration node as potential X2Go sessions.
source code
str
register_session(self, server=None, profile_id=None, profile_name=None, session_name=None, allow_printing=False, allow_share_local_folders=False, share_local_folders=[], allow_mimebox=False, mimebox_extensions=[], mimebox_action='OPEN', add_to_known_hosts=False, known_hosts=None, forward_sshagent=False, proxy_options={}, return_object=False, **kwargs)
Register a new X2GoSession.
source code
 
get_session_summary(self, session_uuid)
Retrieves a Python dictionary, containing a short session summary (session status, names, etc.)
source code
str
get_session_username(self, session_uuid)
After an X2GoSession has been set up you can query the username that the remote sessions runs as.
source code
tuple
get_session_server_peername(self, session_uuid)
After a session has been set up you can query the hostname of the host the session is connected to (or about to connect to).
source code
str
get_session_server_hostname(self, session_uuid)
Retrieve the server hostname as provided by the calling application (e.g.
source code
obj
get_session(self, session_uuid)
Retrieve the complete X2GoSession object that has been registered under the given session registry hash.
source code
obj
with_session(self, session_uuid)
Alias for get_session().
source code
str or X2GoSession instance
get_session_of_session_name(self, session_name, return_object=False, match_profile_name=None)
Retrieve session UUID or X2GoSession for session name <session_name> from the session registry.
source code
str
get_session_name(self, session_uuid)
Retrieve the server-side X2Go session name for the session that has been registered under session_uuid.
source code
obj
get_session_info(self, session_uuid)
Retrieve the server-side X2Go session information object for the session that has been registered under session_uuid.
source code
dict
get_published_applications(self, session_uuid=None, profile_name=None, lang=None, refresh=False, raw=False, very_raw=False, max_no_submenus=10)
Retrieve the server-side X2Go published applications menu for the session registered under session_uuid or for profile name profile_name.
source code
dict
profile_get_published_applications(self, session_uuid=None, profile_name=None, lang=None, refresh=False, raw=False, very_raw=False, max_no_submenus=10)
Retrieve the server-side X2Go published applications menu for the session registered under session_uuid or for profile name profile_name.
source code
bool
set_session_username(self, session_uuid, username)
Set the session username for the X2GoSession that has been registered under session_uuid.
source code
bool
check_session_host(self, session_uuid)
Provide a mechanism to evaluate the validity of an X2Go server host.
source code
bool
session_reuses_sshproxy_authinfo(self, session_uuid)
Check if session with unique identifier <session_uuid> is configured to re-use the X2Go session's password / key for proxy authentication, as well.
source code
bool
session_uses_sshproxy(self, session_uuid)
Check if session with unique identifier <session_uuid> is configured to use an intermediate SSH proxy server.
source code
bool
session_can_sshproxy_auto_connect(self, session_uuid)
Check if the SSH proxy of session with unique identifier <session_uuid> is configured adequately to be able to auto-connect to the SSH proxy server (e.g.
source code
bool
session_can_auto_connect(self, session_uuid)
Check if session with unique identifier <session_uuid> is configured adequately to be able to auto-connect to the X2Go server (e.g.
source code
bool
session_auto_connect(self, session_uuid)
Auto-connect a given session.
source code
bool
connect_session(self, session_uuid, username=None, password=None, passphrase=None, sshproxy_user=None, sshproxy_password=None, sshproxy_passphrase=None, add_to_known_hosts=False, force_password_auth=False, sshproxy_force_password_auth=False)
Connect to a registered X2Go session with registry hash session_uuid This method basically wraps around paramiko.SSHClient.connect() for the corresponding session.
source code
 
disconnect_session(self, session_uuid)
Disconnect an X2GoSession by closing down its Paramiko/SSH Transport thread.
source code
 
set_session_print_action(self, session_uuid, print_action, **kwargs)
If X2Go client-side printing is enable within an X2Go session you can use this method to alter the way how incoming print spool jobs are handled/processed.
source code
 
set_session_window_title(self, session_uuid, title='')
Modify session window title.
source code
 
raise_session_window(self, session_uuid)
Try to lift the session window above all other windows and bring it to focus.
source code
 
session_auto_start_or_resume(self, session_uuid, newest=True, oldest=False, all_suspended=False, start=True)
Automatically start or resume one or several sessions.
source code
bool
start_session(self, session_uuid, **sessionopts)
Start a new X2Go session on the remote X2Go server.
source code
bool
share_desktop_session(self, session_uuid, desktop=None, user=None, display=None, share_mode=0, check_desktop_list=False, **sessionopts)
Share another already running desktop session.
source code
bool
resume_session(self, session_uuid=None, session_name=None, match_profile_name=None, **sessionopts)
Resume or continue a suspended / running X2Go session on a remote X2Go server (as specified when register_session was called).
source code
bool
suspend_session(self, session_uuid, session_name=None, match_profile_name=None, **sessionopts)
Suspend an X2Go session.
source code
bool
terminate_session(self, session_uuid, session_name=None, match_profile_name=None, **sessionopts)
Terminate an X2Go session.
source code
str
get_session_profile_name(self, session_uuid)
Retrieve the profile name of the session that has been registered under session_uuid.
source code
str
get_session_profile_id(self, session_uuid)
Retrieve the profile id of the session that has been registered under session_uuid.
source code
bool
session_ok(self, session_uuid)
Test if the X2Go session registered as session_uuid is in a healthy state.
source code
bool
is_session_connected(self, session_uuid)
Test if the X2Go session registered as session_uuid connected to the X2Go server.
source code
bool
is_profile_connected(self, profile_name)
Test if the X2Go given session profile has open connections to the X2Go server.
source code
bool
is_session_profile(self, profile_id_or_name)
Test if the X2Go given session profile is configured in the client's sessions file.
source code
bool
is_session_running(self, session_uuid, session_name=None)
Test if the X2Go session registered as session_uuid is up and running.
source code
bool
is_session_suspended(self, session_uuid, session_name=None)
Test if the X2Go session registered as session_uuid is in suspended state.
source code
bool
has_session_terminated(self, session_uuid, session_name=None)
Test if the X2Go session registered as session_uuid has terminated.
source code
bool
is_folder_sharing_available(self, session_uuid=None, profile_name=None)
Test if local folder sharing is available for X2Go session with unique ID <session_uuid> or session profile <profile_name>.
source code
bool
share_local_folder(self, session_uuid=None, local_path=None, profile_name=None, folder_name=None)
Share a local folder with the X2Go session registered as session_uuid.
source code
bool
unshare_all_local_folders(self, session_uuid=None, profile_name=None)
Unshare all local folders mounted in X2Go session registered as session_uuid.
source code
bool
unshare_all_local_folders_from_session(self, session_uuid=None, profile_name=None)
Unshare all local folders mounted in X2Go session registered as session_uuid.
source code
bool
unshare_all_local_folders_from_profile(self, session_uuid=None, profile_name=None)
Unshare all local folders mounted in X2Go session registered as session_uuid.
source code
bool
unshare_local_folder(self, session_uuid=None, profile_name=None, local_path=None)
Unshare local folder that is mounted in the X2Go session registered as session_uuid.
source code
bool
unshare_local_folder_from_session(self, session_uuid=None, profile_name=None, local_path=None)
Unshare local folder that is mounted in the X2Go session registered as session_uuid.
source code
bool
unshare_local_folder_from_profile(self, session_uuid=None, profile_name=None, local_path=None)
Unshare local folder that is mounted in the X2Go session registered as session_uuid.
source code
list
get_shared_folders(self, session_uuid=None, profile_name=None, check_list_mounts=False)
Get a list of local folders mounted within X2Go session with session hash <session_uuid> from this client.
source code
list
session_get_shared_folders(self, session_uuid=None, profile_name=None, check_list_mounts=False)
Get a list of local folders mounted within X2Go session with session hash <session_uuid> from this client.
source code
list
profile_get_shared_folders(self, session_uuid=None, profile_name=None, check_list_mounts=False)
Get a list of local folders mounted within X2Go session with session hash <session_uuid> from this client.
source code
list
get_master_session(self, profile_name, return_object=True, return_session_name=False)
Retrieve the master session of a specific profile.
source code
list
profile_master_session(self, profile_name, return_object=True, return_session_name=False)
Retrieve the master session of a specific profile.
source code
list
client_connected_sessions(self, return_objects=False, return_profile_names=False, return_profile_ids=False, return_session_names=False)
Retrieve a list of X2Go sessions that this X2GoClient instance is connected to.
source code
list
client_associated_sessions(self, return_objects=False, return_profile_names=False, return_profile_ids=False, return_session_names=False)
Retrieve a list of X2Go sessions associated to this X2GoClient instance.
source code
list
client_running_sessions(self, return_objects=False, return_profile_names=False, return_profile_ids=False, return_session_names=False)
Retrieve a list of running X2Go sessions.
source code
list
client_suspended_sessions(self, return_objects=False, return_profile_names=False, return_profile_ids=False, return_session_names=False)
Retrieve a list of suspended X2Go sessions.
source code
list
client_registered_sessions(self, return_objects=True, return_profile_names=False, return_profile_ids=False, return_session_names=False)
Retrieve a list of registered X2Go sessions.
source code
X2GoControlSession instance
client_control_session_of_profile_name(self, profile_name)
Retrieve control session for profile name <profile_name>.
source code
dict or str
get_server_versions(self, profile_name, component=None, force=False)
Query the server configured in session profile <profile_name> for the list of install X2Go components and its versions.
source code
dict or str
get_server_components(self, profile_name, component=None, force=False)
Query the server configured in session profile <profile_name> for the list of install X2Go components and its versions.
source code
list
get_server_features(self, profile_name, force=False)
Query the server configured in session profile <profile_name> for the list of server-side X2Go features.
source code
bool
has_server_feature(self, profile_name, feature)
Query the server configured in session profile <profile_name> for the availability of a certain server feature.
source code
X2GoSession or str
client_registered_session_of_name(self, session_name, return_object=False)
Retrieve X2Go session of a given session name.
source code
bool
client_has_registered_session_of_name(self, session_name)
Equals True if there is a registered session of name <session_name>.
source code
list
client_registered_sessions_of_profile_name(self, profile_name, return_objects=False, return_session_names=False)
Retrieve registered X2Go sessions of profile name <profile_name>.
source code
list
client_connected_sessions_of_profile_name(self, profile_name, return_objects=False, return_session_names=False)
Retrieve connected X2Go sessions of profile name <profile_name>.
source code
list
client_associated_sessions_of_profile_name(self, profile_name, return_objects=False, return_session_names=False)
Retrieve associated X2Go sessions of profile name <profile_name>.
source code
list
client_pubapp_sessions_of_profile_name(self, profile_name, return_objects=False, return_session_names=False)
Retrieve X2Go sessions of profile name <profile_name> that provide published applications.
source code
list
client_running_sessions_of_profile_name(self, profile_name, return_objects=False, return_session_names=False)
Retrieve running X2Go sessions of profile name <profile_name>.
source code
list
client_suspended_sessions_of_profile_name(self, profile_name, return_objects=False, return_session_names=False)
Retrieve suspended X2Go sessions of profile name <profile_name>.
source code
bool
server_is_alive(self, session_uuid)
Test if server that corresponds to the terminal session session_uuid is alive.
source code
bool
all_servers_are_alive(self)
Test vitality of all connected X2Go servers.
source code
str
server_valid_x2gouser(self, session_uuid, username=None)
Check if user is allowed to start an X2Go session on a remote server.
source code
list
server_running_sessions(self, session_uuid)
Retrieve a list of session names of all server-side running sessions (including those not instantiated by our X2GoClient instance).
source code
bool
server_has_running_sessions(self, session_uuid)
Equals True if the X2Go server has any running sessions.
source code
 
server_has_running_session_of_name(self, session_uuid, session_name)
Equals True if the X2Go server has a running session of name <session_name>.
source code
list
server_suspended_sessions(self, session_uuid)
Retrieve a list of session names of all server-side suspended sessions (including those not instantiated by our X2GoClient instance).
source code
 
server_has_suspended_sessions(self, session_uuid)
Equals True if the X2Go server has any suspended sessions.
source code
bool
server_has_suspended_session_of_name(self, session_uuid, session_name)
Equals True if the X2Go server has a suspended session of name <session_name>.
source code
 
clean_sessions(self, session_uuid, published_applications=False)
Find running X2Go sessions that have previously been started by the connected user on the remote X2Go server and terminate them.
source code
 
list_sessions(self, session_uuid=None, profile_name=None, profile_id=None, no_cache=False, refresh_cache=False, update_sessionregistry=True, register_sessions=False, raw=False)
Use the X2Go session registered under session_uuid to retrieve a list of running or suspended X2Go sessions from the connected X2Go server (for the authenticated user).
source code
list
list_desktops(self, session_uuid=None, profile_name=None, profile_id=None, no_cache=False, refresh_cache=False, exclude_session_types=[], raw=False)
Use the X2Go session registered under session_uuid to retrieve a list of X2Go desktop sessions that are available for desktop sharing.
source code
list
list_mounts_by_profile_name(self, profile_name, no_cache=False, refresh_cache=False, raw=False)
For a given profil profile_name to retrieve its list of mounted client shares for that session.
source code
list
list_mounts(self, session_uuid, no_cache=False, refresh_cache=False, raw=False)
Use the X2Go session registered under session_uuid to retrieve its list of mounted client shares for that session.
source code
 
get_profiles(self)
Returns the X2GoClient instance's X2GoSessionProfiles* object.
source code
 
get_session_profiles(self)
Alias for get_profiles().
source code
 
get_client_settings(self)
Returns the X2GoClient instance's X2GoClientSettings* object.
source code
 
get_client_printing(self)
Returns the X2GoClient instance's X2GoClientPrinting* object.
source code
dict or bool, int, str
get_profile_config(self, profile_id_or_name, parameter=None)
Returns a dictionary with session options and values that represent the session profile for profile_id_or_name.
source code
dict or bool, int, str
with_profile_config(self, profile_id_or_name, parameter=None)
Returns a dictionary with session options and values that represent the session profile for profile_id_or_name.
source code
dict
set_profile_config(self, profile_id_or_name, parameter, value)
Set individual session profile parameters for session profile profile_id_or_name.
source code
str
to_profile_id(self, profile_name)
Retrieve the session profile ID of the session whose profile name is profile_name
source code
str
to_profile_name(self, profile_id)
Retrieve the session profile name of the session whose profile ID is profile_id
source code
str
get_profile_metatype(self, profile_name)
Evaluate a session profile and return a human readable meta type (classification) for the session profile profile_name.
source code
list
client_connected_profiles(self, return_profile_names=False)
Retrieve a list of session profiles that are currently connected to an X2Go server.
source code
bool
disconnect_profile(self, profile_name)
Disconnect all X2GoSession instances that relate to profile_name by closing down their Paramiko/SSH Transport thread.
source code
 
update_sessionregistry_status_by_profile_name(self, profile_name, session_list=None)
Update the session registry stati by profile name.
source code
 
update_sessionregistry_status_by_session_uuid(self, session_uuid)
Update the session registry status of a specific X2GoSession instance with session identifier <session_uuid>.
source code
 
update_sessionregistry_status_all_profiles(self)
Update the session registry stati of all session profiles.
source code
 
update_cache_by_profile_name(self, profile_name, cache_types='sessions', update_sessions=None, update_desktops=None, update_mounts=None)
Update the session list cache by profile name.
source code
 
update_cache_by_session_uuid(self, session_uuid, cache_types='sessions', update_sessions=None, update_desktops=None, update_mounts=None)
Update the session list cache of a specific X2GoSession instance with session identifier <session_uuid>.
source code
 
update_cache_all_profiles(self, cache_types='sessions', update_sessions=None, update_desktops=None, update_mounts=None)
Update the session list cache of all session profiles.
source code
 
register_available_server_sessions_by_profile_name(self, profile_name, re_register=False, skip_pubapp_sessions=False)
Register available sessions that are found on the X2Go server the profile of name profile_name is connected to.
source code
 
register_available_server_sessions_by_session_uuid(self, session_uuid, skip_pubapp_sessions=False)
Register available sessions that are found on the X2Go server that the X2GoSession instance with session identifier <session_uuid> is connected to.
source code
 
register_available_server_sessions_all_profiles(self, skip_pubapp_sessions=False)
Register all available sessions found on an X2Go server for each session profile.
source code
Class Variables
  lang = 'en'
Properties
  has_custom_client_rootdir
Does this X2GoClient instance have a customized root dir path? Equals True in case it has.
  client_has_connected_sessions
Equals True if there are any connected sessions with this X2GoClient instance.
  client_has_associated_sessions
Equals True if there are any associated sessions with this X2GoClient instance.
  client_has_running_sessions
Equals True if there are any running sessions with this X2GoClient instance.
  client_has_suspended_sessions
Equals True if there are any suspended sessions with this X2GoClient instance.
  client_control_sessions
Equals a list of all registered X2Go control sessions.
  profile_names
Equals a list of all profile names that are known to this X2GoClient instance.
Method Details

__init__(self, control_backend='PLAIN', terminal_backend='PLAIN', info_backend='PLAIN', list_backend='PLAIN', proxy_backend='NX3', profiles_backend='FILE', settings_backend='FILE', printing_backend='FILE', broker_url=None, broker_password=None, broker_noauth=False, client_rootdir=None, sessions_rootdir=None, ssh_rootdir=None, start_xserver=False, start_pulseaudio=False, use_cache=False, use_listsessions_cache=False, auto_update_listsessions_cache=False, auto_update_listdesktops_cache=False, auto_update_listmounts_cache=False, auto_update_sessionregistry=False, auto_register_sessions=False, no_auto_reg_pubapp_sessions=False, refresh_interval=5, pulseaudio_installdir='/builddir/build/BUILD/python-x2go-0.5.0.4/pulseaudio', logger=None, loglevel=56)
(Constructor)

source code 
Parameters:
  • control_backend (str) - X2Go control session backend to use
  • terminal_backend (str) - X2Go terminal session backend to use
  • info_backend (str) - X2Go session info backend to use
  • list_backend (str) - X2Go session list backend to use
  • proxy_backend (str) - X2Go proxy backend to use
  • profiles_backend (str) - X2Go session profiles backend to use
  • settings_backend (str) - X2Go client settings backend to use
  • printing_backend (str) - X2Go client printing backend to use
  • broker_url (str) - URL pointing to the X2Go Session Broker
  • broker_password (str) - use this password for authentication against the X2Go Session Broker
  • broker_noauth (bool) - accessing the X2Go Session Broker works without credentials
  • client_rootdir (str) - client base dir (default: ~/.x2goclient)
  • sessions_rootdir (str) - sessions base dir (default: ~/.x2go)
  • ssh_rootdir (str) - ssh base dir (default: ~/.ssh)
  • start_xserver (bool) - start XServer when registering an X2GoClient instance
  • start_pulseaudio (bool) - start Pulseaudio daemon when registering an X2GoClient instance
  • use_cache (bool) - alias for use_listsessions_cache
  • use_listsessions_cache (bool) - activate the X2Go session list cache in (X2GoListSessionsCache)
  • auto_update_listsessions_cache (bool) - activate automatic updates of the X2Go session list cache (X2GoListSessionsCache)
  • auto_update_listdesktops_cache (bool) - activate automatic updates of desktop lists in (X2GoListSessionsCache)
  • auto_update_listmounts_cache (bool) - activate automatic updates of mount lists in (X2GoListSessionsCache)
  • auto_update_sessionregistry (bool) - activate automatic updates of the X2Go session registry
  • auto_register_sessions (bool) - activate automatic X2Go session registration
  • no_auto_reg_pubapp_sessions (bool) - skip automatic X2Go session registration for suspended/running published applications sessions
  • refresh_interval (int) - refresh session list cache and session status every refresh_interval seconds
  • pulseaudio_installdir (str) - install path of Pulseaudio binary
  • logger (X2GoLogger instance) - you can pass an X2GoLogger object to the X2GoClient constructor
  • loglevel (int) - if no X2GoLogger object has been supplied a new one will be constructed with the given loglevel
Overrides: object.__init__

HOOK_profile_auto_connect(self, profile_name='UNKNOWN')

source code 

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

Parameters:
  • profile_name (str) - profile name of session that called this hook method

HOOK_broker_connection_exception(self, profile_name='UNKNOWN')

source code 

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

Parameters:
  • profile_name (str) - profile name of a session that triggered this hook method

HOOK_broker_ignore_connection_problems(self, profile_name='UNKNOWN', is_profile_connected=False)

source code 

HOOK method: called after a broker connection failed for a certain profile. This hook can be used to allow the user to decide how to proceed after connection problems with the broker.

Parameters:
  • profile_name (str) - profile name of a session that triggered this hook method
  • is_profile_connected (bool) - True if the given session profile is already conneced to the server
Returns: bool
If this hook returns True, the session startup/resumption will be continued, even if the broker connection is down. (Default: broker connection problems cause session start-up to fail).

HOOK_session_startup_failed(self, profile_name='UNKNOWN')

source code 

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

Parameters:
  • profile_name (str) - profile name of session that called this hook method

HOOK_desktop_sharing_denied(self, profile_name='UNKNOWN')

source code 

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

Parameters:
  • profile_name (str) - profile name of session that called this hook method

HOOK_list_desktops_timeout(self, profile_name='UNKNOWN')

source code 

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

Parameters:
  • profile_name (str) - profile name of session that called this hook method

HOOK_no_such_desktop(self, profile_name='UNKNOWN', desktop='UNKNOWN')

source code 

HOOK method: called if it is tried to connect to a (seen before) sharable desktop that's not available (anymore).

Parameters:
  • profile_name (str) - profile name of session that called this hook method
  • desktop (str) - desktop identifier (the X session's $DISPLAY)

HOOK_no_installed_xservers_found(self)

source code 

HOOK method: called if the Python X2Go module could not find any usable XServer application to start. You will not be able to start X2Go sessions without an XServer.

HOOK_open_print_dialog(self, profile_name='UNKNOWN', session_name='UNKNOWN')

source code 

HOOK method: called if an incoming print job has been detected by X2GoPrintQueue and a print dialog box is requested.

Parameters:
  • profile_name (str) - profile name of session that called this hook method
  • session_name (str) - X2Go session name

HOOK_no_such_command(self, cmd, profile_name='UNKNOWN', session_name='UNKNOWN')

source code 

HOOK: the command <cmd> is not available on the connected X2Go server.

Parameters:
  • cmd (str) - the command that failed
  • profile_name (str) - profile name of session that called this hook method
  • session_name (str) - X2Go session name

HOOK_open_mimebox_saveas_dialog(self, filename, profile_name='UNKNOWN', session_name='UNKNOWN')

source code 

HOOK method: called on detection of an incoming MIME box job ,,<filename>''.

Parameters:
  • filename (str) - file name of the incoming MIME box job
  • profile_name (str) - profile name of session that called this hook method
  • session_name (str) - X2Go session name

HOOK_printaction_error(self, filename, profile_name='UNKNOWN', session_name='UNKNOWN', err_msg='GENERIC_ERROR', printer=None)

source code 

HOOK method: called if an incoming print job caused an error.

Parameters:
  • filename (str) - file name of the print job that failed
  • profile_name (str) - profile name of session that called this hook method
  • session_name (str) - X2Go session name
  • err_msg (str) - if available, an appropriate error message
  • printer (str) - if available, the printer name the print job failed on

HOOK_check_host_dialog(self, profile_name='UNKNOWN', host='UNKNOWN', port=22, fingerprint='no fingerprint', fingerprint_type='UNKNOWN')

source code 

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

Parameters:
  • profile_name (str) - profile name of session that called this hook method
  • host (str) - SSH server name to validate
  • port (int) - SSH server port to validate
  • fingerprint (str) - the server's fingerprint
  • fingerprint_type (str) - finger print type (like RSA, DSA, ...)
Returns: bool
if host validity is verified, this hook method should return True

HOOK_on_control_session_death(self, profile_name)

source code 

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

Parameters:
  • profile_name (str) - profile name of session that called this hook method

HOOK_on_failing_SFTP_client(self, profile_name, session_name)

source code 

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

Parameters:
  • profile_name (str) - profile name of the session that experiences failing SFTP client support
  • session_name (str) - name of session experiencing failing SFTP client support

HOOK_on_sound_tunnel_failed(self, profile_name='UNKNOWN', session_name='UNKNOWN')

source code 

HOOK method: called if a sound tunnel setup failed.

Parameters:
  • profile_name (str) - profile name of session that called this hook method
  • session_name (str) - X2Go session name

HOOK_rforward_request_denied(self, profile_name='UNKNOWN', session_name='UNKNOWN', server_port=0)

source code 

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

Parameters:
  • profile_name (str) - profile name of session that called this hook method
  • session_name (str) - X2Go session name
  • server_port (str) - remote server port (starting point of reverse forwarding tunnel)

HOOK_forwarding_tunnel_setup_failed(self, profile_name='UNKNOWN', session_name='UNKNOWN', chain_host='UNKNOWN', chain_port=0, subsystem=None)

source code 

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

Parameters:
  • profile_name (str) - profile name of session that called this hook method
  • session_name (str) - X2Go session name
  • chain_host (str) - hostname of chain host (forwarding tunnel end point)
  • chain_port (str) - port of chain host (forwarding tunnel end point)
  • subsystem (str) - information on the subsystem that provoked this hook call

HOOK_on_session_has_started_by_me(self, session_uuid='UNKNOWN', profile_name='UNKNOWN', session_name='UNKNOWN')

source code 

HOOK method: called if a session has been started by this instance of X2GoClient.

Parameters:
  • session_uuid (str) - unique session identifier of the calling session
  • profile_name (str) - profile name of session that called this hook method
  • session_name (str) - X2Go session name

HOOK_on_session_has_started_by_other(self, session_uuid='UNKNOWN', profile_name='UNKNOWN', session_name='UNKNOWN')

source code 

HOOK method: called if a session has been started by another x2goclient.

Parameters:
  • session_uuid (str) - unique session identifier of the calling session
  • profile_name (str) - profile name of session that called this hook method
  • session_name (str) - X2Go session name

HOOK_on_session_has_resumed_by_me(self, session_uuid='UNKNOWN', profile_name='UNKNOWN', session_name='UNKNOWN')

source code 

HOOK method: called if a session has been resumed by this instance of X2GoClient.

Parameters:
  • session_uuid (str) - unique session identifier of the calling session
  • profile_name (str) - profile name of session that called this hook method
  • session_name (str) - X2Go session name

HOOK_on_session_has_resumed_by_other(self, session_uuid='UNKNOWN', profile_name='UNKNOWN', session_name='UNKNOWN')

source code 

HOOK method: called if a session has been resumed by another x2goclient.

Parameters:
  • session_uuid (str) - unique session identifier of the calling session
  • profile_name (str) - profile name of session that called this hook method
  • session_name (str) - X2Go session name

HOOK_on_found_session_running_after_connect(self, session_uuid='UNKNOWN', profile_name='UNKNOWN', session_name='UNKNOWN')

source code 

HOOK method: called after server connect if an already running session has been found.

Parameters:
  • session_uuid (str) - unique session identifier of the calling session
  • profile_name (str) - profile name of session that called this hook method
  • session_name (str) - X2Go session name

HOOK_on_session_has_been_suspended(self, session_uuid='UNKNOWN', profile_name='UNKNOWN', session_name='UNKNOWN')

source code 

HOOK method: called if a session has been suspended by this instance of X2GoClient.

Parameters:
  • session_uuid (str) - unique session identifier of the calling session
  • profile_name (str) - profile name of session that called this hook method
  • session_name (str) - X2Go session name

HOOK_on_session_has_terminated(self, session_uuid='UNKNOWN', profile_name='UNKNOWN', session_name='UNKNOWN')

source code 

HOOK method: called if a session has been suspended by another x2goclient.

Parameters:
  • session_uuid (str) - unique session identifier of the calling session
  • profile_name (str) - profile name of session that called this hook method
  • session_name (str) - X2Go session name

HOOK_printing_not_available(self, profile_name='UNKNOWN', session_name='UNKNOWN')

source code 

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

Parameters:
  • profile_name (str) - profile name of session that called this hook method
  • session_name (str) - X2Go session name

HOOK_mimebox_not_available(self, profile_name='UNKNOWN', session_name='UNKNOWN')

source code 

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

Parameters:
  • profile_name (str) - profile name of session that called this hook method
  • session_name (str) - X2Go session name

HOOK_foldersharing_not_available(self, profile_name='UNKNOWN', session_name='UNKNOWN')

source code 

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

Parameters:
  • profile_name (str) - profile name of session that called this hook method
  • session_name (str) - X2Go session name

HOOK_sshfs_not_available(self, profile_name='UNKNOWN', session_name='UNKNOWN')

source code 

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

Parameters:
  • profile_name (str) - profile name of session that called this hook method
  • session_name (str) - X2Go session name

get_client_rootdir(self)

source code 

Retrieve the settings root directory of this X2GoClient instance.

Returns: str
X2Go client root directory

get_sessions_rootdir(self)

source code 

Retrieve the sessions root directory of this X2GoClient instance.

Returns: str
X2Go sessions root directory

get_ssh_rootdir(self)

source code 

Retrieve the SSH client root dir used with this X2GoClient instance.

Returns: str
SSH client root directory

get_client_username(self)

source code 

Query the local user's username (i.e. the user running the X2Go client).

Returns: str
the local username this X2GoClient instance runs as

register_all_session_profiles(self, return_objects=False)

source code 

Register all session profiles found in the sessions configuration node as potential X2Go sessions.

Parameters:
  • return_objects (bool) - if set to True this methods returns a list of X2GoSession instances, otherwise a list of session UUIDs representing the corresponding registered sessions is returned
Returns: list
a Python dictionary containing one registered session for each available session profile configuration, whereas the profile names are used as dictionary keys and X2GoSession instances as their values

register_session(self, server=None, profile_id=None, profile_name=None, session_name=None, allow_printing=False, allow_share_local_folders=False, share_local_folders=[], allow_mimebox=False, mimebox_extensions=[], mimebox_action='OPEN', add_to_known_hosts=False, known_hosts=None, forward_sshagent=False, proxy_options={}, return_object=False, **kwargs)

source code 

Register a new X2GoSession. Within one X2GoClient instance you can manage several X2GoSession instances on serveral remote X2Go servers under different user names.

These sessions can be instantiated by passing direct X2GoSession parameters to this method or by specifying the name of an existing session profile (as found in the X2GoClient's sessions configuration node.

A session profile is a pre-defined set of session options stored in a sessions profile node (e.g. a configuration file). With the FILE backend such session profiles are stored as a file (by default: ~/.x2goclient/sessions or globally (for all users on the client) in /etc/x2goclient/sessions).

Python X2Go also supports starting multiple X2Go sessions for the same session profile simultaneously.

This method (X2GoClient.register_session()) accepts a similar set of parameters as the X2GoSession constructor itself. For a complete set of session options refer there.

Alternatively, you can also pass a profile name or a profile id to this method. If you do this, Python X2Go tries to find the specified session in the sessions configuration node and then derives the necessary session parameters from the session profile configuration. Additional X2GoSession parameters can also be passed to this method---they will override the option values retrieved from the session profile.

Parameters:
  • server (str) - hostname of the remote X2Go server
  • profile_id (str) - id (config section name) of a session profile to load from your session config
  • profile_name (str) - name of a session profile to load from your session config
  • allow_printing (bool) - enable X2Go printing support for the to-be-registered X2Go session
  • allow_share_local_folders (bool) - set local folder sharing to enabled/disabled
  • share_local_folders (list) - a list of local folders (as strings) to be shared directly after session start up
  • allow_mimebox (bool) - enable X2Go MIME box support for the to-be-registered X2Go session
  • mimebox_extensions (list) - MIME box support is only allowed for the given file extensions
  • mimebox_action (str) - MIME box action to use on incoming MIME job files
  • add_to_known_hosts (bool) - add unknown host keys to the known_hosts file and accept the connection automatically
  • known_hosts (str) - full path to known_hosts file
  • forward_sshagent (bool) - forward SSH agent authentication requests to the X2Go client-side
  • proxy_options (dict) - a set of very X2GoProxy* backend specific options; any option that is not known to the X2GoProxy* backend will simply be ignored
  • return_object (bool) - normally this method returns a unique session UUID. If return_object is set to True an X2GoSession object will be returned instead
  • kwargs (dict) - any option that is also valid for the X2GoSession constructor
Returns: str
a unique identifier (UUID) for the newly registered X2Go session (or an X2GoSession object if return_object is set to True

get_session_summary(self, session_uuid)

source code 

Retrieves a Python dictionary, containing a short session summary (session status, names, etc.)

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash

get_session_username(self, session_uuid)

source code 

After an X2GoSession has been set up you can query the username that the remote sessions runs as.

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
Returns: str
the remote username the X2Go session runs as

get_session_server_peername(self, session_uuid)

source code 

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

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
Returns: tuple
the host an X2Go session is connected to (as an (addr,port) tuple)

get_session_server_hostname(self, session_uuid)

source code 

Retrieve the server hostname as provided by the calling application (e.g. like it has been specified in the session profile).

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
Returns: str
the hostname for the queried X2Go session as specified by the calling application

get_session(self, session_uuid)

source code 

Retrieve the complete X2GoSession object that has been registered under the given session registry hash.

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
Returns: obj
the X2GoSession instance

with_session(self, session_uuid)

source code 

Alias for get_session().

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
Returns: obj
the X2GoSession instance

get_session_of_session_name(self, session_name, return_object=False, match_profile_name=None)

source code 

Retrieve session UUID or X2GoSession for session name <session_name> from the session registry.

Parameters:
  • session_name (str) - the X2Go session's UUID registry hash
  • return_object (bool) - session UUID hash or X2GoSession instance wanted?
  • match_profile_name (str) - only return sessions that match this profile name
Returns: str or X2GoSession instance
the X2Go session's UUID registry hash or X2GoSession instance

get_session_name(self, session_uuid)

source code 

Retrieve the server-side X2Go session name for the session that has been registered under session_uuid.

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
Returns: str
X2Go session name

get_session_info(self, session_uuid)

source code 

Retrieve the server-side X2Go session information object for the session that has been registered under session_uuid.

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
Returns: obj
X2Go session info

get_published_applications(self, session_uuid=None, profile_name=None, lang=None, refresh=False, raw=False, very_raw=False, max_no_submenus=10)

source code 

Retrieve the server-side X2Go published applications menu for the session registered under session_uuid or for profile name profile_name.

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
  • profile_name (str) - a valid session profile name
Returns: dict
a representative of the published applications menu tree

profile_get_published_applications(self, session_uuid=None, profile_name=None, lang=None, refresh=False, raw=False, very_raw=False, max_no_submenus=10)

source code 

Retrieve the server-side X2Go published applications menu for the session registered under session_uuid or for profile name profile_name.

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
  • profile_name (str) - a valid session profile name
Returns: dict
a representative of the published applications menu tree

set_session_username(self, session_uuid, username)

source code 

Set the session username for the X2GoSession that has been registered under session_uuid. This can be helpful for modifying user credentials during an authentication phase.

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
  • username (str) - new user name to be used for session authentication
Returns: bool
return True on success

check_session_host(self, session_uuid)

source code 

Provide a mechanism to evaluate the validity of an X2Go server host.

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
Returns: bool
return True if host validation has been successful.

session_reuses_sshproxy_authinfo(self, session_uuid)

source code 

Check if session with unique identifier <session_uuid> is configured to re-use the X2Go session's password / key for proxy authentication, as well.

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

session_uses_sshproxy(self, session_uuid)

source code 

Check if session with unique identifier <session_uuid> is configured to use an intermediate SSH proxy server.

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

session_can_sshproxy_auto_connect(self, session_uuid)

source code 

Check if the SSH proxy of session with unique identifier <session_uuid> is configured adequately to be able to auto-connect to the SSH proxy server (e.g. by public key authentication).

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
Returns: bool
returns True if the session's SSH proxy can auto-connect, False otherwise, None if no control session has been set up yet.

session_can_auto_connect(self, session_uuid)

source code 

Check if session with unique identifier <session_uuid> is configured adequately to be able to auto-connect to the X2Go server (e.g. by public key authentication).

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
Returns: bool
returns True if the session can auto-connect, False otherwise, None if no control session has been set up yet.

session_auto_connect(self, session_uuid)

source code 

Auto-connect a given session. This method is called from within the session itself and can be used to override the auto-connect procedure from within your client implementation.

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
Returns: bool
returns True if the session could be auto-connected.

connect_session(self, session_uuid, username=None, password=None, passphrase=None, sshproxy_user=None, sshproxy_password=None, sshproxy_passphrase=None, add_to_known_hosts=False, force_password_auth=False, sshproxy_force_password_auth=False)

source code 

Connect to a registered X2Go session with registry hash session_uuid This method basically wraps around paramiko.SSHClient.connect() for the corresponding session.

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
  • username (str) - user name to be used for session authentication
  • password (str) - the user's password for the X2Go server that is going to be connected to
  • passphrase (str) - a passphrase to use for unlocking a private key in case the password is already needed for two-factor authentication
  • sshproxy_user (str) - user name to be used for SSH proxy authentication
  • sshproxy_password (str) - the SSH proxy user's password
  • 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
  • add_to_known_hosts (bool) - non-Paramiko option, if True paramiko.AutoAddPolicy() is used as missing-host-key-policy. If set to False checkhosts.X2GoInteractiveAddPolicy() is used
  • force_password_auth (bool) - disable SSH pub/priv key authentication mechanisms completely
  • sshproxy_force_password_auth (bool) - disable SSH pub/priv key authentication mechanisms completely for SSH proxy connection
Returns: bool
returns True if this method has been successful

disconnect_session(self, session_uuid)

source code 

Disconnect an X2GoSession by closing down its Paramiko/SSH Transport thread.

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash

set_session_print_action(self, session_uuid, print_action, **kwargs)

source code 

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

Currently, there are five different print actions available, each defined as an individual print action class:

Each of the print action classes accepts different print action arguments. For detail information on these print action arguments please refer to the constructor methods of each class individually.

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
  • 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_session_window_title(self, session_uuid, title='')

source code 

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:
  • session_uuid (str) - the X2Go session's UUID registry hash
  • title (str) - new title for session window

raise_session_window(self, session_uuid)

source code 

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

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash

session_auto_start_or_resume(self, session_uuid, newest=True, oldest=False, all_suspended=False, start=True)

source code 

Automatically start or resume one or several sessions.

This method is called from within the session itself on session registration, so this method can be used to handle auto-start/-resume events.

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
  • newest (bool) - if resuming, only resume newest/youngest session
  • oldest (bool) - if resuming, only resume oldest session
  • all_suspended (bool) - if resuming, resume all suspended sessions
  • start (bool) - if no session is to be resumed, start a new session

start_session(self, session_uuid, **sessionopts)

source code 

Start a new X2Go session on the remote X2Go server. This method will open---if everything has been successful till here---the X2Go session window.

Before calling this method you have to register your desired session with register_session (initialization of session parameters) and connect to it with connect_session (authentication).

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
  • sessionopts (dict) - pass-through of options directly to the session instance's X2GoSession.start() method
Returns: bool
returns True if this method has been successful

share_desktop_session(self, session_uuid, desktop=None, user=None, display=None, share_mode=0, check_desktop_list=False, **sessionopts)

source code 

Share another already running desktop session. Desktop sharing can be run in two different modes: view-only and full-access mode. Like new sessions a to-be-shared session has be registered first with the X2GoClient instance.

Parameters:
  • desktop (str) - desktop ID of a sharable desktop in format <user>@<display>
  • 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.
  • 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.
  • share_mode (int) - desktop sharing mode, 0 is VIEW-ONLY, 1 is FULL-ACCESS.
  • sessionopts (dict) - pass-through of options directly to the session instance's X2GoSession.share_desktop() method
Returns: bool
True if the session could be successfully shared.
Raises:
  • X2GoDesktopSharingException - if a given desktop ID does not specify an available desktop session

resume_session(self, session_uuid=None, session_name=None, match_profile_name=None, **sessionopts)

source code 

Resume or continue a suspended / running X2Go session on a remote X2Go server (as specified when register_session was called).

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
  • session_name (str) - the server-side name of an X2Go session
  • match_profile_name (str) - only resume a session if this profile name matches
  • sessionopts (dict) - pass-through of options directly to the session instance's X2GoSession.resume() method
Returns: bool
returns True if this method has been successful
Raises:

suspend_session(self, session_uuid, session_name=None, match_profile_name=None, **sessionopts)

source code 

Suspend an X2Go session.

Normally, you will use this method to suspend a registered session that you have formerly started/resumed from within your recent X2GoClient instance. For this you simply call this method using the session's session_uuid, leave the session_name empty.

Alternatively, you can suspend a non-associated X2Go session: To do this you simply neeed to register (with the register_session method) an X2Go session on the to-be-addressed remote X2Go server and connect (connect_session) to it. Then call this method with the freshly obtained session_uuid and the remote X2Go session name (as shown e.g. in x2golistsessions output).

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
  • session_name (str) - the server-side name of an X2Go session (for non-associated session suspend)
  • match_profile_name (str) - only suspend a session if this profile name matches
  • sessionopts (dict) - pass-through of options directly to the session instance's X2GoSession.suspend() method
Returns: bool
returns True if this method has been successful

terminate_session(self, session_uuid, session_name=None, match_profile_name=None, **sessionopts)

source code 

Terminate an X2Go session.

Normally you will use this method to terminate a registered session that you have formerly started/resumed from within your recent X2GoClient instance. For this you simply call this method using the session's session_uuid, leave the session_name empty.

Alternatively, you can terminate a non-associated X2Go session: To do this you simply neeed to register (register_session) an X2Go session on the to-be-addressed remote X2Go server and connect (connect_session) to it. Then call this method with the freshly obtained session_uuid and the remote X2Go session name (as shown in e.g. x2golistsessions output).

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
  • session_name (str) - the server-side name of an X2Go session
  • match_profile_name (str) - only terminate a session if this profile name matches
  • sessionopts (dict) - pass-through of options directly to the session instance's X2GoSession.terminate() method
Returns: bool
returns True if this method has been successful

get_session_profile_name(self, session_uuid)

source code 

Retrieve the profile name of the session that has been registered under session_uuid.

For profile based sessions this will be the profile name as used in x2goclient's »sessions« configuration file.

For non-profile based session this will either be a profile_name that was passed to register_session or it will be the application that instantiated this X2GoClient instance.

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
Returns: str
X2Go session profile name

get_session_profile_id(self, session_uuid)

source code 

Retrieve the profile id of the session that has been registered under session_uuid.

For profile based sessions this will be the profile id as used in x2goclient's »sessions« configuration node (section header of a session profile in the config, normally a timestamp created on session profile creation/modification).

For non-profile based sessions this will be a timestamp created on X2Go session registration by register_session.

Parameters:
  • session_uuid (str) - the session profile name
Returns: str
the X2Go session profile's id

session_ok(self, session_uuid)

source code 

Test if the X2Go session registered as session_uuid is in a healthy state.

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
Returns: bool
True if session is ok, False otherwise

is_session_connected(self, session_uuid)

source code 

Test if the X2Go session registered as session_uuid connected to the X2Go server.

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
Returns: bool
True if session is connected, False otherwise

is_profile_connected(self, profile_name)

source code 

Test if the X2Go given session profile has open connections to the X2Go server.

Parameters:
  • profile_name (str) - a valid session profile name
Returns: bool
True if profile has a connected session, False otherwise

is_session_profile(self, profile_id_or_name)

source code 

Test if the X2Go given session profile is configured in the client's sessions file.

Parameters:
  • profile_id_or_name (str) - test existence of this session profile name (or id)
Returns: bool
True if session profile exists, False otherwise

is_session_running(self, session_uuid, session_name=None)

source code 

Test if the X2Go session registered as session_uuid is up and running.

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
  • session_name (str) - the server-side name of an X2Go session
Returns: bool
True if session is running, False otherwise

is_session_suspended(self, session_uuid, session_name=None)

source code 

Test if the X2Go session registered as session_uuid is in suspended state.

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
  • session_name (str) - the server-side name of an X2Go session
Returns: bool
True if session is suspended, False otherwise

has_session_terminated(self, session_uuid, session_name=None)

source code 

Test if the X2Go session registered as session_uuid has terminated.

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
  • session_name (str) - the server-side name of an X2Go session
Returns: bool
True if session has terminated, False otherwise

is_folder_sharing_available(self, session_uuid=None, profile_name=None)

source code 

Test if local folder sharing is available for X2Go session with unique ID <session_uuid> or session profile <profile_name>.

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
  • profile_name (str) - alternatively, the profile name can be used to perform this query
Returns: bool
returns True if the profile/session supports local folder sharing

share_local_folder(self, session_uuid=None, local_path=None, profile_name=None, folder_name=None)

source code 

Share a local folder with the X2Go session registered as session_uuid.

When calling this method the given client-side folder is mounted on the X2Go server (via sshfs) and (if in desktop mode) provided as a desktop icon on your remote session's desktop.

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
  • local_path (str) - the full path to an existing folder on the local (client-side) file system
  • folder_name (str) - synonymous to local_path
  • profile_name (str) - alternatively, the profile name can be used to share local folders
Returns: bool
returns True if the local folder has been successfully mounted

unshare_all_local_folders(self, session_uuid=None, profile_name=None)

source code 

Unshare all local folders mounted in X2Go session registered as session_uuid.

When calling this method all client-side mounted folders on the X2Go server (via sshfs) for session with ID <session_uuid> will get unmounted.

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
  • profile_name (str) - alternatively, the profile name can be used to unshare mounted folders
Returns: bool
returns True if all local folders could be successfully unmounted

unshare_all_local_folders_from_session(self, session_uuid=None, profile_name=None)

source code 

Unshare all local folders mounted in X2Go session registered as session_uuid.

When calling this method all client-side mounted folders on the X2Go server (via sshfs) for session with ID <session_uuid> will get unmounted.

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
  • profile_name (str) - alternatively, the profile name can be used to unshare mounted folders
Returns: bool
returns True if all local folders could be successfully unmounted

unshare_all_local_folders_from_profile(self, session_uuid=None, profile_name=None)

source code 

Unshare all local folders mounted in X2Go session registered as session_uuid.

When calling this method all client-side mounted folders on the X2Go server (via sshfs) for session with ID <session_uuid> will get unmounted.

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
  • profile_name (str) - alternatively, the profile name can be used to unshare mounted folders
Returns: bool
returns True if all local folders could be successfully unmounted

unshare_local_folder(self, session_uuid=None, profile_name=None, local_path=None)

source code 

Unshare local folder that is mounted in the X2Go session registered as session_uuid.

When calling this method the given client-side mounted folder on the X2Go server (via sshfs) for session with ID <session_uuid> will get unmounted.

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
  • profile_name (str) - alternatively, the profile name can be used to unshare mounted folders
  • local_path (str) - the full path of a local folder that is mounted within X2Go session with session ID <session_uuid> (or recognized via profile name) and that shall be unmounted from that session.
Returns: bool
returns True if all local folders could be successfully unmounted

unshare_local_folder_from_session(self, session_uuid=None, profile_name=None, local_path=None)

source code 

Unshare local folder that is mounted in the X2Go session registered as session_uuid.

When calling this method the given client-side mounted folder on the X2Go server (via sshfs) for session with ID <session_uuid> will get unmounted.

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
  • profile_name (str) - alternatively, the profile name can be used to unshare mounted folders
  • local_path (str) - the full path of a local folder that is mounted within X2Go session with session ID <session_uuid> (or recognized via profile name) and that shall be unmounted from that session.
Returns: bool
returns True if all local folders could be successfully unmounted

unshare_local_folder_from_profile(self, session_uuid=None, profile_name=None, local_path=None)

source code 

Unshare local folder that is mounted in the X2Go session registered as session_uuid.

When calling this method the given client-side mounted folder on the X2Go server (via sshfs) for session with ID <session_uuid> will get unmounted.

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
  • profile_name (str) - alternatively, the profile name can be used to unshare mounted folders
  • local_path (str) - the full path of a local folder that is mounted within X2Go session with session ID <session_uuid> (or recognized via profile name) and that shall be unmounted from that session.
Returns: bool
returns True if all local folders could be successfully unmounted

get_shared_folders(self, session_uuid=None, profile_name=None, check_list_mounts=False)

source code 

Get a list of local folders mounted within X2Go session with session hash <session_uuid> from this client.

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
  • profile_name (str) - alternatively, the profile name can be used to get mounted folders of a session connected profile
  • check_list_mounts (bool) - query the server-side mount list for up-to-date information
Returns: list
returns a list of those local folder names that are mounted within X2Go session <session_uuid>.

session_get_shared_folders(self, session_uuid=None, profile_name=None, check_list_mounts=False)

source code 

Get a list of local folders mounted within X2Go session with session hash <session_uuid> from this client.

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
  • profile_name (str) - alternatively, the profile name can be used to get mounted folders of a session connected profile
  • check_list_mounts (bool) - query the server-side mount list for up-to-date information
Returns: list
returns a list of those local folder names that are mounted within X2Go session <session_uuid>.

profile_get_shared_folders(self, session_uuid=None, profile_name=None, check_list_mounts=False)

source code 

Get a list of local folders mounted within X2Go session with session hash <session_uuid> from this client.

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
  • profile_name (str) - alternatively, the profile name can be used to get mounted folders of a session connected profile
  • check_list_mounts (bool) - query the server-side mount list for up-to-date information
Returns: list
returns a list of those local folder names that are mounted within X2Go session <session_uuid>.

get_master_session(self, profile_name, return_object=True, return_session_name=False)

source code 

Retrieve the master session of a specific profile.

Parameters:
  • profile_name (str) - the profile name that we query the master session of
  • return_object (bool) - return X2GoSession instance
  • return_session_name (bool) - return X2Go session name
Returns: list
a session list (as UUID hashes, objects, profile names/IDs or session names)

profile_master_session(self, profile_name, return_object=True, return_session_name=False)

source code 

Retrieve the master session of a specific profile.

Parameters:
  • profile_name (str) - the profile name that we query the master session of
  • return_object (bool) - return X2GoSession instance
  • return_session_name (bool) - return X2Go session name
Returns: list
a session list (as UUID hashes, objects, profile names/IDs or session names)

client_connected_sessions(self, return_objects=False, return_profile_names=False, return_profile_ids=False, return_session_names=False)

source code 

Retrieve a list of X2Go sessions that this X2GoClient instance is connected to.

Parameters:
  • return_objects (bool) - return as list of X2Go session objects
  • return_profile_names (bool) - return as list of session profile names
  • return_profile_ids (bool) - return as list of session profile IDs
  • return_session_names (bool) - return as list of session names
Returns: list
list of connected sessions

client_associated_sessions(self, return_objects=False, return_profile_names=False, return_profile_ids=False, return_session_names=False)

source code 

Retrieve a list of X2Go sessions associated to this X2GoClient instance.

Parameters:
  • return_objects (bool) - return as list of X2Go session objects
  • return_profile_names (bool) - return as list of session profile names
  • return_profile_ids (bool) - return as list of session profile IDs
  • return_session_names (bool) - return as list of session names
Returns: list
list of associated sessions

client_running_sessions(self, return_objects=False, return_profile_names=False, return_profile_ids=False, return_session_names=False)

source code 

Retrieve a list of running X2Go sessions.

Parameters:
  • return_objects (bool) - return as list of X2Go session objects
  • return_profile_names (bool) - return as list of session profile names
  • return_profile_ids (bool) - return as list of session profile IDs
  • return_session_names (bool) - return as list of session names
Returns: list
list of running sessions

client_suspended_sessions(self, return_objects=False, return_profile_names=False, return_profile_ids=False, return_session_names=False)

source code 

Retrieve a list of suspended X2Go sessions.

Parameters:
  • return_objects (bool) - return as list of X2Go session objects
  • return_profile_names (bool) - return as list of session profile names
  • return_profile_ids (bool) - return as list of session profile IDs
  • return_session_names (bool) - return as list of session names
Returns: list
list of suspended sessions

client_registered_sessions(self, return_objects=True, return_profile_names=False, return_profile_ids=False, return_session_names=False)

source code 

Retrieve a list of registered X2Go sessions.

Parameters:
  • return_objects (bool) - return as list of X2Go session objects
  • return_profile_names (bool) - return as list of session profile names
  • return_profile_ids (bool) - return as list of session profile IDs
  • return_session_names (bool) - return as list of session names
Returns: list
list of registered sessions

client_control_session_of_profile_name(self, profile_name)

source code 

Retrieve control session for profile name <profile_name>.

Parameters:
  • profile_name (str) - profile name
Returns: X2GoControlSession instance
control session instance

get_server_versions(self, profile_name, component=None, force=False)

source code 

Query the server configured in session profile <profile_name> for the list of install X2Go components and its versions.

Parameters:
  • profile_name (str) - use the control session of this profile to query the X2Go server for its component list
  • component (str) - only return the version of a specific component
  • force (bool) - refresh component/version data by a query to the server
Returns: dict or str
dictionary of server components (as keys) and their versions (as values) or the version of the given <component>
Raises:

get_server_components(self, profile_name, component=None, force=False)

source code 

Query the server configured in session profile <profile_name> for the list of install X2Go components and its versions.

Parameters:
  • profile_name (str) - use the control session of this profile to query the X2Go server for its component list
  • component (str) - only return the version of a specific component
  • force (bool) - refresh component/version data by a query to the server
Returns: dict or str
dictionary of server components (as keys) and their versions (as values) or the version of the given <component>
Raises:

get_server_features(self, profile_name, force=False)

source code 

Query the server configured in session profile <profile_name> for the list of server-side X2Go features.

Parameters:
  • profile_name (str) - use the control session of this profile to query the X2Go server for its feature list
  • force (bool) - refresh feature list by a query to the server
Returns: list
list of server feature names (as returned by server-side command ,,x2gofeaturelist''

has_server_feature(self, profile_name, feature)

source code 

Query the server configured in session profile <profile_name> for the availability of a certain server feature.

Parameters:
  • profile_name (str) - use the control session of this profile to query the X2Go server for its feature
  • feature (str) - test the availability of this feature on the X2Go server
Returns: bool
True if the feature is available on the queried server

client_registered_session_of_name(self, session_name, return_object=False)

source code 

Retrieve X2Go session of a given session name.

Parameters:
  • session_name (str) - session name
Returns: X2GoSession or str
session instance of the given name

client_has_registered_session_of_name(self, session_name)

source code 

Equals True if there is a registered session of name <session_name>.

Parameters:
  • session_name (str) - session name
Returns: bool
True if the given session is registered

client_registered_sessions_of_profile_name(self, profile_name, return_objects=False, return_session_names=False)

source code 

Retrieve registered X2Go sessions of profile name <profile_name>.

Parameters:
  • profile_name (str) - profile name
  • return_objects (bool) - return as list of X2Go session objects
  • return_session_names (bool) - return as list of session names
Returns: list
list of registered sessions of profile name

client_connected_sessions_of_profile_name(self, profile_name, return_objects=False, return_session_names=False)

source code 

Retrieve connected X2Go sessions of profile name <profile_name>.

Parameters:
  • profile_name (str) - profile name
  • return_objects (bool) - return as list of X2Go session objects
  • return_session_names (bool) - return as list of session names
Returns: list
list of connected sessions of profile name

client_associated_sessions_of_profile_name(self, profile_name, return_objects=False, return_session_names=False)

source code 

Retrieve associated X2Go sessions of profile name <profile_name>.

Parameters:
  • profile_name (str) - profile name
  • return_objects (bool) - return as list of X2Go session objects
  • return_session_names (bool) - return as list of session names
Returns: list
list of associated sessions of profile name

client_pubapp_sessions_of_profile_name(self, profile_name, return_objects=False, return_session_names=False)

source code 

Retrieve X2Go sessions of profile name <profile_name> that provide published applications.

Parameters:
  • profile_name (str) - profile name
  • return_objects (bool) - return as list of X2Go session objects
  • return_session_names (bool) - return as list of session names
Returns: list
list of application publishing sessions of profile name

client_running_sessions_of_profile_name(self, profile_name, return_objects=False, return_session_names=False)

source code 

Retrieve running X2Go sessions of profile name <profile_name>.

Parameters:
  • profile_name (str) - profile name
  • return_objects (bool) - return as list of X2Go session objects
  • return_session_names (bool) - return as list of session names
Returns: list
list of running sessions of profile name

client_suspended_sessions_of_profile_name(self, profile_name, return_objects=False, return_session_names=False)

source code 

Retrieve suspended X2Go sessions of profile name <profile_name>.

Parameters:
  • profile_name (str) - profile name
  • return_objects (bool) - return as list of X2Go session objects
  • return_session_names (bool) - return as list of session names
Returns: list
list of suspended sessions of profile name

server_is_alive(self, session_uuid)

source code 

Test if server that corresponds to the terminal session session_uuid is alive.

If the session is not connected anymore the X2GoClient.HOOK_on_control_session_death() gets called.

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
Returns: bool
True if X2Go server connection for X2GoSession instance with <session_uuid> is alive.
Raises:

all_servers_are_alive(self)

source code 

Test vitality of all connected X2Go servers.

Returns: bool
True if all connected X2Go servers are alive.

server_valid_x2gouser(self, session_uuid, username=None)

source code 

Check if user is allowed to start an X2Go session on a remote server.

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
  • username (str) - user name to test validity for
Returns: str
Is remote user allowed to start an X2Go session?

server_running_sessions(self, session_uuid)

source code 

Retrieve a list of session names of all server-side running sessions (including those not instantiated by our X2GoClient instance).

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
Returns: list
list of session names
Raises:

server_has_running_sessions(self, session_uuid)

source code 

Equals True if the X2Go server has any running sessions.

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
Returns: bool
True, if there are running sessions

server_has_running_session_of_name(self, session_uuid, session_name)

source code 

Equals True if the X2Go server has a running session of name <session_name>.

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
  • session_name (str) - session name

server_suspended_sessions(self, session_uuid)

source code 

Retrieve a list of session names of all server-side suspended sessions (including those not instantiated by our X2GoClient instance).

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
Returns: list
list of session names
Raises:

server_has_suspended_sessions(self, session_uuid)

source code 

Equals True if the X2Go server has any suspended sessions.

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash

server_has_suspended_session_of_name(self, session_uuid, session_name)

source code 

Equals True if the X2Go server has a suspended session of name <session_name>.

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
  • session_name (str) - session name
Returns: bool
True, if there are running sessions

clean_sessions(self, session_uuid, published_applications=False)

source code 

Find running X2Go sessions that have previously been started by the connected user on the remote X2Go server and terminate them.

Before calling this method you have to setup a pro forma remote X2Go session with X2GoClient.register_session() (even if you do not intend to open a real X2Go session window on the remote server) and connect to this session (with X2GoClient.connect_session().

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
  • published_applications (bool) - if True, also terminate sessions that are published applications provider

list_sessions(self, session_uuid=None, profile_name=None, profile_id=None, no_cache=False, refresh_cache=False, update_sessionregistry=True, register_sessions=False, raw=False)

source code 

Use the X2Go session registered under session_uuid to retrieve a list of running or suspended X2Go sessions from the connected X2Go server (for the authenticated user).

Before calling this method you have to setup a pro forma remote X2Go session with X2GoClient.register_session() (even if you do not intend to open a real X2Go session window on the remote server) and connect to this session (with X2GoClient.connect_session().

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
  • profile_name (str) - use profile name instead of <session_uuid>
  • profile_id (str) - use profile id instead of <profile_name> or <session_uuid>
  • no_cache (bool) - do not get the session list from cache, query the X2Go server directly
  • refresh_cache (bool) - query the X2Go server directly and update the session list cache with the new information
  • update_sessionregistry (bool) - query the X2Go server directly and update the session registry according to the obtained information
  • register_sessions (bool) - query the X2Go server directly and register newly found X2Go session as X2GoSession instances associated to this X2GoClient instance
  • raw (bool) - output the session list in X2Go's raw x2golistsessions format
Raises:
  • X2GoClientException - if the session profile specified by session_uuid, profile_name or profile_id is not connected or if none of the named parameters has been specified

list_desktops(self, session_uuid=None, profile_name=None, profile_id=None, no_cache=False, refresh_cache=False, exclude_session_types=[], raw=False)

source code 

Use the X2Go session registered under session_uuid to retrieve a list of X2Go desktop sessions that are available for desktop sharing.

Before calling this method you have to setup a pro forma remote X2Go session with X2GoClient.register_session() (even if you do not intend to open a real X2Go session window on the remote server) and connect to this session (with X2GoClient.connect_session().

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
  • profile_name (str) - use profile name instead of <session_uuid>
  • profile_id (str) - use profile id instead of <profile_name> or <session_uuid>
  • no_cache (bool) - do not get the desktop list from cache, query the X2Go server directly
  • refresh_cache (bool) - query the X2Go server directly and update the desktop list cache with the new information
  • exclude_session_types (list) - session types (e.g. "D", "R", "S" or "P") to be excluded from the returned list of sharable desktops (this only works for sharing someone's own sessions, for sharing other users' sessions, the X2Go Desktop Sharing decides on what is sharable and what not).
  • raw (bool) - output the session list in X2Go's raw x2golistdesktops format
Returns: list
a list of available desktops to be shared
Raises:
  • X2GoClientException - if the session profile specified by session_uuid, profile_name or profile_id is not connected or if none of the named parameters has been specified

list_mounts_by_profile_name(self, profile_name, no_cache=False, refresh_cache=False, raw=False)

source code 

For a given profil profile_name to retrieve its list of mounted client shares for that session.

Parameters:
  • profile_name (str) - a valid profile name
  • no_cache (bool) - do not get the session list from cache, query the X2Go server directly
  • raw (bool) - output the session list in X2Go's raw x2golistmounts format
Returns: list
list of server-side mounted shares for a given profile name

list_mounts(self, session_uuid, no_cache=False, refresh_cache=False, raw=False)

source code 

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

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
  • no_cache (bool) - do not get the session list from cache, query the X2Go server directly
  • raw (bool) - output the session list in X2Go's raw x2golistmounts format
Returns: list
list of server-side mounted shares for a given session UUID

get_profiles(self)

source code 

Returns the X2GoClient instance's X2GoSessionProfiles* object.

Use this method for object retrieval if you want to modify the »sessions« configuration node (e.g. in ~/.x2goclient with the FILE backend) from within your Python X2Go based application.

return: returns the client's session profiles instance rtype: X2GoSessionProfiles* instance

get_session_profiles(self)

source code 

Alias for get_profiles().

get_client_settings(self)

source code 

Returns the X2GoClient instance's X2GoClientSettings* object.

Use this method for object retrieval if you want to modify the »settings« configuration node (e.g. in ~/.x2goclient with the FILE backend) from within your Python X2Go based application.

return: returns the client's settings configuration node rtype: bool

get_client_printing(self)

source code 

Returns the X2GoClient instance's X2GoClientPrinting* object.

Use this method for object retrieval if you want to modify the printing configuration node (e.g. in ~/.x2goclient with the FILE backend) from within your Python X2Go based application.

return: returns the client's printing configuration node rtype: bool

get_profile_config(self, profile_id_or_name, parameter=None)

source code 

Returns a dictionary with session options and values that represent the session profile for profile_id_or_name.

Parameters:
  • profile_id_or_name (str) - name or id of an X2Go session profile as found in the sessions configuration file
  • parameter (str) - if specified, only the value for the given parameter is returned
Returns: dict or bool, int, str
a Python dictionary with session profile options

with_profile_config(self, profile_id_or_name, parameter=None)

source code 

Returns a dictionary with session options and values that represent the session profile for profile_id_or_name.

Parameters:
  • profile_id_or_name (str) - name or id of an X2Go session profile as found in the sessions configuration file
  • parameter (str) - if specified, only the value for the given parameter is returned
Returns: dict or bool, int, str
a Python dictionary with session profile options

set_profile_config(self, profile_id_or_name, parameter, value)

source code 

Set individual session profile parameters for session profile profile_id_or_name.

Parameters:
  • profile_id_or_name (str) - name or id of an X2Go session profile as found in the sessions configuration file
  • parameter (str) - set this parameter with the given value
  • value (bool, int, str, list or dict) - set this value for the given parameter
Returns: dict
returns True if this operation has been successful

to_profile_id(self, profile_name)

source code 

Retrieve the session profile ID of the session whose profile name is profile_name

Parameters:
  • profile_name (str) - the session profile name
Returns: str
the session profile's ID

to_profile_name(self, profile_id)

source code 

Retrieve the session profile name of the session whose profile ID is profile_id

Parameters:
  • profile_id (str) - the session profile ID
Returns: str
the session profile's name

get_profile_metatype(self, profile_name)

source code 

Evaluate a session profile and return a human readable meta type (classification) for the session profile profile_name.

Parameters:
  • profile_name (str) - a profile name
Returns: str
the profile's meta type

client_connected_profiles(self, return_profile_names=False)

source code 

Retrieve a list of session profiles that are currently connected to an X2Go server.

Parameters:
  • return_profile_names (bool) - return as list of session profile names
Returns: list
a list of profile names or IDs

disconnect_profile(self, profile_name)

source code 

Disconnect all X2GoSession instances that relate to profile_name by closing down their Paramiko/SSH Transport thread.

Parameters:
  • profile_name (str) - the X2Go session profile name
Returns: bool
a return value

update_sessionregistry_status_by_profile_name(self, profile_name, session_list=None)

source code 

Update the session registry stati by profile name.

Parameters:
  • profile_name (str) - the X2Go session profile name
  • session_list (X2GoServerList* instances) - a manually passed on list of X2Go sessions

update_sessionregistry_status_by_session_uuid(self, session_uuid)

source code 

Update the session registry status of a specific X2GoSession instance with session identifier <session_uuid>.

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash

update_cache_by_profile_name(self, profile_name, cache_types='sessions', update_sessions=None, update_desktops=None, update_mounts=None)

source code 

Update the session list cache by profile name.

Parameters:
  • profile_name (str) - the X2Go session profile name
  • cache_types (tuple or list) - specify what cache type to update (available: sessions, desktops, mounts)
  • update_sessions (bool) - instead of giving a list of cache types, plainly say True here, if you want to update sessions in the session list cache.
  • update_desktops (bool) - instead of giving a list of cache types, plainly say True here, if you want to update available desktops in the desktop list cache.
  • update_mounts (bool) - instead of giving a list of cache types, plainly say True here, if you want to update mounted shares in the mount list cache.

update_cache_by_session_uuid(self, session_uuid, cache_types='sessions', update_sessions=None, update_desktops=None, update_mounts=None)

source code 

Update the session list cache of a specific X2GoSession instance with session identifier <session_uuid>.

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
  • cache_types (tuple or list) - specify what cache type to update (available: sessions, desktops, mounts)
  • update_sessions (bool) - instead of giving a list of cache types, plainly say True here, if you want to update sessions in the session list cache.
  • update_desktops (bool) - instead of giving a list of cache types, plainly say True here, if you want to update available desktops in the desktop list cache.
  • update_mounts (bool) - instead of giving a list of cache types, plainly say True here, if you want to update mounted shares in the mount list cache.

update_cache_all_profiles(self, cache_types='sessions', update_sessions=None, update_desktops=None, update_mounts=None)

source code 

Update the session list cache of all session profiles.

Parameters:
  • cache_types (tuple or list) - specify what cache type to update (available: sessions, desktops, mounts)
  • update_sessions (bool) - instead of giving a list of cache types, plainly say True here, if you want to update sessions in the session list cache.
  • update_desktops (bool) - instead of giving a list of cache types, plainly say True here, if you want to update available desktops in the desktop list cache.
  • update_mounts (bool) - instead of giving a list of cache types, plainly say True here, if you want to update mounted shares in the mount list cache.

register_available_server_sessions_by_profile_name(self, profile_name, re_register=False, skip_pubapp_sessions=False)

source code 

Register available sessions that are found on the X2Go server the profile of name profile_name is connected to.

Parameters:
  • profile_name (str) - the X2Go session profile name
  • re_register (bool) - re-register available sessions, needs to be done after session profile changes
  • skip_pubapp_sessions (bool) - Do not auto-register published applications sessions.

register_available_server_sessions_by_session_uuid(self, session_uuid, skip_pubapp_sessions=False)

source code 

Register available sessions that are found on the X2Go server that the X2GoSession instance with session identifier <session_uuid> is connected to.

Parameters:
  • session_uuid (str) - the X2Go session's UUID registry hash
  • skip_pubapp_sessions (bool) - Do not auto-register published applications sessions.

register_available_server_sessions_all_profiles(self, skip_pubapp_sessions=False)

source code 

Register all available sessions found on an X2Go server for each session profile.

Parameters:
  • skip_pubapp_sessions (bool) - Do not auto-register published applications sessions.

Property Details

has_custom_client_rootdir

Does this X2GoClient instance have a customized root dir path? Equals True in case it has.

client_has_connected_sessions

Equals True if there are any connected sessions with this X2GoClient instance.

client_has_associated_sessions

Equals True if there are any associated sessions with this X2GoClient instance.

client_has_running_sessions

Equals True if there are any running sessions with this X2GoClient instance.

client_has_suspended_sessions

Equals True if there are any suspended sessions with this X2GoClient instance.

client_control_sessions

Equals a list of all registered X2Go control sessions.

profile_names

Equals a list of all profile names that are known to this X2GoClient instance.