client.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:ZServer 作者: zopefoundation 项目源码 文件源码
def __snd_request(self, method, uri, headers={}, body='', eh=1):
        try:
            h = HTTP()
            h.connect(self.host, self.port)
            h.putrequest(method, uri)
            for n, v in headers.items():
                h.putheader(n, v)
            if eh:
                h.endheaders()
            if body:
                h.send(body)
            ver, code, msg, hdrs = h.getreply()
            data = h.getfile().read()
            h.close()
        except Exception:
            raise NotAvailable(sys.exc_value)
        return http_response(ver, code, msg, hdrs, data)

    # HTTP methods
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号