Deleting multiple subscriptions
Now that Sam has a maturing notification system, she is learning that the types of alerts she sends do not bode well for text messaging.
SMS alerts are great if the user can react that minute, but "We are 500 potholes behind" is not something that a Council Member can jump up and fix.
She decides to remove all SMS subscribers from the streets_critical topic, but keep all email subscriptions.
She created the boto3 SNS client in the sns variable, and the streets_critical topic ARN is in the str_critical_arn variable.
In this exercise, you will help Sam remove all SMS subscribers and make this an email only alerting system.
Este ejercicio forma parte del curso
Introduction to AWS Boto in Python
Instrucciones del ejercicio
- List subscriptions for
'streets_critical'topic. - For each subscription, if the protocol is
'sms', unsubscribe. - List subscriptions for
'streets_critical'topic in one line. - Print the subscriptions
Ejercicio interactivo práctico
Prueba este ejercicio y completa el código de muestra.
# List subscriptions for streets_critical topic.
response = sns.____(
____ = str_critical_arn)
# For each subscription, if the protocol is SMS, unsubscribe
for sub in response['____']:
if sub['Protocol'] == 'sms':
sns.____(____=sub['SubscriptionArn'])
# List subscriptions for streets_critical topic in one line
subs = sns.list_subscriptions_by_topic(
____=str_critical_arn)['____']
# Print the subscriptions
print(subs)