perceval/backends/core/nntp.py
def fetch_items(self, category, **kwargs):
        """Fetch the articles

        :param category: the category of items to fetch
        :param kwargs: backend arguments

        :returns: a generator of items
        """
        offset = kwargs['offset']

        logger.info("Fetching articles of '%s' group on '%s' offset %s",
                    self.group, self.host, str(offset))

        narts, iarts, tarts = (0, 0, 0)

        _, _, first, last, _ = self.client.group(self.group)

        if offset <= last:
            first = max(first, offset)
            _, overview = self.client.over((first, last))
        else:
            overview = []

        tarts = len(overview)

        logger.debug("Total number of articles to fetch: %s", tarts)

        for article_id, _ in overview:
            try:
                article_raw = self.client.article(article_id)
                article = self.__parse_article(article_raw)
            except ParseError:
                logger.warning("Error parsing %s article; skipping",
                               article_id)
                iarts += 1
                continue
            except nntplib.NNTPTemporaryError as e:
                logger.warning("Error '%s' fetching article %s; skipping",
                               e.response, article_id)
                iarts += 1
                continue

            yield article
            narts += 1
def fetch_items(self, category, **kwargs):
        """Fetch the articles

        :param category: the category of items to fetch
        :param kwargs: backend arguments

        :returns: a generator of items
        """
        offset = kwargs['offset']

        logger.info("Fetching articles of '%s' group on '%s' offset %s",
                    self.group, self.host, str(offset))

        narts, iarts, tarts = (0, 0, 0)

        _, _, first, last, _ = self.client.group(self.group)

        if offset <= last:
            first = max(first, offset)
            _, overview = self.client.over((first, last))
        else:
            overview = []

        tarts = len(overview)

        logger.debug("Total number of articles to fetch: %s", tarts)

        for article_id, _ in overview:
            try:
                article_raw = self.client.article(article_id)
                article = self.__parse_article(article_raw)
            except ParseError:
                logger.warning("Error parsing %s article; skipping",
                               article_id)
                iarts += 1
                continue
            except nntplib.NNTPTemporaryError as e:
                logger.warning("Error '%s' fetching article %s; skipping",
                               e.response, article_id)
                iarts += 1
                continue

            yield article
            narts += 1
Fetch the articles

        :param category: the category of items to fetch
        :param kwargs: backend arguments

        :returns: a generator of items