def _fetch(self, resource, params):
url = urijoin(self.base_url, '<STR_LIT>', resource)<EOL>do_fetch = True<EOL>while do_fetch:<EOL><INDENT>logger.debug("<STR_LIT>",<EOL>resource, str(params))<EOL>r = self.fetch(url, payload=params)<EOL>yield r.text<EOL>json_data = r.json()<EOL>if '<STR_LIT>' in json_data:<EOL><INDENT>next_url = json_data['<STR_LIT>']['<STR_LIT>']<EOL>if next_url:<EOL><INDENT>url = urijoin(self.base_url, next_url)<EOL>params = {}<EOL><DEDENT>else:<EOL><INDENT>do_fetch = False<EOL><DEDENT><DEDENT>else:<EOL><INDENT>do_fetch = False<EOL><DEDENT><DEDENT>
Fetch a resource.

        Method to fetch and to iterate over the contents of a
        type of resource. The method returns a generator of
        pages for that resource and parameters.

        :param resource: type of the resource
        :param params: parameters to filter

        :returns: a generator of pages for the requested resource