提供附加实用程序的python标准库http.httpstatus的扩展。
pyhttpstatus-utils的Python项目详细描述
PyHttpStatus实用程序
python标准库http.HTTPStatus的扩展,提供http状态的映射。
安装
pip install pyhttpstatus-utils
功能
- create_http_status_dict(override_dict=None):创建http状态字典,如果提供了重写。
- get_http_status_desc(http_status_code):获取http状态代码描述。
- get_http_status_name(http_status_code):获取http状态代码名。
- get_http_status_phrase(http_status_code):获取http状态代码短语。
- get_http_status_type(http_status_code):获取http状态代码类型。
- is_http_status_successful(http_status_code):检查http状态代码类型是否成功
- is_http_status_type(http_status_code):如果提供的http状态代码是预期的http状态代码类型,则匹配。
- validate_http_code(http_code, minimum=100, maximum=599, strict=True, default_http_code=0):验证http代码。如果严格,抛出,否则只返回默认的http代码。
词典
- HTTP_STATUS_DICT:从http.HTTPStatus中提取,该字典包含每个http状态的名称、代码、短语和描述。
- HTTP_STATUS_PHRASE_DICT:http状态码的短语。
- HTTP_STATUS_DESC_DICT:http状态代码的描述。
- HTTP_STATUS_TYPE_DICT:http状态码的类型。
枚举类
- HttpStatusCode:http状态映射名称到代码的静态枚举
- HttpStatusType:到短语的http状态映射类型的静态枚举
- HttpStatusCodeType:http状态映射类型到代码的int枚举
http状态代码类型
- 100:httpstatustype.informational,
- 200:httpstatustype.successful,
- 300:httpstatustype.redirection,
- 400:httpstatustype.client_错误,
- 500:httpstatustype.server_错误
要求
pyhttpstatus-utils模块基于python 3构建,并且依赖于 Python Package Index PyPI中提供了几个python模块。
make install-requirements
或
python3 -m pip uninstall --yes --no-input -r requirements.txt python3 -m pip install --upgrade -r requirements.txt
发布历史
0.3.3(2018-02-20)
- 支持Python2.7
- travis ci同时测试python 2.7和3.6。
- 在Python2.7到Python3.4中支持的后台端口Python3.6http.httpstatus。
0.3.2(2018-02-16)
- 迁移到github/tunelab
0.3.1(2018-01-25)
- 迁移到github/tuneinc
0.2.2(2017-12-10)
- 阅读docs.org
0.2.0(2017-12-05)
- readme.rst
- 测试
- 特拉维斯ci
0.1.1(2016-11-22)
- makefile和yapf清除
0.1.0(2016-11-17)
- 初始代码
- 从tunelab/tune mv integration python中提取的代码
0.0.1(2016-11-17)
- 初始提交