SNSClient#
Auto-generated documentation for SNS type annotations stubs module mypy-boto3-sns.
SNSClient#
Type annotations and code completion for boto3.client("sns")
.
boto3 documentation
# SNSClient usage example
from boto3.session import Session
from mypy_boto3_sns.client import SNSClient
def get_sns_client() -> SNSClient:
return Session().client("sns")
Exceptions#
boto3
client exceptions are generated in runtime.
This class provides code completion for boto3.client("sns").exceptions
structure.
# Exceptions.exceptions usage example
client = boto3.client("sns")
try:
do_something(client)
except (
client.exceptions.AuthorizationErrorException,
client.exceptions.BatchEntryIdsNotDistinctException,
client.exceptions.BatchRequestTooLongException,
client.exceptions.ClientError,
client.exceptions.ConcurrentAccessException,
client.exceptions.EmptyBatchRequestException,
client.exceptions.EndpointDisabledException,
client.exceptions.FilterPolicyLimitExceededException,
client.exceptions.InternalErrorException,
client.exceptions.InvalidBatchEntryIdException,
client.exceptions.InvalidParameterException,
client.exceptions.InvalidParameterValueException,
client.exceptions.InvalidSecurityException,
client.exceptions.KMSAccessDeniedException,
client.exceptions.KMSDisabledException,
client.exceptions.KMSInvalidStateException,
client.exceptions.KMSNotFoundException,
client.exceptions.KMSOptInRequired,
client.exceptions.KMSThrottlingException,
client.exceptions.NotFoundException,
client.exceptions.OptedOutException,
client.exceptions.PlatformApplicationDisabledException,
client.exceptions.ResourceNotFoundException,
client.exceptions.StaleTagException,
client.exceptions.SubscriptionLimitExceededException,
client.exceptions.TagLimitExceededException,
client.exceptions.TagPolicyException,
client.exceptions.ThrottledException,
client.exceptions.TooManyEntriesInBatchRequestException,
client.exceptions.TopicLimitExceededException,
client.exceptions.UserErrorException,
client.exceptions.ValidationException,
client.exceptions.VerificationException,
) as e:
print(e)
# Exceptions.exceptions type checking example
from mypy_boto3_sns.client import Exceptions
def handle_error(exc: Exceptions.AuthorizationErrorException) -> None:
...
Methods#
add_permission#
Adds a statement to a topic's access control policy, granting access for the specified Amazon Web Services accounts to the specified actions.
Type annotations and code completion for boto3.client("sns").add_permission
method.
boto3 documentation
# add_permission method definition
def add_permission(
self,
*,
TopicArn: str,
Label: str,
AWSAccountId: Sequence[str],
ActionName: Sequence[str],
) -> EmptyResponseMetadataTypeDef: # (1)
...
# add_permission method usage example with argument unpacking
kwargs: AddPermissionInputRequestTypeDef = { # (1)
"TopicArn": ...,
"Label": ...,
"AWSAccountId": ...,
"ActionName": ...,
}
parent.add_permission(**kwargs)
can_paginate#
Check if an operation can be paginated.
Type annotations and code completion for boto3.client("sns").can_paginate
method.
boto3 documentation
# can_paginate method definition
def can_paginate(
self,
operation_name: str,
) -> bool:
...
check_if_phone_number_is_opted_out#
Accepts a phone number and indicates whether the phone holder has opted out of receiving SMS messages from your Amazon Web Services account.
Type annotations and code completion for boto3.client("sns").check_if_phone_number_is_opted_out
method.
boto3 documentation
# check_if_phone_number_is_opted_out method definition
def check_if_phone_number_is_opted_out(
self,
*,
phoneNumber: str,
) -> CheckIfPhoneNumberIsOptedOutResponseTypeDef: # (1)
...
# check_if_phone_number_is_opted_out method usage example with argument unpacking
kwargs: CheckIfPhoneNumberIsOptedOutInputRequestTypeDef = { # (1)
"phoneNumber": ...,
}
parent.check_if_phone_number_is_opted_out(**kwargs)
close#
Closes underlying endpoint connections.
Type annotations and code completion for boto3.client("sns").close
method.
boto3 documentation
# close method definition
def close(
self,
) -> None:
...
confirm_subscription#
Verifies an endpoint owner's intent to receive messages by validating the token
sent to the endpoint by an earlier Subscribe
action.
Type annotations and code completion for boto3.client("sns").confirm_subscription
method.
boto3 documentation
# confirm_subscription method definition
def confirm_subscription(
self,
*,
TopicArn: str,
Token: str,
AuthenticateOnUnsubscribe: str = ...,
) -> ConfirmSubscriptionResponseTypeDef: # (1)
...
# confirm_subscription method usage example with argument unpacking
kwargs: ConfirmSubscriptionInputRequestTypeDef = { # (1)
"TopicArn": ...,
"Token": ...,
}
parent.confirm_subscription(**kwargs)
create_platform_application#
Creates a platform application object for one of the supported push notification services, such as APNS and GCM (Firebase Cloud Messaging), to which devices and mobile apps may register.
Type annotations and code completion for boto3.client("sns").create_platform_application
method.
boto3 documentation
# create_platform_application method definition
def create_platform_application(
self,
*,
Name: str,
Platform: str,
Attributes: Mapping[str, str],
) -> CreatePlatformApplicationResponseTypeDef: # (1)
...
# create_platform_application method usage example with argument unpacking
kwargs: CreatePlatformApplicationInputRequestTypeDef = { # (1)
"Name": ...,
"Platform": ...,
"Attributes": ...,
}
parent.create_platform_application(**kwargs)
create_platform_endpoint#
Creates an endpoint for a device and mobile app on one of the supported push notification services, such as GCM (Firebase Cloud Messaging) and APNS.
Type annotations and code completion for boto3.client("sns").create_platform_endpoint
method.
boto3 documentation
# create_platform_endpoint method definition
def create_platform_endpoint(
self,
*,
PlatformApplicationArn: str,
Token: str,
CustomUserData: str = ...,
Attributes: Mapping[str, str] = ...,
) -> CreateEndpointResponseTypeDef: # (1)
...
# create_platform_endpoint method usage example with argument unpacking
kwargs: CreatePlatformEndpointInputRequestTypeDef = { # (1)
"PlatformApplicationArn": ...,
"Token": ...,
}
parent.create_platform_endpoint(**kwargs)
create_sms_sandbox_phone_number#
Adds a destination phone number to an Amazon Web Services account in the SMS sandbox and sends a one-time password (OTP) to that phone number.
Type annotations and code completion for boto3.client("sns").create_sms_sandbox_phone_number
method.
boto3 documentation
# create_sms_sandbox_phone_number method definition
def create_sms_sandbox_phone_number(
self,
*,
PhoneNumber: str,
LanguageCode: LanguageCodeStringType = ..., # (1)
) -> Dict[str, Any]:
...
# create_sms_sandbox_phone_number method usage example with argument unpacking
kwargs: CreateSMSSandboxPhoneNumberInputRequestTypeDef = { # (1)
"PhoneNumber": ...,
}
parent.create_sms_sandbox_phone_number(**kwargs)
create_topic#
Creates a topic to which notifications can be published.
Type annotations and code completion for boto3.client("sns").create_topic
method.
boto3 documentation
# create_topic method definition
def create_topic(
self,
*,
Name: str,
Attributes: Mapping[str, str] = ...,
Tags: Sequence[TagTypeDef] = ..., # (1)
DataProtectionPolicy: str = ...,
) -> CreateTopicResponseTypeDef: # (2)
...
- See TagTypeDef
- See CreateTopicResponseTypeDef
# create_topic method usage example with argument unpacking
kwargs: CreateTopicInputRequestTypeDef = { # (1)
"Name": ...,
}
parent.create_topic(**kwargs)
delete_endpoint#
Deletes the endpoint for a device and mobile app from Amazon SNS.
Type annotations and code completion for boto3.client("sns").delete_endpoint
method.
boto3 documentation
# delete_endpoint method definition
def delete_endpoint(
self,
*,
EndpointArn: str,
) -> EmptyResponseMetadataTypeDef: # (1)
...
# delete_endpoint method usage example with argument unpacking
kwargs: DeleteEndpointInputRequestTypeDef = { # (1)
"EndpointArn": ...,
}
parent.delete_endpoint(**kwargs)
delete_platform_application#
Deletes a platform application object for one of the supported push notification services, such as APNS and GCM (Firebase Cloud Messaging).
Type annotations and code completion for boto3.client("sns").delete_platform_application
method.
boto3 documentation
# delete_platform_application method definition
def delete_platform_application(
self,
*,
PlatformApplicationArn: str,
) -> EmptyResponseMetadataTypeDef: # (1)
...
# delete_platform_application method usage example with argument unpacking
kwargs: DeletePlatformApplicationInputRequestTypeDef = { # (1)
"PlatformApplicationArn": ...,
}
parent.delete_platform_application(**kwargs)
delete_sms_sandbox_phone_number#
Deletes an Amazon Web Services account's verified or pending phone number from the SMS sandbox.
Type annotations and code completion for boto3.client("sns").delete_sms_sandbox_phone_number
method.
boto3 documentation
# delete_sms_sandbox_phone_number method definition
def delete_sms_sandbox_phone_number(
self,
*,
PhoneNumber: str,
) -> Dict[str, Any]:
...
# delete_sms_sandbox_phone_number method usage example with argument unpacking
kwargs: DeleteSMSSandboxPhoneNumberInputRequestTypeDef = { # (1)
"PhoneNumber": ...,
}
parent.delete_sms_sandbox_phone_number(**kwargs)
delete_topic#
Deletes a topic and all its subscriptions.
Type annotations and code completion for boto3.client("sns").delete_topic
method.
boto3 documentation
# delete_topic method definition
def delete_topic(
self,
*,
TopicArn: str,
) -> EmptyResponseMetadataTypeDef: # (1)
...
# delete_topic method usage example with argument unpacking
kwargs: DeleteTopicInputRequestTypeDef = { # (1)
"TopicArn": ...,
}
parent.delete_topic(**kwargs)
generate_presigned_url#
Generate a presigned url given a client, its method, and arguments.
Type annotations and code completion for boto3.client("sns").generate_presigned_url
method.
boto3 documentation
# generate_presigned_url method definition
def generate_presigned_url(
self,
ClientMethod: str,
Params: Mapping[str, Any] = ...,
ExpiresIn: int = 3600,
HttpMethod: str = ...,
) -> str:
...
get_data_protection_policy#
Retrieves the specified inline DataProtectionPolicy
document that is stored
in the specified Amazon SNS
topic.
Type annotations and code completion for boto3.client("sns").get_data_protection_policy
method.
boto3 documentation
# get_data_protection_policy method definition
def get_data_protection_policy(
self,
*,
ResourceArn: str,
) -> GetDataProtectionPolicyResponseTypeDef: # (1)
...
# get_data_protection_policy method usage example with argument unpacking
kwargs: GetDataProtectionPolicyInputRequestTypeDef = { # (1)
"ResourceArn": ...,
}
parent.get_data_protection_policy(**kwargs)
get_endpoint_attributes#
Retrieves the endpoint attributes for a device on one of the supported push notification services, such as GCM (Firebase Cloud Messaging) and APNS.
Type annotations and code completion for boto3.client("sns").get_endpoint_attributes
method.
boto3 documentation
# get_endpoint_attributes method definition
def get_endpoint_attributes(
self,
*,
EndpointArn: str,
) -> GetEndpointAttributesResponseTypeDef: # (1)
...
# get_endpoint_attributes method usage example with argument unpacking
kwargs: GetEndpointAttributesInputRequestTypeDef = { # (1)
"EndpointArn": ...,
}
parent.get_endpoint_attributes(**kwargs)
get_platform_application_attributes#
Retrieves the attributes of the platform application object for the supported push notification services, such as APNS and GCM (Firebase Cloud Messaging).
Type annotations and code completion for boto3.client("sns").get_platform_application_attributes
method.
boto3 documentation
# get_platform_application_attributes method definition
def get_platform_application_attributes(
self,
*,
PlatformApplicationArn: str,
) -> GetPlatformApplicationAttributesResponseTypeDef: # (1)
...
# get_platform_application_attributes method usage example with argument unpacking
kwargs: GetPlatformApplicationAttributesInputRequestTypeDef = { # (1)
"PlatformApplicationArn": ...,
}
parent.get_platform_application_attributes(**kwargs)
get_sms_attributes#
Returns the settings for sending SMS messages from your Amazon Web Services account.
Type annotations and code completion for boto3.client("sns").get_sms_attributes
method.
boto3 documentation
# get_sms_attributes method definition
def get_sms_attributes(
self,
*,
attributes: Sequence[str] = ...,
) -> GetSMSAttributesResponseTypeDef: # (1)
...
# get_sms_attributes method usage example with argument unpacking
kwargs: GetSMSAttributesInputRequestTypeDef = { # (1)
"attributes": ...,
}
parent.get_sms_attributes(**kwargs)
get_sms_sandbox_account_status#
Retrieves the SMS sandbox status for the calling Amazon Web Services account in the target Amazon Web Services Region.
Type annotations and code completion for boto3.client("sns").get_sms_sandbox_account_status
method.
boto3 documentation
# get_sms_sandbox_account_status method definition
def get_sms_sandbox_account_status(
self,
) -> GetSMSSandboxAccountStatusResultTypeDef: # (1)
...
get_subscription_attributes#
Returns all of the properties of a subscription.
Type annotations and code completion for boto3.client("sns").get_subscription_attributes
method.
boto3 documentation
# get_subscription_attributes method definition
def get_subscription_attributes(
self,
*,
SubscriptionArn: str,
) -> GetSubscriptionAttributesResponseTypeDef: # (1)
...
# get_subscription_attributes method usage example with argument unpacking
kwargs: GetSubscriptionAttributesInputRequestTypeDef = { # (1)
"SubscriptionArn": ...,
}
parent.get_subscription_attributes(**kwargs)
get_topic_attributes#
Returns all of the properties of a topic.
Type annotations and code completion for boto3.client("sns").get_topic_attributes
method.
boto3 documentation
# get_topic_attributes method definition
def get_topic_attributes(
self,
*,
TopicArn: str,
) -> GetTopicAttributesResponseTypeDef: # (1)
...
# get_topic_attributes method usage example with argument unpacking
kwargs: GetTopicAttributesInputRequestTypeDef = { # (1)
"TopicArn": ...,
}
parent.get_topic_attributes(**kwargs)
list_endpoints_by_platform_application#
Lists the endpoints and endpoint attributes for devices in a supported push notification service, such as GCM (Firebase Cloud Messaging) and APNS.
Type annotations and code completion for boto3.client("sns").list_endpoints_by_platform_application
method.
boto3 documentation
# list_endpoints_by_platform_application method definition
def list_endpoints_by_platform_application(
self,
*,
PlatformApplicationArn: str,
NextToken: str = ...,
) -> ListEndpointsByPlatformApplicationResponseTypeDef: # (1)
...
# list_endpoints_by_platform_application method usage example with argument unpacking
kwargs: ListEndpointsByPlatformApplicationInputRequestTypeDef = { # (1)
"PlatformApplicationArn": ...,
}
parent.list_endpoints_by_platform_application(**kwargs)
list_origination_numbers#
Lists the calling Amazon Web Services account's dedicated origination numbers and their metadata.
Type annotations and code completion for boto3.client("sns").list_origination_numbers
method.
boto3 documentation
# list_origination_numbers method definition
def list_origination_numbers(
self,
*,
NextToken: str = ...,
MaxResults: int = ...,
) -> ListOriginationNumbersResultTypeDef: # (1)
...
# list_origination_numbers method usage example with argument unpacking
kwargs: ListOriginationNumbersRequestRequestTypeDef = { # (1)
"NextToken": ...,
}
parent.list_origination_numbers(**kwargs)
list_phone_numbers_opted_out#
Returns a list of phone numbers that are opted out, meaning you cannot send SMS messages to them.
Type annotations and code completion for boto3.client("sns").list_phone_numbers_opted_out
method.
boto3 documentation
# list_phone_numbers_opted_out method definition
def list_phone_numbers_opted_out(
self,
*,
nextToken: str = ...,
) -> ListPhoneNumbersOptedOutResponseTypeDef: # (1)
...
# list_phone_numbers_opted_out method usage example with argument unpacking
kwargs: ListPhoneNumbersOptedOutInputRequestTypeDef = { # (1)
"nextToken": ...,
}
parent.list_phone_numbers_opted_out(**kwargs)
list_platform_applications#
Lists the platform application objects for the supported push notification services, such as APNS and GCM (Firebase Cloud Messaging).
Type annotations and code completion for boto3.client("sns").list_platform_applications
method.
boto3 documentation
# list_platform_applications method definition
def list_platform_applications(
self,
*,
NextToken: str = ...,
) -> ListPlatformApplicationsResponseTypeDef: # (1)
...
# list_platform_applications method usage example with argument unpacking
kwargs: ListPlatformApplicationsInputRequestTypeDef = { # (1)
"NextToken": ...,
}
parent.list_platform_applications(**kwargs)
list_sms_sandbox_phone_numbers#
Lists the calling Amazon Web Services account's current verified and pending destination phone numbers in the SMS sandbox.
Type annotations and code completion for boto3.client("sns").list_sms_sandbox_phone_numbers
method.
boto3 documentation
# list_sms_sandbox_phone_numbers method definition
def list_sms_sandbox_phone_numbers(
self,
*,
NextToken: str = ...,
MaxResults: int = ...,
) -> ListSMSSandboxPhoneNumbersResultTypeDef: # (1)
...
# list_sms_sandbox_phone_numbers method usage example with argument unpacking
kwargs: ListSMSSandboxPhoneNumbersInputRequestTypeDef = { # (1)
"NextToken": ...,
}
parent.list_sms_sandbox_phone_numbers(**kwargs)
list_subscriptions#
Returns a list of the requester's subscriptions.
Type annotations and code completion for boto3.client("sns").list_subscriptions
method.
boto3 documentation
# list_subscriptions method definition
def list_subscriptions(
self,
*,
NextToken: str = ...,
) -> ListSubscriptionsResponseTypeDef: # (1)
...
# list_subscriptions method usage example with argument unpacking
kwargs: ListSubscriptionsInputRequestTypeDef = { # (1)
"NextToken": ...,
}
parent.list_subscriptions(**kwargs)
list_subscriptions_by_topic#
Returns a list of the subscriptions to a specific topic.
Type annotations and code completion for boto3.client("sns").list_subscriptions_by_topic
method.
boto3 documentation
# list_subscriptions_by_topic method definition
def list_subscriptions_by_topic(
self,
*,
TopicArn: str,
NextToken: str = ...,
) -> ListSubscriptionsByTopicResponseTypeDef: # (1)
...
# list_subscriptions_by_topic method usage example with argument unpacking
kwargs: ListSubscriptionsByTopicInputRequestTypeDef = { # (1)
"TopicArn": ...,
}
parent.list_subscriptions_by_topic(**kwargs)
list_tags_for_resource#
List all tags added to the specified Amazon SNS topic.
Type annotations and code completion for boto3.client("sns").list_tags_for_resource
method.
boto3 documentation
# list_tags_for_resource method definition
def list_tags_for_resource(
self,
*,
ResourceArn: str,
) -> ListTagsForResourceResponseTypeDef: # (1)
...
# list_tags_for_resource method usage example with argument unpacking
kwargs: ListTagsForResourceRequestRequestTyp