I want to print the result from the dbus.
In the command line i run this:
busctl introspect org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.DBus.Properties
And i get some results.
I try with python but no luck to print the results.
import dbus
bus = dbus.SystemBus()
eth0 = bus.get_object('org.freedesktop.NetworkManager',
'/org/freedesktop/NetworkManager/Devices/eth0')
eth0_dev_iface = dbus.Interface(eth0,
dbus_interface='org.freedesktop.NetworkManager.Devices')
props = eth0_dev_iface.getProperties()
But i get this error:
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownMethod: No such method 'getProperties'
This was pretty aggravating. The interface is kinda crazy.
Try this:
import dbus
bus = dbus.SystemBus()
eth0 = bus.get_object('org.freedesktop.NetworkManager',
'/org/freedesktop/NetworkManager/Devices/eth0')
# Here's where we change things
eth0_dev_iface = dbus.Interface(eth0,
dbus_interface='org.freedesktop.DBus.Properties')
eth0_dev_iface.GetAll('org.freedesktop.NetworkManager.Devices')
Now why doesn't the documentation example code work as documented? That's a great question... The code above however, works fine.