Python httplib 模块,ImproperConnectionState() 实例源码

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

项目:dac    作者:jlonij    | 项目源码 | 文件源码
def _post(self, url, body, headers):
        _headers = self.auth_headers.copy()
        _headers.update(headers)
        attempts = self.max_retries + 1
        while attempts > 0:
            try:
                self.conn.request('POST', url, body.encode('UTF-8'), _headers)
                return check_response_status(self.conn.getresponse())
            except (socket.error,
                    httplib.ImproperConnectionState,
                    httplib.BadStatusLine):
                    # We include BadStatusLine as they are spurious
                    # and may randomly happen on an otherwise fine
                    # Solr connection (though not often)
                self._reconnect()
                attempts -= 1
                if attempts <= 0:
                    raise