def RequestPassphrase(self, network: 'o') -> 's': net = self._iwctl._get_network_from_dbus_path(network) if net is None: raise DBusError('net.connman.iwd.Agent.Error.Canceled', 'Unknown this network') LOGGER.debug("Found network: %s", net.name) net_config = self._iwctl.get_network_config_from_net(net) if net_config is None: raise DBusError('net.connman.iwd.Agent.Error.Canceled', 'Unknown psk for this net') return net_config.psk
async def agent_request_input(bus: BaseMessageBus, impl: ConnmanAgent, service, fields): introspection = await bus.introspect("net.connman", service) proxy = bus.get_proxy_object("net.connman", service, introspection) iface = proxy.get_interface("net.connman.Service") props = await iface.call_get_properties() svc = model.create_service_from_props(service, props) plain_fields = unpack_variants(fields, "a{sv}") try: res = await impl.request_input(svc, plain_fields) except Canceled as e: raise DBusError("net.connman.Agent.Error.Canceled", str(e)) varres = {k: Variant("s", v) for k, v in res.items() if v is not None} return varres
async def request_input( self, service: "o", fields: "a{sv}", # type: ignore ) -> "a{sv}": # type: ignore """This method gets called when trying to connect to a service and some extra input is required. For example a passphrase or the name of a hidden network. The return value should be a dictionary where the keys are the field names and the values are the actual fields. Alternatively an error indicating that the request got canceled can be returned. OperationAborted will be return on a successful cancel request. Most common return field names are "Name" and of course "Passphrase". The dictionary arguments contains field names with their input parameters. In case of WISPr credentials requests and if the user prefers to login through the browser by himself, agent will have to return a LaunchBrowser error (see below). Possible Errors: net.connman.Agent.Error.Canceled net.connman.Agent.Error.LaunchBrowser """ # Fetch the service properties introspection = await self._bus.introspect("net.connman", service) proxy = self._bus.get_proxy_object("net.connman", service, introspection) iface = proxy.get_interface("net.connman.Service") props = await iface.call_get_properties() svc = model.create_service_from_props(service, props) plain_fields = unpack_variants(fields, "a{sv}") print("REQUEST INPUT", svc, plain_fields) try: res = await self._impl.request_input(svc, plain_fields) except Canceled as e: raise DBusError("net.connman.Agent.Error.Canceled", str(e)) varres = {k: Variant("s", v) for k, v in res.items()} return varres
def RequestUserPassword(self, network: 'o', user: '******') -> 's': raise DBusError('net.connman.iwd.Agent.Error.Canceled', 'NotImplemented: RequestUserPassword')
def RequestPrivateKeyPassphrase(self, network: 'o') -> 's': raise DBusError('net.connman.iwd.Agent.Error.Canceled', 'NotImplemented: RequestPrivateKeyPassphrase')
def throws_error(self, val: 's'): raise DBusError('test.error', 'told you so')
def throws_error(self) -> 's': raise DBusError('test.error', 'told you so')
def ErrorThrowingProperty(self, val: 's'): raise DBusError(self.error_name, self.error_text)
def ErrorThrowingProperty(self) -> 's': raise DBusError(self.error_name, self.error_text)
def ThrowsError(self): raise DBusError('test.error', 'something went wrong')
def throws_dbus_error(self): assert type(self) is ExampleInterface raise DBusError('test.error', 'an error ocurred')