async def create_subscription(target): sub = Subscription() sub.installed_app_id = req.installed_app_id sub.location_id = req.location_id sub.source_type = SourceType.CAPABILITY sub.capability = target try: await api.create_subscription(sub) _LOGGER.debug("Created subscription for '%s' under app '%s'", target, req.installed_app_id) except Exception: # pylint:disable=broad-except _LOGGER.exception("Failed to create subscription for '%s' under " "app '%s'", target, req.installed_app_id)
async def create_subscription(target: str): sub = Subscription() sub.installed_app_id = installed_app_id sub.location_id = location_id sub.source_type = SourceType.CAPABILITY sub.capability = target try: await api.create_subscription(sub) _LOGGER.debug("Created subscription for '%s' under app '%s'", target, installed_app_id) except Exception: # pylint:disable=broad-except _LOGGER.exception("Failed to create subscription for '%s' under " "app '%s'", target, installed_app_id)
def _factory(capability): sub = Subscription() sub.capability = capability return sub
def _factory(capability): sub = Subscription() sub.capability = capability return sub