streaminghttp.py 文件源码

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

项目:true_review 作者: lucadealfaro 项目源码 文件源码
def http_request(self, req):
        """Handle a HTTP request.  Make sure that Content-Length is specified
        if we're using an interable value"""
        # Make sure that if we're using an iterable object as the request
        # body, that we've also specified Content-Length
        if req.has_data():
            data = req.get_data()
            if hasattr(data, 'read') or hasattr(data, 'next'):
                if not req.has_header('Content-length'):
                    raise ValueError(
                            "No Content-Length specified for iterable body")
        return urllib2.HTTPHandler.do_request_(self, req)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号