def batch(self, num):
"""
Iterator returning results in batches. When making more general queries
that might have larger results, specify a batch result that should be
returned with each iteration.
:param int num: number of results per iteration
:return: iterator holding list of results
"""
self._params.pop('limit', None) # Limit and batch are mutually exclusive
it = iter(self)
while True:
chunk = list(islice(it, num))
if not chunk:
return
yield chunk
评论列表
文章目录