(self)
return response
Get the response from the server.
Get the response from the server.
Get the response from the server .
def getresponse(self):
        "Get the response from the server."

        # check if a prior response has been completed
        if self.__response and self.__response.isclosed():
            self.__response = None

        #
        # if a prior response exists, then it must be completed (otherwise, we
        # cannot read this response's header to determine the connection-close
        # behavior)
        #
        # note: if a prior response existed, but was connection-close, then the
        # socket and response were made independent of this HTTPConnection
        # object since a new request requires that we open a whole new
        # connection
        #
        # this means the prior response had one of two states:
        #   1) will_close: this connection was reset and the prior socket and
        #                  response operate independently
        #   2) persistent: the response was retained and we await its
        #                  isclosed() status to become true.
        #
        if self.__state != _CS_REQ_SENT or self.__response:
            raise ResponseNotReady()

        if self.debuglevel > 0:
            response = self.response_class(self.sock, self.debuglevel)
        else:
            response = self.response_class(self.sock)
        
        # The only modification compared to the stock HTTPConnection
        if self._cb_callback:
            response.set_callback(self._cb_rs, self._cb_ws, self._cb_ex,
                self._cb_user_data, self._cb_callback)

        response.begin()
        assert response.will_close != httplib._UNKNOWN
        self.__state = _CS_IDLE

        if response.will_close:
            # this effectively passes the connection to the response
            self.close()
        else:
            # remember this, so we can tell when it is complete
            self.__response = response

        return response
def getresponse ( self ) : # check if a prior response has been completed if self . __response and self . __response . isclosed ( ) : self . __response = None # # if a prior response exists, then it must be completed (otherwise, we # cannot read this response's header to determine the connection-close # behavior) # # note: if a prior response existed, but was connection-close, then the # socket and response were made independent of this HTTPConnection # object since a new request requires that we open a whole new # connection # # this means the prior response had one of two states: #   1) will_close: this connection was reset and the prior socket and #                  response operate independently #   2) persistent: the response was retained and we await its #                  isclosed() status to become true. # if self . __state != _CS_REQ_SENT or self . __response : raise ResponseNotReady ( ) if self . debuglevel > 0 : response = self . response_class ( self . sock , self . debuglevel ) else : response = self . response_class ( self . sock ) # The only modification compared to the stock HTTPConnection if self . _cb_callback : response . set_callback ( self . _cb_rs , self . _cb_ws , self . _cb_ex , self . _cb_user_data , self . _cb_callback ) response . begin ( ) assert response . will_close != httplib . _UNKNOWN self . __state = _CS_IDLE if response . will_close : # this effectively passes the connection to the response self . close ( ) else : # remember this, so we can tell when it is complete self . __response = response return response