当前位置: 首页>>代码示例>>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;未经允许,请勿转载。