Python http.client 模块,parse_headers() 实例源码

我们从Python开源项目中,提取了以下7个代码示例,用于说明如何使用http.client.parse_headers()

项目:oa_qian    作者:sunqb    | 项目源码 | 文件源码
def headers_factory(fp, *args):
        try:
            ret = client.parse_headers(fp, _class=OldMessage)
        except client.LineTooLong:
            ret = OldMessage()
            ret.status = 'Line too long'
        return ret
项目:zippy    作者:securesystemslab    | 项目源码 | 文件源码
def get_headers_and_fp(self):
        f = io.BytesIO(self.sock.data)
        f.readline()  # read the request line
        message = client.parse_headers(f)
        return message, f
项目:web_ctp    作者:molebot    | 项目源码 | 文件源码
def get_headers_and_fp(self):
        f = io.BytesIO(self.sock.data)
        f.readline()  # read the request line
        message = client.parse_headers(f)
        return message, f
项目:ouroboros    作者:pybee    | 项目源码 | 文件源码
def test_all(self):
        # Documented objects defined in the module should be in __all__
        expected = {"responses"}  # White-list documented dict() object
        # HTTPMessage, parse_headers(), and the HTTP status code constants are
        # intentionally omitted for simplicity
        blacklist = {"HTTPMessage", "parse_headers"}
        for name in dir(client):
            if name in blacklist:
                continue
            module_object = getattr(client, name)
            if getattr(module_object, "__module__", None) == "http.client":
                expected.add(name)
        self.assertCountEqual(client.__all__, expected)
项目:ouroboros    作者:pybee    | 项目源码 | 文件源码
def get_headers_and_fp(self):
        f = io.BytesIO(self.sock.data)
        f.readline()  # read the request line
        message = client.parse_headers(f)
        return message, f
项目:kbe_server    作者:xiaohaoppy    | 项目源码 | 文件源码
def get_headers_and_fp(self):
        f = io.BytesIO(self.sock.data)
        f.readline()  # read the request line
        message = client.parse_headers(f)
        return message, f
项目:Lixiang_zhaoxin    作者:hejaxian    | 项目源码 | 文件源码
def headers_factory(fp, *args):
        try:
            ret = client.parse_headers(fp, _class=OldMessage)
        except client.LineTooLong:
            ret = OldMessage()
            ret.status = 'Line too long'
        return ret