diff options
| author | Michael Biebl <biebl@debian.org> | 2018-04-23 18:00:21 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2018-04-23 18:00:21 +0200 |
| commit | f60117b41d5433be1b4a96d82cd11d0c3dce9b63 (patch) | |
| tree | 2dd55c4ab0fdcbe9cddb26adb4a554b1a45c73c8 /examples/python/dbus/update-secrets.py | |
| parent | 7e9ff09fcb2366b383b7ebbec80d2f6fff117290 (diff) | |
New upstream version 1.11.3 upstream/1.11.3
Diffstat (limited to 'examples/python/dbus/update-secrets.py')
| -rwxr-xr-x | examples/python/dbus/update-secrets.py | 14 |
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() |