(self, response, method, format=None)
return result
Parses the response according to the given (optional) format, which should be either 'JSON' or 'XML'.
Parses the response according to the given (optional) format, which should be either 'JSON' or 'XML'.
Parses the response according to the given ( optional ) format which should be either JSON or XML .
def _parse_response(self, response, method, format=None):
        """Parses the response according to the given (optional) format, which should be either 'JSON' or 'XML'."""
        if not format:
            format = RESPONSE_FORMAT

        if format == 'JSON':
            result = simplejson.loads(response)

            self._check_error(result)
        elif format == 'XML':
            dom = minidom.parseString(response)
            result = self._parse_response_item(dom)
            dom.unlink()

            if 'error_response' in result:
                self._check_error(result['error_response'])

            result = result[method[9:].replace('.', '_') + '_response']
        else:
            raise RuntimeError('Invalid format specified.')

        return result
def _parse_response ( self , response , method , format = None ) : if not format : format = RESPONSE_FORMAT if format == 'JSON' : result = simplejson . loads ( response ) self . _check_error ( result ) elif format == 'XML' : dom = minidom . parseString ( response ) result = self . _parse_response_item ( dom ) dom . unlink ( ) if 'error_response' in result : self . _check_error ( result [ 'error_response' ] ) result = result [ method [ 9 : ] . replace ( '.' , '_' ) + '_response' ] else : raise RuntimeError ( 'Invalid format specified.' ) return result