I'm trying to get state of a VPN connection via DBus in Python. Here is my code:
name="testVPN" proxy = dbus.SystemBus().get_object('org.freedesktop.NetworkManagerUserSettings', '/org/freedesktop/NetworkManagerSettings') iface = dbus.Interface(proxy, 'org.freedesktop.NetworkManagerSettings') connections = iface.ListConnections() for connection in connections: proxy = dbus.SystemBus().get_object('org.freedesktop.NetworkManagerUserSettings', connection) iface = dbus.Interface(proxy, 'org.freedesktop.NetworkManagerSettings.Connection') con_settings = iface.GetSettings()['connection'] if con_settings['type'] == 'vpn' and con_settings['id'] == name: state=dbus.Interface(proxy, 'org.freedesktop.DBus.Properties').Get('org.freedesktop.NetworkManager.VPN.Connection', 'VpnState') This finds VPN connection correctly but in the last line (when trying to get `VpnState` property) it raises this Exception: dbus.exceptions.DBusException: org.freedesktop.DBus.Error.AccessDenied: Rejected send message, 1 matched rules; type="method_call", sender=":1.169" (uid=0 pid=20580 comm="python) interface="org.freedesktop.DBus.Properties" member="Get" error name="(unset)" requested_reply=0 destination=":1.36" (uid=1000 pid=3457 comm="nm-applet)) What is the problem?
_______________________________________________ networkmanager-list mailing list networkmanager-list@gnome.org https://mail.gnome.org/mailman/listinfo/networkmanager-list