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


Python client.BadStatusLine方法代码示例

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


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

示例1: request

# 需要导入模块: from future.backports.http import client [as 别名]
# 或者: from future.backports.http.client import BadStatusLine [as 别名]
def request(self, host, handler, request_body, verbose=False):
        #retry request once if cached connection has gone cold
        for i in (0, 1):
            try:
                return self.single_request(host, handler, request_body, verbose)
            except socket.error as e:
                if i or e.errno not in (errno.ECONNRESET, errno.ECONNABORTED, errno.EPIPE):
                    raise
            except http_client.BadStatusLine: #close after we sent request
                if i:
                    raise 
开发者ID:Soft8Soft,项目名称:verge3d-blender-addon,代码行数:13,代码来源:client.py

示例2: test_status_lines

# 需要导入模块: from future.backports.http import client [as 别名]
# 或者: from future.backports.http.client import BadStatusLine [as 别名]
def test_status_lines(self):
        # Test HTTP status lines

        body = "HTTP/1.1 200 Ok\r\n\r\nText"
        sock = FakeSocket(body)
        resp = client.HTTPResponse(sock)
        resp.begin()
        self.assertEqual(resp.read(), b'Text')
        self.assertTrue(resp.isclosed())

        body = "HTTP/1.1 400.100 Not Ok\r\n\r\nText"
        sock = FakeSocket(body)
        resp = client.HTTPResponse(sock)
        self.assertRaises(client.BadStatusLine, resp.begin) 
开发者ID:hughperkins,项目名称:kgsgo-dataset-preprocessor,代码行数:16,代码来源:test_httplib.py

示例3: test_bad_status_repr

# 需要导入模块: from future.backports.http import client [as 别名]
# 或者: from future.backports.http.client import BadStatusLine [as 别名]
def test_bad_status_repr(self):
        exc = client.BadStatusLine('')
        if not utils.PY3:
            self.assertEqual(repr(exc), '''BadStatusLine("u\'\'",)''')
        else:
            self.assertEqual(repr(exc), '''BadStatusLine("\'\'",)''') 
开发者ID:hughperkins,项目名称:kgsgo-dataset-preprocessor,代码行数:8,代码来源:test_httplib.py

示例4: test_overflowing_status_line

# 需要导入模块: from future.backports.http import client [as 别名]
# 或者: from future.backports.http.client import BadStatusLine [as 别名]
def test_overflowing_status_line(self):
        self.skipTest("disabled for HTTP 0.9 support")
        body = "HTTP/1.1 200 Ok" + "k" * 65536 + "\r\n"
        resp = client.HTTPResponse(FakeSocket(body))
        self.assertRaises((client.LineTooLong, client.BadStatusLine), resp.begin) 
开发者ID:hughperkins,项目名称:kgsgo-dataset-preprocessor,代码行数:7,代码来源:test_httplib.py


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