perceval/backends/core/askbot.py
def get_api_questions(self, path):
        """Retrieve a question page using the API.

        :param page: page to retrieve
        """
        npages = 1
        next_request = True

        path = urijoin(self.base_url, path)
        while next_request:

            try:
                params = {
                    'page': npages,
                    'sort': self.ORDER_API
                }

                response = self.fetch(path, payload=params)

                whole_page = response.text

                raw_questions = json.loads(whole_page)
                tpages = raw_questions['pages']

                logger.debug("Fetching questions from '%s': page %s/%s",
                             self.base_url, npages, tpages)

                if npages == tpages:
                    next_request = False

                npages = npages + 1
                yield raw_questions

            except requests.exceptions.TooManyRedirects as e:
                logger.warning("%s, data not retrieved for resource %s", e, path)
                next_request = False
def get_api_questions(self, path):
        npages = 1
        next_request = True

        path = urijoin(self.base_url, path)
        while next_request:

            try:
                params = {
                    'page': npages,
                    'sort': self.ORDER_API
                }

                response = self.fetch(path, payload=params)

                whole_page = response.text

                raw_questions = json.loads(whole_page)
                tpages = raw_questions['pages']

                logger.debug("Fetching questions from '%s': page %s/%s",
                             self.base_url, npages, tpages)

                if npages == tpages:
                    next_request = False

                npages = npages + 1
                yield raw_questions

            except requests.exceptions.TooManyRedirects as e:
                logger.warning("%s, data not retrieved for resource %s", e, path)
                next_request = False
def get_api_questions ( self , path ) : npages = 1 next_request = True path = urijoin ( self . base_url , path ) while next_request : try : params = { 'page' : npages , 'sort' : self . ORDER_API } response = self . fetch ( path , payload = params ) whole_page = response . text raw_questions = json . loads ( whole_page ) tpages = raw_questions [ 'pages' ] logger . debug ( "Fetching questions from '%s': page %s/%s" , self . base_url , npages , tpages ) if npages == tpages : next_request = False npages = npages + 1 yield raw_questions except requests . exceptions . TooManyRedirects as e : logger . warning ( "%s, data not retrieved for resource %s" , e , path ) next_request = False
Retrieve a question page using the API.

        :param page: page to retrieve
Retrieve a question page using the API .