def _query(self, ResponseGroup="Large", **kwargs):
        """Query.

        Query Amazon search and check for errors.

        :return:
            An lxml root element.
        """
        response = self.api.ItemSearch(ResponseGroup=ResponseGroup, **kwargs)
        root = objectify.fromstring(response)
        if (hasattr(root.Items.Request, 'Errors') and
                not hasattr(root.Items, 'Item')):
            code = root.Items.Request.Errors.Error.Code
            msg = root.Items.Request.Errors.Error.Message
            if code == 'AWS.ParameterOutOfRange':
                raise NoMorePages(msg)
            elif code == 'HTTP Error 503':
                raise RequestThrottled(
                    "Request Throttled Error: '{0}', '{1}'".format(code, msg))
            else:
                raise SearchException(
                    "Amazon Search Error: '{0}', '{1}'".format(code, msg))
        if hasattr(root.Items, 'TotalPages'):
            if root.Items.TotalPages == self.current_page:
                self.is_last_page = True
        return root
def _query ( self , ResponseGroup = "Large" , ** kwargs ) : response = self . api . ItemSearch ( ResponseGroup = ResponseGroup , ** kwargs ) root = objectify . fromstring ( response ) if ( hasattr ( root . Items . Request , 'Errors' ) and not hasattr ( root . Items , 'Item' ) ) : code = root . Items . Request . Errors . Error . Code msg = root . Items . Request . Errors . Error . Message if code == 'AWS.ParameterOutOfRange' : raise NoMorePages ( msg ) elif code == 'HTTP Error 503' : raise RequestThrottled ( "Request Throttled Error: '{0}', '{1}'" . format ( code , msg ) ) else : raise SearchException ( "Amazon Search Error: '{0}', '{1}'" . format ( code , msg ) ) if hasattr ( root . Items , 'TotalPages' ) : if root . Items . TotalPages == self . current_page : self . is_last_page = True return root
Query.

        Query Amazon search and check for errors.

        :return:
            An lxml root element.