💻

[boto3] nextTokenの使い方

2024/11/29に公開

概要

nextToken の使い方をよく忘れるので備忘録

手順

_describe_metric_filters = []
next_token = None
while True:
  if next_token:
    results = logs_client.describe_metric_filters(nextToken=next_token)
  else:
    results = logs_client.describe_metric_filters()
  _describe_metric_filters.extend(results['metricFilters'])
  next_token = results.get('nextToken')
  if not next_token:
    break

Discussion