Skip to main content

Pythonic DBus library

Project description

Pythonic DBus library.

It’s based on PyGI, the Python GObject Introspection bindings, which is the recommended way to use GLib from Python. Unfortunately, PyGI is not packaged on pypi, so you need to install it from your distribution’s repository (usually called python-gi, python-gobject or pygobject3).

It’s pythonic!

And now, it can also publish objects! Changelog: https://github.com/LEW21/pydbus/releases

Examples

Send a desktop notification

from pydbus import SessionBus

bus = SessionBus()
notifications = bus.get('.Notifications')

notifications.Notify('test', 0, 'dialog-information', "Hello World!", "pydbus works :)", [], {}, 5000)

List systemd units

from pydbus import SystemBus

bus = SystemBus()
systemd = bus.get(".systemd1")

for unit in systemd.ListUnits():
    print(unit)

Watch for new systemd jobs

from pydbus import SystemBus
from gi.repository import GObject

bus = SystemBus()
systemd = bus.get(".systemd1")

systemd.JobNew.connect(print)
GObject.MainLoop().run()

# or

systemd.onJobNew = print
GObject.MainLoop().run()

View object’s API

from pydbus import SessionBus

bus = SessionBus()
notifications = bus.get('.Notifications')

help(notifications)

More examples & documentation

The Tutorial contains more examples and docs.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pydbus, version 0.5.1
Filename, size File type Python version Upload date Hashes
Filename, size pydbus-0.5.1-py2.py3-none-any.whl (23.0 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size pydbus-0.5.1.tar.gz (12.7 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page