示例#1
0
def echo_nested():
    args = {
        "name": fields.Nested({
            "first": fields.Str(),
            "last": fields.Str()
        })
    }
    return parser.parse(args)
def echo_nested():
    args = {
        'name': fields.Nested({
            'first': fields.Str(),
            'last': fields.Str()
        })
    }
    return parser.parse(args)
def echo_nested_many():
    args = {
        'users':
        fields.Nested({
            'id': fields.Int(),
            'name': fields.Str()
        }, many=True)
    }
    return parser.parse(args)
示例#4
0
def echo_nested_many():
    args = {
        "users":
        fields.Nested({
            "id": fields.Int(),
            "name": fields.Str()
        }, many=True)
    }
    return parser.parse(args)
示例#5
0
def echo_file():
    args = {"myfile": fields.Field()}
    result = parser.parse(args, locations=("files", ))
    myfile = result["myfile"]
    content = myfile.file.read().decode("utf8")
    return {"myfile": content}
示例#6
0
def echo_cookie():
    return parser.parse(hello_args, request, locations=("cookies", ))
def echo_file():
    args = {'myfile': fields.Field()}
    result = parser.parse(args, locations=('files', ))
    myfile = result['myfile']
    content = myfile.file.read().decode('utf8')
    return {'myfile': content}
示例#8
0
def error400():
    def always_fail(value):
        raise ValidationError("something went wrong", status_code=400)

    args = {"text": fields.Str(validate=always_fail)}
    return parser.parse(args)
示例#9
0
def echo_many_schema():
    arguments = parser.parse(hello_many_schema, request, locations=("json", ))
    return HTTPResponse(body=json.dumps(arguments),
                        content_type="application/json")
示例#10
0
def echo_query():
    return parser.parse(hello_args, request, locations=("query", ))
示例#11
0
def echo_json_or_form():
    return parser.parse(hello_args, location="json_or_form")
示例#12
0
def echo_json():
    return parser.parse(hello_args, location="json")
示例#13
0
def echo_form():
    return parser.parse(hello_args, location="form")
示例#14
0
def echo():
    return parser.parse(hello_args, request, location="query")
示例#15
0
def echo_headers():
    # the "exclude schema" must be used in this case because WSGI headers may
    # be populated with many fields not sent by the caller
    return parser.parse(hello_exclude_schema, request, location="headers")
示例#16
0
def echo_json_ignore_extra_data():
    return parser.parse(hello_exclude_schema)
示例#17
0
def echo():
    return parser.parse(hello_args, request)
示例#18
0
def echo_multi():
    return parser.parse(hello_multiple, request, location="query")
示例#19
0
def echo_multi():
    return parser.parse(hello_multiple, request)
示例#20
0
def multi_form():
    return parser.parse(hello_multiple, location="form")
示例#21
0
def always_error():
    def always_fail(value):
        raise ValidationError("something went wrong")

    args = {"text": fields.Str(validate=always_fail)}
    return parser.parse(args)
示例#22
0
def multi_json():
    return parser.parse(hello_multiple)
示例#23
0
def echo_headers():
    return parser.parse(hello_args, request, locations=("headers", ))
示例#24
0
def echo_json():
    return parser.parse(hello_args)