用于头和状态的标准http常量集
http-constants的Python项目详细描述
http常量
用于http状态和头的一组常量。
安装
可以从PyPI:
安装http常量pip install http-constants
python 3.7+支持这个库。
用法
标题
from http_constants.headers import HttpHeaders
HttpHeaders.ACCEPT
> 'Accept'
HttpHeaders.CONTENT_TYPE_VALUES.json
> 'application/json'
状态
from http_constants.status import HttpStatus
> HttpStatus.SERVICE_UNAVAILABLE
<HttpStatus.SERVICE_UNAVAILABLE: (503, 'Service Unavailable')>
HttpStatus.SERVICE_UNAVAILABLE.get_value()
> 503