當前位置: 首頁>>代碼示例>>Python>>正文


Python httputil.parse_response_start_line方法代碼示例

本文整理匯總了Python中tornado.httputil.parse_response_start_line方法的典型用法代碼示例。如果您正苦於以下問題:Python httputil.parse_response_start_line方法的具體用法?Python httputil.parse_response_start_line怎麽用?Python httputil.parse_response_start_line使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在tornado.httputil的用法示例。


在下文中一共展示了httputil.parse_response_start_line方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _curl_header_callback

# 需要導入模塊: from tornado import httputil [as 別名]
# 或者: from tornado.httputil import parse_response_start_line [as 別名]
def _curl_header_callback(self, headers, header_callback, header_line):
        header_line = native_str(header_line)
        if header_callback is not None:
            self.io_loop.add_callback(header_callback, header_line)
        # header_line as returned by curl includes the end-of-line characters.
        # whitespace at the start should be preserved to allow multi-line headers
        header_line = header_line.rstrip()
        if header_line.startswith("HTTP/"):
            headers.clear()
            try:
                (__, __, reason) = httputil.parse_response_start_line(header_line)
                header_line = "X-Http-Reason: %s" % reason
            except httputil.HTTPInputError:
                return
        if not header_line:
            return
        headers.parse_line(header_line) 
開發者ID:tao12345666333,項目名稱:tornado-zh,代碼行數:19,代碼來源:curl_httpclient.py

示例2: _curl_header_callback

# 需要導入模塊: from tornado import httputil [as 別名]
# 或者: from tornado.httputil import parse_response_start_line [as 別名]
def _curl_header_callback(
        self,
        headers: httputil.HTTPHeaders,
        header_callback: Callable[[str], None],
        header_line_bytes: bytes,
    ) -> None:
        header_line = native_str(header_line_bytes.decode("latin1"))
        if header_callback is not None:
            self.io_loop.add_callback(header_callback, header_line)
        # header_line as returned by curl includes the end-of-line characters.
        # whitespace at the start should be preserved to allow multi-line headers
        header_line = header_line.rstrip()
        if header_line.startswith("HTTP/"):
            headers.clear()
            try:
                (__, __, reason) = httputil.parse_response_start_line(header_line)
                header_line = "X-Http-Reason: %s" % reason
            except httputil.HTTPInputError:
                return
        if not header_line:
            return
        headers.parse_line(header_line) 
開發者ID:opendevops-cn,項目名稱:opendevops,代碼行數:24,代碼來源:curl_httpclient.py

示例3: _curl_header_callback

# 需要導入模塊: from tornado import httputil [as 別名]
# 或者: from tornado.httputil import parse_response_start_line [as 別名]
def _curl_header_callback(self, headers, header_callback, header_line):
        header_line = native_str(header_line.decode('latin1'))
        if header_callback is not None:
            self.io_loop.add_callback(header_callback, header_line)
        # header_line as returned by curl includes the end-of-line characters.
        # whitespace at the start should be preserved to allow multi-line headers
        header_line = header_line.rstrip()
        if header_line.startswith("HTTP/"):
            headers.clear()
            try:
                (__, __, reason) = httputil.parse_response_start_line(header_line)
                header_line = "X-Http-Reason: %s" % reason
            except httputil.HTTPInputError:
                return
        if not header_line:
            return
        headers.parse_line(header_line) 
開發者ID:tp4a,項目名稱:teleport,代碼行數:19,代碼來源:curl_httpclient.py

示例4: header_callback

# 需要導入模塊: from tornado import httputil [as 別名]
# 或者: from tornado.httputil import parse_response_start_line [as 別名]
def header_callback(self, headers):
    # The header callback will be called multiple times, once for the initial
    # HTTP status line and once for each received header.
    header_lines = headers
    if self._response_status is None:
      status_line, _, header_lines = headers.partition('\r\n')
      self._response_status = httputil.parse_response_start_line(status_line)

    self._response_headers.update(httputil.HTTPHeaders.parse(header_lines)) 
開發者ID:googlecolab,項目名稱:jupyter_http_over_ws,代碼行數:11,代碼來源:handlers.py


注:本文中的tornado.httputil.parse_response_start_line方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。