hug 目前提供三种接口:

  • 本地函数调用
  • 命令行 : 基于 标准库Argparse
  • http server 基于: Falcon

字段验证:

  • 采用python3函数参数注释方式验证
  • 一个验证要么验证通过返回验证后的值, 要么抛出异常

路由:

指令:

这个指令有点魔法,可以改变默认参数的值

分开成多个文件

@hug.extend_api('/something')

测试API:

def tests_happy_birthday():
    response = hug.test.get(happy_birthday, 'happy_birthday', {'name': 'Timothy', 'age': 25})
    assert response.status == HTTP_200
    assert response.data is not None

标签: none

添加新评论