summary refs log tree commit diff
path: root/examples/python/dbus/update-secrets.py
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2018-06-04 00:07:45 +0200
committerMichael Biebl <biebl@debian.org>2018-06-04 00:07:45 +0200
commit04bc9e1cd3544445d883ad29ea108c1645c8e7b7 (patch)
treed10c354b1b980ca8a7b9e48ec9019e8ed88bde2b /examples/python/dbus/update-secrets.py
parentee9c73a923909e23a649407be77e25235d769e25 (diff)
New upstream version 1.11.4 upstream/1.11.4
Diffstat (limited to 'examples/python/dbus/update-secrets.py')
-rwxr-xr-xexamples/python/dbus/update-secrets.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/examples/python/dbus/update-secrets.py b/examples/python/dbus/update-secrets.py
index 13cac1b0..1fc73209 100755
--- a/examples/python/dbus/update-secrets.py
+++ b/examples/python/dbus/update-secrets.py
@@ -22,7 +22,7 @@
 # Update() method. The method replaces all previous settings with new ones
 # including possible secrets.
 # So, we get all settings using GetSettings() and then find out what secrets
-# are associated with the connection using GetSecrets(), ask for new secret 
+# are associated with the connection using GetSecrets(), ask for new secret
 # values, and add them to the settings that we pass to Update().
 #
 
@@ -37,16 +37,16 @@ def change_secrets_in_one_setting(proxy, config, setting_name):
         # returns a dict of dicts mapping name::setting, where setting is a dict
         # mapping key::value.  Each member of the 'setting' dict is a secret
         secrets = proxy.GetSecrets(setting_name)
-        print "Current secrets:", secrets
+        print("Current secrets:" + secrets)
 
         # Ask user for new secrets and put them into our connection config
         for setting in secrets:
             for key in secrets[setting]:
                 new_secret = raw_input ("Enter new secret for '%s' in '%s': " % (key, setting))
                 config[setting_name][key] = new_secret
-    except Exception, e:
+    except Exception as e:
         #code = str(e).split(':')[0]
-        #print "Exception:", str(e)
+        #print("Exception:" + str(e))
         pass
 
 def change_secrets(con_path, config):
@@ -76,7 +76,7 @@ def find_connection(name):
         connection = dbus.Interface(con_proxy, "org.freedesktop.NetworkManager.Settings.Connection")
         try:
             config = connection.GetSettings()
-        except Exception, e:
+        except Exception as e:
             pass
 
         # Find connection by the id
@@ -101,10 +101,10 @@ if len(sys.argv) != 2:
 # Find the connection
 con = find_connection(sys.argv[1])
 
-print "Connection found: ", con_path
+print("Connection found: " + con_path)
 
 if con:
-    # Obtain new secrets and put then into connection dict 
+    # Obtain new secrets and put then into connection dict
     change_secrets(con_path, con)
 
     # Change the connection with Update()