altdesktop / python-dbus-next

🚌 The next great DBus library for Python with asyncio support
https://python-dbus-next.readthedocs.io/en/latest/
MIT License
187 stars 58 forks source link

Consider adding bus.get_interface() shortcut #128

Open yurac opened 1 year ago

yurac commented 1 year ago

Seems that the following pattern repeats frequently:

  1. Get introspection
  2. Get proxy object
  3. Get interface

Is it possible to have a shortcut for this? Something like:

Class MessageBus:
    async def get_interface(self, name, path, interface):                                                               
        introspection = await self.introspect(name, path)                                                                    
        proxy = bus.get_proxy_object(name, path, introspection)                                                             
        return proxy.get_interface(interface)

Thanks!