Skip to content

Instantly share code, notes, and snippets.

@markymarkus
Created December 1, 2022 08:26
Show Gist options
  • Save markymarkus/ecfa43722f730684c41ec48eb035d6ff to your computer and use it in GitHub Desktop.
Save markymarkus/ecfa43722f730684c41ec48eb035d6ff to your computer and use it in GitHub Desktop.
NextToken python loop
response = client.list_suppressed_destinations(Reasons=['BOUNCE'], PageSize=50)
addresses = response['SuppressedDestinationSummaries']
while "NextToken" in response:
response = client.list_suppressed_destinations(NextToken=response["NextToken"], Reasons=['BOUNCE'],PageSize=50)
addresses.extend(response['SuppressedDestinationSummaries'])
print(len(addresses))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment