예제 #1
0
 async def get(self, request, args):
     return J(args)
예제 #2
0
 async def get(self, request, name: str = "World"):
     return J({"name": name})
예제 #3
0
async def echo_cookie(request):
    return J(await parser.parse(hello_args, request, location="cookies"))
예제 #4
0
async def echo_path_param(request):
    parsed = await parser.parse({"path_param": fields.Int()},
                                request,
                                location="path_params")
    return J(parsed)
예제 #5
0
async def echo_headers(request):
    # the "exclude schema" must be used in this case because WSGI headers may
    # be populated with many fields not sent by the caller
    return J(await parser.parse(hello_exclude_schema,
                                request,
                                location="headers"))
예제 #6
0
async def error(request):
    def always_fail(value):
        raise ma.ValidationError("something went wrong")

    args = {"text": fields.Str(validate=always_fail)}
    return J(await parser.parse(args, request))
예제 #7
0
async def echo_use_kwargs_with_path(request, value):
    return J({"value": value})
예제 #8
0
async def echo_use_args_with_path(request, args):
    return J(args)
예제 #9
0
async def many_nested(request):
    arguments = await parser.parse(hello_many_schema, request, location="json")
    return J(arguments)