in templates/python/facebook_business/api.py [0:0]
def load_next_page(self):
"""Queries server for more nodes and loads them into the internal queue.
Returns:
True if successful, else False.
"""
if self._finished_iteration:
return False
if (
self._include_summary and
'default_summary' not in self.params and
'summary' not in self.params
):
self.params['summary'] = True
response_obj = self._api.call(
'GET',
self._path,
params=self.params,
)
response = response_obj.json()
self._headers = response_obj.headers()
if 'paging' in response and 'next' in response['paging']:
self._path = response['paging']['next']
self.params = {}
else:
# Indicate if this was the last page
self._finished_iteration = True
if (
self._include_summary and
'summary' in response and
'total_count' in response['summary']
):
self._total_count = response['summary']['total_count']
if self._include_summary and 'summary' in response:
self._summary = response['summary']
self._queue = self.build_objects_from_response(response)
return len(self._queue) > 0