[X2Go-Commits] python-x2go.git - build-baikal (branch) updated: 7058128148bfb912fca8a0fac8ebffe184646f1a

X2Go dev team git-admin at x2go.org
Wed Jan 8 15:29:21 CET 2014


The branch, build-baikal has been updated
       via  7058128148bfb912fca8a0fac8ebffe184646f1a (commit)
      from  3faad6adbf891e4d152791625840e3e5755aeea6 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 examples/x2go_resume_session.py |   23 ++++++++++++++---------
 examples/x2go_start_session.py  |   28 +++++++++++++++-------------
 2 files changed, 29 insertions(+), 22 deletions(-)

The diff of changes is:
diff --git a/examples/x2go_resume_session.py b/examples/x2go_resume_session.py
index 9551e47..fa33c71 100755
--- a/examples/x2go_resume_session.py
+++ b/examples/x2go_resume_session.py
@@ -31,26 +31,31 @@ import time
 import paramiko
 
 # modify to your needs...
-server   = "server.my-domain.tld"
+server   = "server.mydomain.tld"
 port     =  22
 username = "foo"
 
 password = getpass.getpass()
 
-cli = x2go.X2goClient()
-s_hash = cli.register_session(server, port=port, username=username, geometry="800x600")
-cli.with_session(s_hash).set_missing_host_key_policy(paramiko.WarningPolicy())
-cli.connect_session(s_hash)
+cli = x2go.X2goClient(use_cache=False, loglevel=x2go.log.loglevel_DEBUG)
+s_uuid = cli.register_session(server, port=port, username=username, geometry="800x600", add_to_known_hosts=True)
+cli.connect_session(s_uuid, password=password)
 
 # the next lines will resume the first session in the avail_sessions dictionary
-avail_sessions = cli.list_sessions(s_hash)
+avail_sessions = cli.list_sessions(s_uuid)
 if avail_sessions:
     session_info = avail_sessions.values()[0]
     sys.stdout.write("Trying to resume session %s\n" % (session_info.name,))
-    cli.resume_session(s_hash, session_name=session_info.name)
+    cli.resume_session(s_uuid, session_name=session_info.name)
+
+    try:
+        while cli.session_ok(s_uuid):
+            time.sleep(1)
+    except KeyboardInterrupt:
+        pass
+
+    cli.terminate_session(s_uuid)
 
-    while cli.session_ok(s_hash):
-        time.sleep(1)
 else:
     print "No sessions to be resumed."
 
diff --git a/examples/x2go_start_session.py b/examples/x2go_start_session.py
index 53d6217..0e2b200 100755
--- a/examples/x2go_start_session.py
+++ b/examples/x2go_start_session.py
@@ -26,33 +26,35 @@
 import x2go
 
 import sys
-import time
+import gevent
 import getpass
-import paramiko
 
 # modify to your needs...
-server   = "server.my-domain.tld"
+server   = "server.mydomain.tld"
 port     = 22
 username = "foo"
 command  = "GNOME"
 
 password = getpass.getpass()
 
-cli = x2go.X2goClient()
-s_hash = cli.register_session(server, port=port, username=username, password=password, cmd=command)
-cli.with_session(s_hash).set_missing_host_key_policy(paramiko.WarningPolicy())
-cli.connect_session(s_hash)
+cli = x2go.X2goClient(use_cache=False, loglevel=x2go.log.loglevel_DEBUG)
+s_uuid = cli.register_session(server, port=port,
+                              username=username,
+                              cmd=command,
+                              add_to_known_hosts=True,
+                             )
+cli.connect_session(s_uuid, password=password)
 
 # clean sessions and check the result
-cli.clean_sessions(s_hash)
+cli.clean_sessions(s_uuid)
 # start the session and run a command
-cli.start_session(s_hash)
+cli.start_session(s_uuid)
 
 try:
-    while True:
-        time.sleep(2)
+    while cli.session_ok(s_uuid):
+        gevent.sleep(2)
 except KeyboardInterrupt:
     pass
 
-# terminate the session
-cli.terminate_session(s_hash)
+# suspend the session
+cli.suspend_session(s_uuid)


hooks/post-receive
-- 
python-x2go.git (Python X2Go Client API)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "python-x2go.git" (Python X2Go Client API).




More information about the x2go-commits mailing list