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)
def echo_nested_many(): args = { "users": fields.Nested({ "id": fields.Int(), "name": fields.Str() }, many=True) } return parser.parse(args)
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}
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}
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)
def echo_many_schema(): arguments = parser.parse(hello_many_schema, request, locations=("json", )) return HTTPResponse(body=json.dumps(arguments), content_type="application/json")
def echo_query(): return parser.parse(hello_args, request, locations=("query", ))
def echo_json_or_form(): return parser.parse(hello_args, location="json_or_form")
def echo_json(): return parser.parse(hello_args, location="json")
def echo_form(): return parser.parse(hello_args, location="form")
def echo(): return parser.parse(hello_args, request, location="query")
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")
def echo_json_ignore_extra_data(): return parser.parse(hello_exclude_schema)
def echo(): return parser.parse(hello_args, request)
def echo_multi(): return parser.parse(hello_multiple, request, location="query")
def echo_multi(): return parser.parse(hello_multiple, request)
def multi_form(): return parser.parse(hello_multiple, location="form")
def always_error(): def always_fail(value): raise ValidationError("something went wrong") args = {"text": fields.Str(validate=always_fail)} return parser.parse(args)
def multi_json(): return parser.parse(hello_multiple)
def echo_headers(): return parser.parse(hello_args, request, locations=("headers", ))
def echo_json(): return parser.parse(hello_args)