diff options
Diffstat (limited to 'examples/python/dbus/get-active-connection-uuids.py')
-rwxr-xr-x | examples/python/dbus/get-active-connection-uuids.py | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/examples/python/dbus/get-active-connection-uuids.py b/examples/python/dbus/get-active-connection-uuids.py index dd168c0aab..e138ce60a3 100755 --- a/examples/python/dbus/get-active-connection-uuids.py +++ b/examples/python/dbus/get-active-connection-uuids.py @@ -13,11 +13,15 @@ import dbus bus = dbus.SystemBus() # Get a proxy for the base NetworkManager object -m_proxy = bus.get_object("org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager") +m_proxy = bus.get_object( + "org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager" +) manager = dbus.Interface(m_proxy, "org.freedesktop.NetworkManager") mgr_props = dbus.Interface(m_proxy, "org.freedesktop.DBus.Properties") -s_proxy = bus.get_object("org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager/Settings") +s_proxy = bus.get_object( + "org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager/Settings" +) settings = dbus.Interface(s_proxy, "org.freedesktop.NetworkManager.Settings") # Find the device the user wants to disconnect @@ -31,12 +35,18 @@ for a in active: uuid = a_props.Get("org.freedesktop.NetworkManager.Connection.Active", "Uuid") # Grab the connection object path so we can get all the connection's settings - connection_path = a_props.Get("org.freedesktop.NetworkManager.Connection.Active", "Connection") + connection_path = a_props.Get( + "org.freedesktop.NetworkManager.Connection.Active", "Connection" + ) c_proxy = bus.get_object("org.freedesktop.NetworkManager", connection_path) - connection = dbus.Interface(c_proxy, "org.freedesktop.NetworkManager.Settings.Connection") + connection = dbus.Interface( + c_proxy, "org.freedesktop.NetworkManager.Settings.Connection" + ) settings = connection.GetSettings() - print("%s (%s) - %s" % (settings['connection']['id'], uuid, settings['connection']['type'])) + print( + "%s (%s) - %s" + % (settings["connection"]["id"], uuid, settings["connection"]["type"]) + ) if len(active) == 0: print("No active connections") - |