(self, response)
Raising an exception makes the framework retry sending the message.
Raising an exception makes the framework retry sending the message.
Raising an exception makes the framework retry sending the message .
def handle_response(self, response):
        """
        Raising an exception makes the framework retry sending the message.
        """
        status_code = response.status_code
        response_text = response.text

        if status_code != 200:
            raise GrapevineException("Received status code %s" % status_code)

        try:
            root = ElementTree.fromstring(response_text)
        except (TypeError, ElementTree.ParseError):
            raise GrapevineException("Invalid XML returned from API")

        result_code = root.find('resultCode')
        if result_code is None:
            raise GrapevineException("resultCode tag not found in XML response")

        if result_code.text != '0':
            raise GrapevineException("Received non-zero result code: %s" % result_code.text)
def handle_response ( self , response ) : status_code = response . status_code response_text = response . text if status_code != 200 : raise GrapevineException ( "Received status code %s" % status_code ) try : root = ElementTree . fromstring ( response_text ) except ( TypeError , ElementTree . ParseError ) : raise GrapevineException ( "Invalid XML returned from API" ) result_code = root . find ( 'resultCode' ) if result_code is None : raise GrapevineException ( "resultCode tag not found in XML response" ) if result_code . text != '0' : raise GrapevineException ( "Received non-zero result code: %s" % result_code . text )