ancient.model
--- 存储模型的目录¶
response¶
-
class
ancient.model.response.
DateEncoder
(skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)[源代码]¶ 基类:
json.encoder.JSONEncoder
-
default
(obj)[源代码]¶ Implement this method in a subclass such that it returns a serializable object for
o
, or calls the base implementation (to raise aTypeError
).For example, to support arbitrary iterators, you could implement default like this:
def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) # Let the base class default method raise the TypeError return JSONEncoder.default(self, o)
-
-
class
ancient.model.response.
ResponseModel
[源代码]¶ 基类:
object
响应模型,通过实例化该类并调用该类的get方法获取返回的json格式数据 注意,采用ResponseModel类即意味着你将不遵循restful风格规范,而 采用madtornado风格的接口规范:
响应码:200[使用madtornado风格的接口规范,需保证任何状态http码都为200,通过返回数据的status进行状态标记] 返回类型示例:{"status": "fail", "description": "not found", "message": ""}