How to use the appier.field 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_http.py View on Github external
__copyright__ = "Copyright (c) 2008-2019 Hive Solutions Lda."
""" The copyright for the module """

__license__ = "Apache License, Version 2.0"
""" The license for the module """

import json
import asyncio

import appier

import aiohttp

class Person(appier.Model):

    identifier = appier.field(
        type = int,
        index = True,
        increment = True,
        default = True
    )

    name = appier.field()

class AsyncHTTPApp(appier.App):

    def __init__(self, *args, **kwargs):
        appier.App.__init__(
            self,
            name = "async_neo",
            *args, **kwargs
        )
github hivesolutions / appier / examples / async / async_http.py View on Github external
import asyncio

import appier

import aiohttp

class Person(appier.Model):

    identifier = appier.field(
        type = int,
        index = True,
        increment = True,
        default = True
    )

    name = appier.field()

class AsyncHTTPApp(appier.App):

    def __init__(self, *args, **kwargs):
        appier.App.__init__(
            self,
            name = "async_neo",
            *args, **kwargs
        )
        self._register_model(Person)

    @appier.route("/async", "GET")
    @appier.route("/async/request", "GET")
    async def request_(self):
        url = self.field("url", "https://httpbin.bemisc.com/ip")
        size = self.field("size", 4096, cast = int)