Python 使用标记/分页从boto3返回整个dms数据

Python 使用标记/分页从boto3返回整个dms数据,python,amazon-web-services,boto3,Python,Amazon Web Services,Boto3,Boto3 lib允许检索AWS服务的各种元数据。有些方法使用分页标记来获取整个数据 我在检索我帐户下所有DMS任务的列表时遇到问题。如何通过重试标记在一次运行中获取数据 import boto3 import sys dms = boto3.client('dms') replication_tasks = dms.describe_replication_tasks( MaxRecords=100, Marker='', WithoutSettings=True)

Boto3 lib允许检索AWS服务的各种元数据。有些方法使用分页标记来获取整个数据

我在检索我帐户下所有DMS任务的列表时遇到问题。如何通过重试标记在一次运行中获取数据

import boto3
import sys

dms = boto3.client('dms')
replication_tasks = dms.describe_replication_tasks(
    MaxRecords=100,
    Marker='',
    WithoutSettings=True) 

dictr = replication_tasks['ReplicationTasks'][0]
lst = replication_tasks['ReplicationTasks']
marker = replication_tasks['Marker']
if marker:
    print(lst)
    next_set = dms.describe_replication_tasks(MaxRecords=100, Marker=marker, WithoutSettings=True)
    lst.append(next_set)
print(lst)

我会这样假设

import boto3

client = boto3.client('dms')

paginator = client.get_paginator('describe_replication_tasks')

response_iterator = paginator.paginate(
    WithoutSettings=True,
)

for response in response_iterator:
    print(response)