in dataplex-quickstart-labs/00-resources/scripts/python/business-glossary-import/bg_import/glossary.py [0:0]
def _populate_caches(self):
"""Populates internal caches of terms and categories existing in the target glossary."""
endpoint = f'{self._glossary_endpoint}/entries?view=FULL'
keep_reading, page_token = True, None
while keep_reading:
if page_token:
endpoint_url = f'{endpoint}&pageToken={page_token}'
else:
endpoint_url = endpoint
response = api_call_utils.fetch_api_response(
requests.get, endpoint_url, self._config.project_id
)
if response['error_msg']:
logger.error(response['error_msg'])
return
if 'entries' not in response['json']:
return
# Check if we need to read another page
page_token = response['json'].get('nextPageToken', None)
if not page_token:
keep_reading = False
self._populate_term_cache(response)
self._populate_category_cache(response)