當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。