Comments (7)
Hi @delhi09, thanks for reaching out. Since you received a NextToken
, I suspect what's happening here is that pagination is taking place before filtering. You're using the --no-paginate
flag, so if your OPT_OUT
contact is not in the first page of results, getting no results back makes sense. If you remove that, or continue paginating, what's the response look like?
from aws-cli.
Hi @RyanFitzSimmonsAK , thank you for your suggestion. I tried it, but unfortunately, it didn't change the result.
$ aws sesv2 list-contacts --contact-list-name=TestContactList --filter="FilteredStatus=OPT_OUT,TopicFilter={TopicName=test-topic,UseDefaultIfPreferenceUnavailable=true}" --region us-east-1
{
"Contacts": [],
"NextToken": “xxx”
}
from aws-cli.
What if you continue to paginate using the NextToken
?
from aws-cli.
Hi @RyanFitzSimmonsAK , I apologize for the delay in my response. Thank you for your suggestion.
I tried pagination 10 times as follows. However, the "Contacts" field was empty in all results.
$ aws sesv2 list-contacts --contact-list-name=TestContactList --filter="FilteredStatus=OPT_OUT,TopicFilter={TopicName=test-topic,UseDefaultIfPreferenceUnavailable=true}" --region us-east-1
{
"Contacts": [],
"NextToken": "xxx"
}
$ aws sesv2 list-contacts --contact-list-name=TestContactList --filter="FilteredStatus=OPT_OUT,TopicFilter={TopicName=test-topic,UseDefaultIfPreferenceUnavailable=true}" --next-token xxx --region us-east-1
{
"Contacts": [],
"NextToken": "yyy"
}
$ aws sesv2 list-contacts --contact-list-name=TestContactList --filter="FilteredStatus=OPT_OUT,TopicFilter={TopicName=test-topic,UseDefaultIfPreferenceUnavailable=true}" --next-token yyy --region us-east-1
{
"Contacts": [],
"NextToken": "zzz"
}
from aws-cli.
Are you paginating until there isn't a NextToken
in the response?
from aws-cli.
Greetings! It looks like this issue hasn’t been active in longer than five days. We encourage you to check if this is still an issue in the latest release. In the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or upvote with a reaction on the initial post to prevent automatic closure. If the issue is already closed, please feel free to open a new one.
from aws-cli.
Hi @RyanFitzSimmonsAK , thank you for your suggestion. I created the following Python script and verified your suggestion.
import subprocess
import json
import time
request_count = 0
cmd = [
"aws",
"sesv2",
"list-contacts",
"--contact-list-name=TestContactList",
"--filter=FilteredStatus=OPT_OUT,TopicFilter={TopicName=test-topic,UseDefaultIfPreferenceUnavailable=true}",
"--region",
"us-east-1",
]
output = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
result = output.stdout.decode("utf-8")
next_token = json.loads(result)["NextToken"]
request_count += 1
while True:
time.sleep(5)
cmd = [
"aws",
"sesv2",
"list-contacts",
"--contact-list-name=TestContactList",
"--filter=FilteredStatus=OPT_OUT,TopicFilter={TopicName=test-topic,UseDefaultIfPreferenceUnavailable=true}",
"--region",
"us-east-1",
"--next-token",
next_token,
]
output = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
result = json.loads(output.stdout.decode("utf-8"))
next_token = result["NextToken"]
request_count += 1
print("request count: ", request_count, "contacts: ", result["Contacts"], "next_token: ", next_token[0:10])
if "NextToken" not in result or not result["NextToken"]:
break
print("finished. request count: ", request_count)
I aborted the script because it seemed like it was going to run indefinitely.
Generally, the results showed contacts are empty, but there were a few instances where email addresses were found on some pages. Could you please explain how this is supposed to work?
console log1
request count: 39 contacts: [] next_token: AYADeJxWUG
request count: 40 contacts: [] next_token: AYADeHByJv
request count: 41 contacts: [{'EmailAddress': '[email protected]', 'TopicPreferences': [{'TopicName': 'test-topic', 'SubscriptionStatus': 'OPT_OUT'}], 'UnsubscribeAll': False, 'LastUpdatedTimestamp': '2024-05-31T14:22:34.379000+09:00'}] next_token: AYADeJqWAX
request count: 42 contacts: [] next_token: AYADeCqJFg
request count: 43 contacts: [] next_token: AYADeDGpKA
console log2
request count: 86 contacts: [] next_token: AYADeH3wtH
request count: 87 contacts: [] next_token: AYADeEnwYs
request count: 88 contacts: [{'EmailAddress': '[email protected]', 'TopicPreferences': [{'TopicName': 'test-topic', 'SubscriptionStatus': 'OPT_OUT'}], 'UnsubscribeAll': False, 'LastUpdatedTimestamp': '2024-06-05T10:55:37.937000+09:00'}] next_token: AYADeOuiB1
request count: 89 contacts: [] next_token: AYADeNXxLv
request count: 90 contacts: [] next_token: AYADeA9Kbs
from aws-cli.
Related Issues (20)
- Support --sse-c for `s3 presign` command HOT 1
- AWS CLI v2.15.30 needs --policy-name as required argument instead of optional when performing `kms get-key-policy` HOT 2
- aws sso list-accounts --access-token "${access_token}" doesn't show accounts that are assigned via a Group HOT 8
- S3 path should be virtual-hosted–style HOT 1
- Step Functions `Label` property not supported HOT 4
- Support S3 transferring use "ProcessPoolExecutor" with s3tranfer HOT 2
- --add-resources does not exist in aws cloudformation create-generated-template command HOT 2
- Misleading instcutions in Documention for Create a template from scanned resources - Create a template from scanned resources (AWS CLI) HOT 2
- Segmentation fault on GitHub's `macos-14` runner HOT 3
- `aws dynamodb query` and `aws dynamodb scan` commands are missing docs for the `--limit` parameter HOT 6
- Cannot use credential_process on the default configuration HOT 6
- --endpoint-url does not accept IPv6 addresses HOT 8
- aws configure sso - filtering account list HOT 3
- See the structure of a returned item HOT 2
- aws_completer fails to complete sso profiles HOT 2
- Error installing from source when using python 3.12 HOT 2
- ec2 instance connect fails sporadically on WebSocket (NO_PROXY=1 does not help) HOT 5
- AWS_PROFILE is ignored when AWS_ROLE_ARN is set HOT 3
- unclear / misleading FAQ for s3 re: checksum HOT 5
- 1.34.7: sphinx no longer is able to build man pages HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aws-cli.