pysdbus is a Python wrapper library for DBus inter-process communication
Project description
pysdbus
pysdbus is a Python wrapper library for DBus inter-process communication. It uses Python's ctypes module to communicate directly with the sd-bus C API of the systemd library. Hence, pysdbus only depends on the presence of the libsystemd.so library and a functional Python interpreter in version 2 or 3.
pysdbus offers three APIs:
pysdbus.llapi
is the low-level API and a thin ctypes wrapper around libsystemd's C APIpysdbus
is the main API of this library and provides additional convenience around the low-level APIpysdbus.dbus
aims to provide a programming interface similar to the well-known dbus-python project
Status
This library is still in an early stage. Many features are still missing but calling and offering APIs with methods, signals and properties is already implemented.
pysdbus example
import pysdbus
bus = pysdbus.SystemBus()
obj = bus.getObject("org.freedesktop.DBus", "/org/freedesktop/DBus")
iface = obj.getInterface("org.freedesktop.DBus")
reply = iface.ListNames()
for service in reply:
print(service)
pysdbus.dbus example
ml = MainLoop()
bus = SystemBus()
dbus_obj = bus.get_object("org.freedesktop.DBus", "/org/freedesktop/DBus")
iface = Interface(dbus_obj, "org.freedesktop.DBus")
reply = iface.ListNames()
print(reply)
def prop_changed_cb(sender, destination, path, interface, member):
print("new signal: ", sender, destination, path, interface, member)
bus.add_signal_receiver(prop_changed_cb)
def nameowner_changed_cb(sender, destination, path, interface, member):
print("nameowner changed: ", sender, destination, path, interface, member)
iface.connect_to_signal("NameOwnerChanged", nameowner_changed_cb)
ml.run()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pysdbus-2023.12.25.tar.gz
(41.8 kB
view details)
File details
Details for the file pysdbus-2023.12.25.tar.gz
.
File metadata
- Download URL: pysdbus-2023.12.25.tar.gz
- Upload date:
- Size: 41.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0662d826c75f203db163d31d32d3ca5ad512f658c115c24526f7dd4a30193cb3 |
|
MD5 | 133a7d12bb28a0120de023987cd47b80 |
|
BLAKE2b-256 | fce50468e5b0bef9be7568b7471f5996a174d1127af508d3a59e842bc7b77233 |