Check NTP synchronization status from Python

Hey, it takes a bit of trial and error to work with dbus, but it’s not too bad after a while :slight_smile:

Here’s a minimal example:

import python
bus = dbus.SystemBus()
proxy = bus.get_object('org.freedesktop.timedate1',
                       '/org/freedesktop/timedate1')
interface = dbus.Interface(proxy, 'org.freedesktop.DBus.Properties')
properties = interface.GetAll('org.freedesktop.timedate1')
print(properties)

If you are interested, here’s an expanded example (to show some dbus type conversions and suchalike), but this above should be enough to get started.

Please note that this example is in our “playground” so it’s not guaranteed to work all the time (I’ve just tested it now).