我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用httplib.ImproperConnectionState()。
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