当前位置: 首页>>代码示例>>Python>>正文


Python HTTPStatus.HTTP_VERSION_NOT_SUPPORTED属性代码示例

本文整理汇总了Python中http.HTTPStatus.HTTP_VERSION_NOT_SUPPORTED属性的典型用法代码示例。如果您正苦于以下问题:Python HTTPStatus.HTTP_VERSION_NOT_SUPPORTED属性的具体用法?Python HTTPStatus.HTTP_VERSION_NOT_SUPPORTED怎么用?Python HTTPStatus.HTTP_VERSION_NOT_SUPPORTED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在http.HTTPStatus的用法示例。


在下文中一共展示了HTTPStatus.HTTP_VERSION_NOT_SUPPORTED属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_version_invalid

# 需要导入模块: from http import HTTPStatus [as 别名]
# 或者: from http.HTTPStatus import HTTP_VERSION_NOT_SUPPORTED [as 别名]
def test_version_invalid(self):
        self.con._http_vsn = 99
        self.con._http_vsn_str = 'HTTP/9.9'
        self.con.putrequest('GET', '/')
        self.con.endheaders()
        res = self.con.getresponse()
        self.assertEqual(res.status, HTTPStatus.HTTP_VERSION_NOT_SUPPORTED) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:9,代码来源:test_httpservers.py

示例2: test_http_status_to_canonical_code

# 需要导入模块: from http import HTTPStatus [as 别名]
# 或者: from http.HTTPStatus import HTTP_VERSION_NOT_SUPPORTED [as 别名]
def test_http_status_to_canonical_code(self):
        for status_code, expected in (
            (HTTPStatus.OK, StatusCanonicalCode.OK),
            (HTTPStatus.ACCEPTED, StatusCanonicalCode.OK),
            (HTTPStatus.IM_USED, StatusCanonicalCode.OK),
            (HTTPStatus.MULTIPLE_CHOICES, StatusCanonicalCode.OK),
            (HTTPStatus.BAD_REQUEST, StatusCanonicalCode.INVALID_ARGUMENT),
            (HTTPStatus.UNAUTHORIZED, StatusCanonicalCode.UNAUTHENTICATED),
            (HTTPStatus.FORBIDDEN, StatusCanonicalCode.PERMISSION_DENIED),
            (HTTPStatus.NOT_FOUND, StatusCanonicalCode.NOT_FOUND),
            (
                HTTPStatus.UNPROCESSABLE_ENTITY,
                StatusCanonicalCode.INVALID_ARGUMENT,
            ),
            (
                HTTPStatus.TOO_MANY_REQUESTS,
                StatusCanonicalCode.RESOURCE_EXHAUSTED,
            ),
            (HTTPStatus.NOT_IMPLEMENTED, StatusCanonicalCode.UNIMPLEMENTED),
            (HTTPStatus.SERVICE_UNAVAILABLE, StatusCanonicalCode.UNAVAILABLE),
            (
                HTTPStatus.GATEWAY_TIMEOUT,
                StatusCanonicalCode.DEADLINE_EXCEEDED,
            ),
            (
                HTTPStatus.HTTP_VERSION_NOT_SUPPORTED,
                StatusCanonicalCode.INTERNAL,
            ),
            (600, StatusCanonicalCode.UNKNOWN),
            (99, StatusCanonicalCode.UNKNOWN),
        ):
            with self.subTest(status_code=status_code):
                actual = http_status_to_canonical_code(int(status_code))
                self.assertEqual(actual, expected, status_code) 
开发者ID:open-telemetry,项目名称:opentelemetry-python,代码行数:36,代码来源:test_utils.py


注:本文中的http.HTTPStatus.HTTP_VERSION_NOT_SUPPORTED属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。