How do I implement an async method in Python DBus? An Example below:
class LastfmApi(dbus.service.Object):
def __init__(self):
bus_name = dbus.service.BusName('fm.lastfm.api', bus=dbus.SessionBus())
dbus.service.Object.__init__(self, bus_name, '/')
@dbus.service.method('fm.last.api.account', out_signature="s")
def getUsername(self):
## How do I get this method done asynchronously ??
## For example, this method should go off and retrieve the "username"
## asynchronously. When this method returns, the "username" isn't available
## immediately but will be made available at a later time.
I am using Twisted's glib2 reactor.
Update: I know this behavior is possible to implement - DBus includes a "serial" (unique identifier) to method calls and the called method has access to this identifier in order to match "calls" with "replies".