Boto3 Inspector v2 list_findings' nextToken 初始值是多少?

What is Boto3 Inspector v2 list_findings' nextToken initial value?

我正在使用 boto3 Python 列出 Inspector v2 的发现,在循环中使用 list_findings() 方法,根据 AWS Boto3 Inspector2 Docs 我必须设置此值对于列表操作的第一个请求,参数为 null 但在变量 next_token:

的所有这些情况下不断出现错误

这是我的代码:

import boto3
inspector = boto3.client("inspector2")
next_token = "" # I change the value of this variable 
while True:
    response = inspector.list_findings(
            filterCriteria={
                'findingStatus': [
                    {
                        'comparison': 'EQUALS',
                        'value': 'ACTIVE'
                    },
                ],
                'findingType': [
                    {
                        'comparison': 'EQUALS',
                        'value': 'PACKAGE_VULNERABILITY'
                    },
                ],
            },
        nextToken=next_token
    )
    next_token= response.get("nextToken") 
    
    # Some Code Here 
    
    if next_token == None:
        break

我对第一个请求的 nextToken 值应该是多少感到困惑?

使用起来会更方便paginate as explained in AWS docs:

# Create a client
inspector = boto3.client("inspector2")

# Create a reusable Paginator
paginator = inspector.get_paginator('list_findings')

# Create a PageIterator from the Paginator
page_iterator = paginator.paginate(filterCriteria={
                'findingStatus': [
                    {
                        'comparison': 'EQUALS',
                        'value': 'ACTIVE'
                    },
                ],
                'findingType': [
                    {
                        'comparison': 'EQUALS',
                        'value': 'PACKAGE_VULNERABILITY'
                    },
                ],
            })

for page in page_iterator:
    print(page)