def async_file(self): file_path = self.field("path", None) thread = self.field("thread", False, cast=bool) type, _encoding = mimetypes.guess_type(file_path, strict=True) type = type or "application/octet-stream" self.request.content_type = type yield -1 yield appier.ensure_async(self.read_file, args=[file_path], thread=thread)
def callable(self): yield -1 yield "before\n" yield appier.ensure_async(lambda: time.sleep(30.0)) yield "after\n"
def hello(self): yield -1 yield "before\n" yield appier.ensure_async(self.handler) yield "after\n"