How to use the appier.header_a function in appier

To help you get started, we’ve selected a few appier examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hivesolutions / appier / examples / async / async.py View on Github external
def hello(self):
        partial = self.field("partial", True, cast = bool)
        handler = self.handler_partial if partial else self.handler
        yield from appier.header_a()
        yield "before\n"
        yield from handler()
        yield "after\n"
github hivesolutions / appier / examples / async / async.py View on Github external
def http(self):
        url = self.field("url", "https://www.flickr.com/")
        delay = self.field("delay", 0.0, cast = float)
        self.request.content_type = "text/html"
        yield from appier.header_a()
        yield from appier.sleep(delay)
        yield (yield from appier.get_a(url))
github hivesolutions / appier / examples / async / async_old.py View on Github external
def file(self):
        file_path = self.field("path", None, mandatory = True)
        delay = self.field("delay", 0.0, cast = float)
        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
        for value in appier.header_a(): yield value
        for value in appier.ensure_a(
            self.read_file,
            args = [file_path],
            kwargs = dict(delay = delay),
            thread = thread
        ): yield value
github hivesolutions / appier / examples / async / async_old.py View on Github external
def http(self):
        url = self.field("url", "https://www.flickr.com/")
        delay = self.field("delay", 0.0, cast = float)
        self.request.content_type = "text/html"
        for value in appier.header_a(): yield value
        for value in appier.sleep(delay): yield value
        for value in appier.get_a(url):
            yield value
            yield value.result()
github hivesolutions / appier / examples / async / async.py View on Github external
def callable(self):
        sleep = self.field("sleep", 3.0, cast = float)
        yield from appier.header_a()
        yield "before\n"
        yield from appier.ensure_a(lambda: time.sleep(sleep))
        yield "after\n"
github hivesolutions / appier / examples / async / async_old.py View on Github external
def callable(self):
        sleep = self.field("sleep", 3.0, cast = float)
        for value in appier.header_a(): yield value
        yield "before\n"
        for value in appier.ensure_a(lambda: time.sleep(sleep)): yield value
        yield "after\n"
github hivesolutions / appier / examples / hello / hello_async.py View on Github external
async def hello_template_async(self):
        await appier.header_a()
        yield await self.template_async(
            "hello.txt",
            message = "hello world"
        )
github hivesolutions / appier / examples / async / async.py View on Github external
def file(self):
        file_path = self.field("path", None, mandatory = True)
        delay = self.field("delay", 0.0, cast = float)
        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 from appier.header_a()
        yield from appier.ensure_a(
            self.read_file,
            args = [file_path],
            kwargs = dict(delay = delay),
            thread = thread
        )