dbus package API reference
Submodules
- dbus.bus module
BusConnection
BusConnection.ProxyObjectClass
BusConnection.START_REPLY_ALREADY_RUNNING
BusConnection.START_REPLY_SUCCESS
BusConnection.TYPE_SESSION
BusConnection.TYPE_STARTER
BusConnection.TYPE_SYSTEM
BusConnection.activate_name_owner()
BusConnection.add_match_string()
BusConnection.add_match_string_non_blocking()
BusConnection.add_message_filter()
BusConnection.add_signal_receiver()
BusConnection.call_async()
BusConnection.call_blocking()
BusConnection.call_on_disconnection()
BusConnection.close()
BusConnection.flush()
BusConnection.get_is_authenticated()
BusConnection.get_is_connected()
BusConnection.get_name_owner()
BusConnection.get_object()
BusConnection.get_peer_unix_process_id()
BusConnection.get_peer_unix_user()
BusConnection.get_unique_name()
BusConnection.get_unix_fd()
BusConnection.get_unix_user()
BusConnection.list_activatable_names()
BusConnection.list_exported_child_objects()
BusConnection.list_names()
BusConnection.name_has_owner()
BusConnection.release_name()
BusConnection.remove_match_string()
BusConnection.remove_match_string_non_blocking()
BusConnection.remove_message_filter()
BusConnection.remove_signal_receiver()
BusConnection.request_name()
BusConnection.send_message()
BusConnection.send_message_with_reply()
BusConnection.send_message_with_reply_and_block()
BusConnection.set_allow_anonymous()
BusConnection.set_exit_on_disconnect()
BusConnection.set_unique_name()
BusConnection.start_service_by_name()
BusConnection.watch_name_owner()
- dbus.connection module
Connection
Connection.ProxyObjectClass
Connection.activate_name_owner()
Connection.add_message_filter()
Connection.add_signal_receiver()
Connection.call_async()
Connection.call_blocking()
Connection.call_on_disconnection()
Connection.close()
Connection.flush()
Connection.get_is_authenticated()
Connection.get_is_connected()
Connection.get_object()
Connection.get_peer_unix_process_id()
Connection.get_peer_unix_user()
Connection.get_unique_name()
Connection.get_unix_fd()
Connection.list_exported_child_objects()
Connection.remove_message_filter()
Connection.remove_signal_receiver()
Connection.send_message()
Connection.send_message_with_reply()
Connection.send_message_with_reply_and_block()
Connection.set_allow_anonymous()
Connection.set_exit_on_disconnect()
Connection.set_unique_name()
SignalMatch
- dbus.decorators module
- dbus.exceptions module
- dbus.gi_service module
ExportedGObject
ExportedGObject.Introspect()
ExportedGObject.SUPPORTS_MULTIPLE_CONNECTIONS
ExportedGObject.SUPPORTS_MULTIPLE_OBJECT_PATHS
ExportedGObject.add_to_connection()
ExportedGObject.bind_property()
ExportedGObject.bind_property_full()
ExportedGObject.chain()
ExportedGObject.compat_control()
ExportedGObject.connect()
ExportedGObject.connect_after()
ExportedGObject.connect_data()
ExportedGObject.connect_object()
ExportedGObject.connect_object_after()
ExportedGObject.connection
ExportedGObject.disconnect
ExportedGObject.disconnect_by_func()
ExportedGObject.emit()
ExportedGObject.emit_stop_by_name()
ExportedGObject.find_property
ExportedGObject.force_floating()
ExportedGObject.freeze_notify()
ExportedGObject.g_type_instance
ExportedGObject.get_data()
ExportedGObject.get_properties()
ExportedGObject.get_property()
ExportedGObject.get_qdata()
ExportedGObject.getv
ExportedGObject.handler_block()
ExportedGObject.handler_block_by_func()
ExportedGObject.handler_disconnect
ExportedGObject.handler_is_connected
ExportedGObject.handler_unblock
ExportedGObject.handler_unblock_by_func()
ExportedGObject.install_properties
ExportedGObject.install_property
ExportedGObject.interface_find_property()
ExportedGObject.interface_install_property()
ExportedGObject.interface_list_properties()
ExportedGObject.is_floating
ExportedGObject.list_properties
ExportedGObject.locations
ExportedGObject.newv
ExportedGObject.notify
ExportedGObject.notify_by_pspec()
ExportedGObject.override_property
ExportedGObject.props
ExportedGObject.qdata
ExportedGObject.ref()
ExportedGObject.ref_count
ExportedGObject.ref_sink()
ExportedGObject.remove_from_connection()
ExportedGObject.replace_data()
ExportedGObject.replace_qdata()
ExportedGObject.run_dispose
ExportedGObject.set_data()
ExportedGObject.set_properties()
ExportedGObject.set_property()
ExportedGObject.steal_data()
ExportedGObject.steal_qdata()
ExportedGObject.stop_emission()
ExportedGObject.stop_emission_by_name
ExportedGObject.thaw_notify
ExportedGObject.unref()
ExportedGObject.watch_closure()
ExportedGObject.weak_ref()
- dbus.lowlevel module
ErrorMessage
ErrorMessage.append()
ErrorMessage.copy()
ErrorMessage.get_allow_interactive_authorization()
ErrorMessage.get_args_list()
ErrorMessage.get_auto_start()
ErrorMessage.get_destination()
ErrorMessage.get_error_name()
ErrorMessage.get_interface()
ErrorMessage.get_member()
ErrorMessage.get_no_reply()
ErrorMessage.get_path()
ErrorMessage.get_path_decomposed()
ErrorMessage.get_reply_serial()
ErrorMessage.get_sender()
ErrorMessage.get_serial()
ErrorMessage.get_signature()
ErrorMessage.get_type()
ErrorMessage.guess_signature()
ErrorMessage.has_destination()
ErrorMessage.has_interface()
ErrorMessage.has_member()
ErrorMessage.has_path()
ErrorMessage.has_sender()
ErrorMessage.has_signature()
ErrorMessage.is_error()
ErrorMessage.is_method_call()
ErrorMessage.is_signal()
ErrorMessage.set_allow_interactive_authorization()
ErrorMessage.set_auto_start()
ErrorMessage.set_destination()
ErrorMessage.set_error_name()
ErrorMessage.set_interface()
ErrorMessage.set_member()
ErrorMessage.set_no_reply()
ErrorMessage.set_path()
ErrorMessage.set_reply_serial()
ErrorMessage.set_sender()
Message
Message.append()
Message.copy()
Message.get_allow_interactive_authorization()
Message.get_args_list()
Message.get_auto_start()
Message.get_destination()
Message.get_error_name()
Message.get_interface()
Message.get_member()
Message.get_no_reply()
Message.get_path()
Message.get_path_decomposed()
Message.get_reply_serial()
Message.get_sender()
Message.get_serial()
Message.get_signature()
Message.get_type()
Message.guess_signature()
Message.has_destination()
Message.has_interface()
Message.has_member()
Message.has_path()
Message.has_sender()
Message.has_signature()
Message.is_error()
Message.is_method_call()
Message.is_signal()
Message.set_allow_interactive_authorization()
Message.set_auto_start()
Message.set_destination()
Message.set_error_name()
Message.set_interface()
Message.set_member()
Message.set_no_reply()
Message.set_path()
Message.set_reply_serial()
Message.set_sender()
MethodCallMessage
MethodCallMessage.append()
MethodCallMessage.copy()
MethodCallMessage.get_allow_interactive_authorization()
MethodCallMessage.get_args_list()
MethodCallMessage.get_auto_start()
MethodCallMessage.get_destination()
MethodCallMessage.get_error_name()
MethodCallMessage.get_interface()
MethodCallMessage.get_member()
MethodCallMessage.get_no_reply()
MethodCallMessage.get_path()
MethodCallMessage.get_path_decomposed()
MethodCallMessage.get_reply_serial()
MethodCallMessage.get_sender()
MethodCallMessage.get_serial()
MethodCallMessage.get_signature()
MethodCallMessage.get_type()
MethodCallMessage.guess_signature()
MethodCallMessage.has_destination()
MethodCallMessage.has_interface()
MethodCallMessage.has_member()
MethodCallMessage.has_path()
MethodCallMessage.has_sender()
MethodCallMessage.has_signature()
MethodCallMessage.is_error()
MethodCallMessage.is_method_call()
MethodCallMessage.is_signal()
MethodCallMessage.set_allow_interactive_authorization()
MethodCallMessage.set_auto_start()
MethodCallMessage.set_destination()
MethodCallMessage.set_error_name()
MethodCallMessage.set_interface()
MethodCallMessage.set_member()
MethodCallMessage.set_no_reply()
MethodCallMessage.set_path()
MethodCallMessage.set_reply_serial()
MethodCallMessage.set_sender()
MethodReturnMessage
MethodReturnMessage.append()
MethodReturnMessage.copy()
MethodReturnMessage.get_allow_interactive_authorization()
MethodReturnMessage.get_args_list()
MethodReturnMessage.get_auto_start()
MethodReturnMessage.get_destination()
MethodReturnMessage.get_error_name()
MethodReturnMessage.get_interface()
MethodReturnMessage.get_member()
MethodReturnMessage.get_no_reply()
MethodReturnMessage.get_path()
MethodReturnMessage.get_path_decomposed()
MethodReturnMessage.get_reply_serial()
MethodReturnMessage.get_sender()
MethodReturnMessage.get_serial()
MethodReturnMessage.get_signature()
MethodReturnMessage.get_type()
MethodReturnMessage.guess_signature()
MethodReturnMessage.has_destination()
MethodReturnMessage.has_interface()
MethodReturnMessage.has_member()
MethodReturnMessage.has_path()
MethodReturnMessage.has_sender()
MethodReturnMessage.has_signature()
MethodReturnMessage.is_error()
MethodReturnMessage.is_method_call()
MethodReturnMessage.is_signal()
MethodReturnMessage.set_allow_interactive_authorization()
MethodReturnMessage.set_auto_start()
MethodReturnMessage.set_destination()
MethodReturnMessage.set_error_name()
MethodReturnMessage.set_interface()
MethodReturnMessage.set_member()
MethodReturnMessage.set_no_reply()
MethodReturnMessage.set_path()
MethodReturnMessage.set_reply_serial()
MethodReturnMessage.set_sender()
PendingCall
SignalMessage
SignalMessage.append()
SignalMessage.copy()
SignalMessage.get_allow_interactive_authorization()
SignalMessage.get_args_list()
SignalMessage.get_auto_start()
SignalMessage.get_destination()
SignalMessage.get_error_name()
SignalMessage.get_interface()
SignalMessage.get_member()
SignalMessage.get_no_reply()
SignalMessage.get_path()
SignalMessage.get_path_decomposed()
SignalMessage.get_reply_serial()
SignalMessage.get_sender()
SignalMessage.get_serial()
SignalMessage.get_signature()
SignalMessage.get_type()
SignalMessage.guess_signature()
SignalMessage.has_destination()
SignalMessage.has_interface()
SignalMessage.has_member()
SignalMessage.has_path()
SignalMessage.has_sender()
SignalMessage.has_signature()
SignalMessage.is_error()
SignalMessage.is_method_call()
SignalMessage.is_signal()
SignalMessage.set_allow_interactive_authorization()
SignalMessage.set_auto_start()
SignalMessage.set_destination()
SignalMessage.set_error_name()
SignalMessage.set_interface()
SignalMessage.set_member()
SignalMessage.set_no_reply()
SignalMessage.set_path()
SignalMessage.set_reply_serial()
SignalMessage.set_sender()
- dbus.mainloop package
- dbus.proxies module
Interface
ProxyObject
ProxyObject.DeferredMethodClass
ProxyObject.INTROSPECT_STATE_DONT_INTROSPECT
ProxyObject.INTROSPECT_STATE_INTROSPECT_DONE
ProxyObject.INTROSPECT_STATE_INTROSPECT_IN_PROGRESS
ProxyObject.ProxyMethodClass
ProxyObject.bus_name
ProxyObject.connect_to_signal()
ProxyObject.get_dbus_method()
ProxyObject.object_path
ProxyObject.requested_bus_name
- dbus.server module
- dbus.service module
- dbus.types module
Array
Boolean
Byte
ByteArray
ByteArray.capitalize()
ByteArray.center()
ByteArray.count()
ByteArray.decode()
ByteArray.endswith()
ByteArray.expandtabs()
ByteArray.find()
ByteArray.fromhex()
ByteArray.hex()
ByteArray.index()
ByteArray.isalnum()
ByteArray.isalpha()
ByteArray.isascii()
ByteArray.isdigit()
ByteArray.islower()
ByteArray.isspace()
ByteArray.istitle()
ByteArray.isupper()
ByteArray.join()
ByteArray.ljust()
ByteArray.lower()
ByteArray.lstrip()
ByteArray.maketrans()
ByteArray.partition()
ByteArray.removeprefix()
ByteArray.removesuffix()
ByteArray.replace()
ByteArray.rfind()
ByteArray.rindex()
ByteArray.rjust()
ByteArray.rpartition()
ByteArray.rsplit()
ByteArray.rstrip()
ByteArray.split()
ByteArray.splitlines()
ByteArray.startswith()
ByteArray.strip()
ByteArray.swapcase()
ByteArray.title()
ByteArray.translate()
ByteArray.upper()
ByteArray.zfill()
Dictionary
Double
Int16
Int32
Int64
ObjectPath
ObjectPath.variant_level
ObjectPath.capitalize()
ObjectPath.casefold()
ObjectPath.center()
ObjectPath.count()
ObjectPath.encode()
ObjectPath.endswith()
ObjectPath.expandtabs()
ObjectPath.find()
ObjectPath.format()
ObjectPath.format_map()
ObjectPath.index()
ObjectPath.isalnum()
ObjectPath.isalpha()
ObjectPath.isascii()
ObjectPath.isdecimal()
ObjectPath.isdigit()
ObjectPath.isidentifier()
ObjectPath.islower()
ObjectPath.isnumeric()
ObjectPath.isprintable()
ObjectPath.isspace()
ObjectPath.istitle()
ObjectPath.isupper()
ObjectPath.join()
ObjectPath.ljust()
ObjectPath.lower()
ObjectPath.lstrip()
ObjectPath.maketrans()
ObjectPath.partition()
ObjectPath.removeprefix()
ObjectPath.removesuffix()
ObjectPath.replace()
ObjectPath.rfind()
ObjectPath.rindex()
ObjectPath.rjust()
ObjectPath.rpartition()
ObjectPath.rsplit()
ObjectPath.rstrip()
ObjectPath.split()
ObjectPath.splitlines()
ObjectPath.startswith()
ObjectPath.strip()
ObjectPath.swapcase()
ObjectPath.title()
ObjectPath.translate()
ObjectPath.upper()
ObjectPath.zfill()
Signature
Signature.variant_level
Signature.capitalize()
Signature.casefold()
Signature.center()
Signature.count()
Signature.encode()
Signature.endswith()
Signature.expandtabs()
Signature.find()
Signature.format()
Signature.format_map()
Signature.index()
Signature.isalnum()
Signature.isalpha()
Signature.isascii()
Signature.isdecimal()
Signature.isdigit()
Signature.isidentifier()
Signature.islower()
Signature.isnumeric()
Signature.isprintable()
Signature.isspace()
Signature.istitle()
Signature.isupper()
Signature.join()
Signature.ljust()
Signature.lower()
Signature.lstrip()
Signature.maketrans()
Signature.partition()
Signature.removeprefix()
Signature.removesuffix()
Signature.replace()
Signature.rfind()
Signature.rindex()
Signature.rjust()
Signature.rpartition()
Signature.rsplit()
Signature.rstrip()
Signature.split()
Signature.splitlines()
Signature.startswith()
Signature.strip()
Signature.swapcase()
Signature.title()
Signature.translate()
Signature.upper()
Signature.zfill()
String
String.capitalize()
String.casefold()
String.center()
String.count()
String.encode()
String.endswith()
String.expandtabs()
String.find()
String.format()
String.format_map()
String.index()
String.isalnum()
String.isalpha()
String.isascii()
String.isdecimal()
String.isdigit()
String.isidentifier()
String.islower()
String.isnumeric()
String.isprintable()
String.isspace()
String.istitle()
String.isupper()
String.join()
String.ljust()
String.lower()
String.lstrip()
String.maketrans()
String.partition()
String.removeprefix()
String.removesuffix()
String.replace()
String.rfind()
String.rindex()
String.rjust()
String.rpartition()
String.rsplit()
String.rstrip()
String.split()
String.splitlines()
String.startswith()
String.strip()
String.swapcase()
String.title()
String.translate()
String.upper()
String.variant_level
String.zfill()
Struct
UInt16
UInt32
UInt64
UnixFd
Deprecated submodules
Module contents
Implements the public API for a D-Bus client. See the dbus.service module to export objects or claim well-known names.
- class dbus.Array([iterable][, signature][, variant_level])
Bases:
list
An array of similar items, implemented as a subtype of list.
As currently implemented, an Array behaves just like a list, but with the addition of a
signature
property set by the constructor; conversion of its items to D-Bus types is only done when it’s sent in a Message. This might change in future so validation is done earlier.variant_level
must be non-negative; the default is 0.signature
is the D-Bus signature string for a single element of the array, or None. If not None it must represent a single complete type, the type of a single array item; the signature of the whole Array may be obtained by prependinga
to the given signature.If None (the default), when the Array is sent over D-Bus, the item signature will be guessed from the first element.
- signature
The D-Bus signature of each element of this Array (a Signature instance)
- variant_level
Indicates how many nested Variant containers this object is contained in: if a message’s wire format has a variant containing a variant containing an array, this is represented in Python by an Array with variant_level==2.
- class dbus.Boolean(value: bool[, variant_level: int])
Bases:
_LongBase
A boolean, represented as a subtype of
int
(notbool
, becausebool
cannot be subclassed).value
is converted to 0 or 1 as if byint(bool(value))
.variant_level
must be non-negative; the default is 0.- variant_level
Indicates how many nested Variant containers this object is contained in: if a message’s wire format has a variant containing a variant containing a boolean, this is represented in Python by a Boolean with variant_level==2.
- class dbus.Bus(bus_type=0, private=False, mainloop=None)
Bases:
BusConnection
A connection to one of three possible standard buses, the SESSION, SYSTEM, or STARTER bus. This class manages shared connections to those buses.
If you’re trying to subclass Bus, you may be better off subclassing BusConnection, which doesn’t have all this magic.
- close()
Close the connection.
- get_connection()
Return self, for backwards compatibility with earlier dbus-python versions where Bus was not a subclass of Connection.
- Deprecated
since 0.80.0
- static get_session(private=False)
Static method that returns a connection to the session bus.
- Parameters
- privatebool
If true, do not return a shared connection.
- static get_starter(private=False)
Static method that returns a connection to the starter bus.
- Parameters
- privatebool
If true, do not return a shared connection.
- static get_system(private=False)
Static method that returns a connection to the system bus.
- Parameters
- privatebool
If true, do not return a shared connection.
- class dbus.Byte(integer or bytes of length 1[, variant_level])
Bases:
_LongBase
An unsigned byte: a subtype of int, with range restricted to [0, 255].
A Byte b may be converted to a
str
of length 1 viastr(b) == chr(b)
(Python 2) or to abytes
of length 1 viabytes([b])
(Python 3).Most of the time you don’t want to use this class - it mainly exists for symmetry with the other D-Bus types. See dbus.ByteArray for a better way to handle arrays of Byte.
variant_level
must be non-negative; the default is 0.- variant_level
Indicates how many nested Variant containers this object is contained in: if a message’s wire format has a variant containing a variant containing a byte, this is represented in Python by a Byte with variant_level==2.
- class dbus.ByteArray(str)
Bases:
_BytesBase
ByteArray is a subtype of
bytes
(an alias forstr
in Python 2 but a distinct type in Python 3) which can be used when you want an efficient immutable representation of a D-Bus byte array (signatureay
).By default, when byte arrays are converted from D-Bus to Python, they come out as a dbus.Array of dbus.Byte. This is just for symmetry with the other D-Bus types - in practice, what you usually want is the byte array represented as a string, using this class. To get this, pass the
byte_arrays=True
keyword argument to any of these methods:any D-Bus method proxy, or
connect_to_signal
, on the objects returned by Bus.get_objectany D-Bus method on a dbus.Interface
dbus.Interface.connect_to_signal
Bus.add_signal_receiver
Import via:
from dbus import ByteArray
Constructor:
ByteArray(str)
- exception dbus.DBusException(*args, **kwargs)
Bases:
Exception
- get_dbus_message()
- get_dbus_name()
- include_traceback = False
If True, tracebacks will be included in the exception message sent to D-Bus clients.
Exceptions that are not DBusException subclasses always behave as though this is True. Set this to True on DBusException subclasses that represent a programming error, and leave it False on subclasses that represent an expected failure condition (e.g. a network server not responding).
- class dbus.Dictionary(mapping_or_iterable=(), signature=None, variant_level=0)
Bases:
dict
An mapping whose keys are similar and whose values are similar, implemented as a subtype of dict.
As currently implemented, a Dictionary behaves just like a dict, but with the addition of a
signature
property set by the constructor; conversion of its items to D-Bus types is only done when it’s sent in a Message. This may change in future so validation is done earlier.variant_level
must be non-negative; the default is 0.signature
is either a string or None. If a string, it must consist of exactly two complete type signatures, representing the ‘key’ type (which must be a primitive type, i.e. one of “bdginoqstuxy”) and the ‘value’ type. The signature of the whole Dictionary will bea{xx}
wherexx
is replaced by the given signature.If it is None (the default), when the Dictionary is sent over D-Bus, the key and value signatures will be guessed from an arbitrary element of the Dictionary.
- signature
The D-Bus signature of each key in this Dictionary, followed by that of each value in this Dictionary, as a Signature instance.
- variant_level
Indicates how many nested Variant containers this object is contained in: if a message’s wire format has a variant containing a variant containing a dictionary, this is represented in Python by a Dictionary with variant_level==2.
- class dbus.Double(x=0, /)
Bases:
_FloatBase
A double-precision floating point number (a subtype of float).
- class dbus.Int16(value: int[, variant_level: int])
Bases:
_LongBase
A signed 16-bit integer between -0x8000 and +0x7FFF, represented as a subtype of int.
value must be within the allowed range, or OverflowError will be raised.
variant_level must be non-negative; the default is 0.
- variant_level
Indicates how many nested Variant containers this object is contained in: if a message’s wire format has a variant containing a variant containing an int16, this is represented in Python by an Int16 with variant_level==2.
- class dbus.Int32(value: int[, variant_level: int])
Bases:
_LongBase
A signed 32-bit integer between -0x8000 0000 and +0x7FFF FFFF, represented as a subtype of
int
.value
must be within the allowed range, or OverflowError will be raised.variant_level
must be non-negative; the default is 0.- variant_level
Indicates how many nested Variant containers this object is contained in: if a message’s wire format has a variant containing a variant containing an int32, this is represented in Python by an Int32 with variant_level==2.
- class dbus.Int64(value: int[, variant_level: int])
Bases:
_LongBase
A signed 64-bit integer between -0x8000 0000 0000 0000 and +0x7FFF FFFF FFFF FFFF, represented as a subtype of
long
in Python 2 orint
in Python 3.Note that this may be changed in future to be a subtype of int on 64-bit platforms; applications should not rely on either behaviour.
value
must be within the allowed range, or OverflowError will be raised.variant_level
must be non-negative; the default is 0.- variant_level
Indicates how many nested Variant containers this object is contained in: if a message’s wire format has a variant containing a variant containing an int64, this is represented in Python by an Int64 with variant_level==2.
- class dbus.Interface(object, dbus_interface)
Bases:
object
An interface into a remote object.
An Interface can be used to wrap ProxyObjects so that calls can be routed to their correct D-Bus interface.
- property bus_name
The bus name to which the underlying proxy object is bound
- connect_to_signal(signal_name, handler_function, dbus_interface=None, **keywords)
Arrange for a function to be called when the given signal is emitted.
The parameters and keyword arguments are the same as for dbus.proxies.ProxyObject.connect_to_signal, except that if dbus_interface is None (the default), the D-Bus interface that was passed to the Interface constructor is used.
- property dbus_interface
The D-Bus interface represented
- get_dbus_method(member, dbus_interface=None)
Return a proxy method representing the given D-Bus method.
This is the same as dbus.proxies.ProxyObject.get_dbus_method except that if dbus_interface is None (the default), the D-Bus interface that was passed to the Interface constructor is used.
- property object_path
The D-Bus object path of the underlying object
- property proxy_object
The underlying proxy object
- property requested_bus_name
The bus name which was requested when the underlying object was created
- exception dbus.IntrospectionParserException(msg='')
Bases:
DBusException
- include_traceback = True
If True, tracebacks will be included in the exception message sent to D-Bus clients.
Exceptions that are not DBusException subclasses always behave as though this is True. Set this to True on DBusException subclasses that represent a programming error, and leave it False on subclasses that represent an expected failure condition (e.g. a network server not responding).
- exception dbus.MissingErrorHandlerException
Bases:
DBusException
- include_traceback = True
If True, tracebacks will be included in the exception message sent to D-Bus clients.
Exceptions that are not DBusException subclasses always behave as though this is True. Set this to True on DBusException subclasses that represent a programming error, and leave it False on subclasses that represent an expected failure condition (e.g. a network server not responding).
- exception dbus.MissingReplyHandlerException
Bases:
DBusException
- include_traceback = True
If True, tracebacks will be included in the exception message sent to D-Bus clients.
Exceptions that are not DBusException subclasses always behave as though this is True. Set this to True on DBusException subclasses that represent a programming error, and leave it False on subclasses that represent an expected failure condition (e.g. a network server not responding).
- exception dbus.NameExistsException(name)
Bases:
DBusException
- include_traceback = True
If True, tracebacks will be included in the exception message sent to D-Bus clients.
Exceptions that are not DBusException subclasses always behave as though this is True. Set this to True on DBusException subclasses that represent a programming error, and leave it False on subclasses that represent an expected failure condition (e.g. a network server not responding).
- class dbus.ObjectPath(path: str[, variant_level: int=0])
Bases:
_StrBase
A D-Bus object path, such as
/com/example/MyApp/Documents/abc
.ObjectPath is a subtype of
str
, and object-paths behave like strings.path must be an ASCII string following the syntax of object paths. variant_level must be non-negative; the default is 0.
- variant_level
Indicates how many nested Variant containers this object is contained in: if a message’s wire format has a variant containing a variant containing an object path, this is represented in Python by an ObjectPath with variant_level==2.
- class dbus.SessionBus(private=False, mainloop=None)
Bases:
Bus
The session (current login) message bus.
- class dbus.Signature(value: str or unicode[, variant_level: int])
Bases:
_StrBase
A string subclass whose values are restricted to valid D-Bus signatures. When iterated over, instead of individual characters it produces Signature instances representing single complete types.
value
must be a valid D-Bus signature (zero or more single complete types).variant_level
must be non-negative; the default is 0.- variant_level
Indicates how many nested Variant containers this object is contained in: if a message’s wire format has a variant containing a variant containing a signature, this is represented in Python by a Signature with variant_level==2.
- class dbus.StarterBus(private=False, mainloop=None)
Bases:
Bus
The bus that activated this process (only valid if this process was launched by DBus activation).
- class dbus.String(value: str or unicode[, variant_level: int])
Bases:
str
A string represented using Unicode - a subtype of
unicode
(Python 2) orstr
(Python 3).All strings on D-Bus are required to be valid Unicode; in the “wire protocol” they’re transported as UTF-8.
By default, when strings are converted from D-Bus to Python, they come out as this class. In Python 2, if you prefer to get UTF-8 strings (as instances of a subtype of str) or you want to avoid the conversion overhead of going from UTF-8 to Python’s internal Unicode representation, see the documentation for dbus.UTF8String.
variant_level must be non-negative; the default is 0.
- variant_level
Indicates how many nested Variant containers this object is contained in: if a message’s wire format has a variant containing a variant containing an array, this is represented in Python by a String or UTF8String with variant_level==2.
- class dbus.Struct(iterable, signature=None, variant_level=0)
Bases:
tuple
An structure containing items of possibly distinct types.
D-Bus structs may not be empty, so the iterable argument is required and may not be an empty iterable.
signature
is either None, or a string representing the contents of the struct as one or more complete type signatures. The overall signature of the struct will be the given signature enclosed in parentheses,()
.If the signature is None (default) it will be guessed from the types of the items during construction.
variant_level
must be non-negative; the default is 0.- variant_level
Indicates how many nested Variant containers this object is contained in: if a message’s wire format has a variant containing a variant containing a struct, this is represented in Python by a Struct with variant_level==2.
- class dbus.UInt16(value: int[, variant_level: int])
Bases:
_LongBase
An unsigned 16-bit integer between 0 and 0xFFFF, represented as a subtype of
int
.value
must be within the allowed range, or OverflowError will be raised.variant_level
must be non-negative; the default is 0.- variant_level
Indicates how many nested Variant containers this object is contained in: if a message’s wire format has a variant containing a variant containing a uint16, this is represented in Python by a UInt16 with variant_level==2.
- class dbus.UInt32(value: int[, variant_level: int])
Bases:
_LongBase
An unsigned 32-bit integer between 0 and 0xFFFF FFFF, represented as a subtype of
long
in Python 2 orint
in Python 3.value
must be within the allowed range, or OverflowError will be raised.variant_level
must be non-negative; the default is 0.- variant_level
Indicates how many nested Variant containers this object is contained in: if a message’s wire format has a variant containing a variant containing a uint32, this is represented in Python by a UInt32 with variant_level==2.
- class dbus.UInt64(value: int[, variant_level: int])
Bases:
_LongBase
An unsigned 64-bit integer between 0 and 0xFFFF FFFF FFFF FFFF, subtype of
long
in Python 2 orint
in Python 3.value
must be within the allowed range, or OverflowError will be raised.variant_level
must be non-negative; the default is 0.- variant_level
Indicates how many nested Variant containers this object is contained in: if a message’s wire format has a variant containing a variant containing a uint64, this is represented in Python by a UInt64 with variant_level==2.
- exception dbus.UnknownMethodException(method)
Bases:
DBusException
- include_traceback = True
If True, tracebacks will be included in the exception message sent to D-Bus clients.
Exceptions that are not DBusException subclasses always behave as though this is True. Set this to True on DBusException subclasses that represent a programming error, and leave it False on subclasses that represent an expected failure condition (e.g. a network server not responding).
- exception dbus.ValidationException(msg='')
Bases:
DBusException
- include_traceback = True
If True, tracebacks will be included in the exception message sent to D-Bus clients.
Exceptions that are not DBusException subclasses always behave as though this is True. Set this to True on DBusException subclasses that represent a programming error, and leave it False on subclasses that represent an expected failure condition (e.g. a network server not responding).
- dbus.get_default_main_loop() object
Return the global default dbus-python main loop wrapper, which is used when no main loop wrapper is passed to the Connection constructor.
If None, there is no default and you should always pass the mainloop parameter to the constructor - if you don’t, then asynchronous calls, connecting to signals and exporting objects will raise an exception. There is no default until set_default_main_loop is called.
- dbus.set_default_main_loop(object)
Change the global default dbus-python main loop wrapper, which is used when no main loop wrapper is passed to the Connection constructor.
If None, return to the initial situation: there is no default, and you must always pass the mainloop parameter to the constructor.
Two types of main loop wrapper are planned in dbus-python. Native main-loop wrappers are instances of dbus.mainloop.NativeMainLoop supplied by extension modules like dbus.mainloop.glib: they have no Python API, but connect themselves to
libdbus
using native code. Python main-loop wrappers are not yet implemented. They will be objects supporting the interface defined by dbus.mainloop.MainLoop, with an API entirely based on Python methods.
- dbus.validate_bus_name(name, allow_unique=True, allow_well_known=True)
Raise ValueError if the argument is not a valid bus name.
By default both unique and well-known names are accepted.
- Parameters
- namestr
The name to be validated
- allow_uniquebool
If False, unique names of the form :1.123 will be rejected
- allow_well_knownbool
If False, well-known names of the form com.example.Foo will be rejected
- Since
0.80
- dbus.validate_error_name(name)
Raise ValueError if the given string is not a valid error name.
- Since
0.80
- dbus.validate_interface_name(name)
Raise ValueError if the given string is not a valid interface name.
- Since
0.80
- dbus.validate_member_name(name)
Raise ValueError if the argument is not a valid member (signal or method) name.
- Since
0.80
- dbus.validate_object_path(name)
Raise ValueError if the given string is not a valid object path.
- Since
0.80