def _paged_api_call(self, func, kwargs, item_type='<STR_LIT>'):
page = <NUM_LIT:1><EOL>while True:<EOL><INDENT>LOG.info("<STR_LIT>" % page)<EOL>kwargs['<STR_LIT>'] = page<EOL>rsp = self._load_rsp(func(**kwargs))<EOL>if rsp["<STR_LIT>"] == "<STR_LIT>":<EOL><INDENT>plural = item_type + '<STR_LIT:s>'<EOL>if plural in rsp:<EOL><INDENT>items = rsp[plural]<EOL>if int(items["<STR_LIT>"]) < page:<EOL><INDENT>LOG.info("<STR_LIT>" % (items["<STR_LIT>"], items["<STR_LIT>"]))<EOL>break<EOL><DEDENT>for i in items[item_type]:<EOL><INDENT>yield self._prep(i)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>yield rsp<EOL><DEDENT>page += <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>yield [rsp]<EOL>break<EOL><DEDENT><DEDENT>
Takes a Flickr API function object and dict of keyword args and calls the
API call repeatedly with an incrementing page value until all contents are exhausted.
Flickr seems to limit to about 500 items.