Accepts a phone number and indicates whether the phone holder has opted out of receiving SMS messages from your Amazon Web Services account. You cannot send SMS messages to a number that is opted out.
To resume sending messages, you can opt in the number by using the OptInPhoneNumber action.
Parameters:
-
phone_number
(PhoneNumber)
–
The phone number for which you want to check the opt out status.
Raises:
Source code in docs_src/capo_sns/_services/async_sns.py
| async def check_if_phone_number_is_opted_out(
self,
phone_number: "capo_sns.types.phone_number.PhoneNumber",
*,
config_overrides: Optional[AsyncSNSClientConfig] = None,
) -> "capo_sns.types.check_if_phone_number_is_opted_out_response.CheckIfPhoneNumberIsOptedOutResponse":
"""<p>Accepts a phone number and indicates whether the phone holder has opted out of receiving SMS messages from your Amazon Web Services account. You cannot send SMS messages to a number that is opted out.</p> <p>To resume sending messages, you can opt in the number by using the <code>OptInPhoneNumber</code> action.</p>
Args:
phone_number: <p>The phone number for which you want to check the opt out status.</p>
Raises:
capo_sns.errors.authorization_error_exception.AuthorizationErrorException: <p>Indicates that the user has been denied access to the requested resource.</p>
capo_sns.errors.internal_error_exception.InternalErrorException: <p>Indicates an internal service error.</p>
capo_sns.errors.invalid_parameter_exception.InvalidParameterException: <p>Indicates that a request parameter does not comply with the associated constraints.</p>
capo_sns.errors.throttled_exception.ThrottledException: <p>Indicates that the rate at which requests have been submitted for this action exceeds the limit for your Amazon Web Services account.</p>
capo_sns.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_sns.types.check_if_phone_number_is_opted_out_input.CheckIfPhoneNumberIsOptedOutInput]",
) -> AsyncOperationResponse[
"capo_sns.types.check_if_phone_number_is_opted_out_response.CheckIfPhoneNumberIsOptedOutResponse"
]:
import capo_sns._operations.amazon_simple_notification_service.check_if_phone_number_is_opted_out
(
output,
http_response,
) = await capo_sns._operations.amazon_simple_notification_service.check_if_phone_number_is_opted_out.async_check_if_phone_number_is_opted_out(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
def _redact_input(
input_: "capo_sns.types.check_if_phone_number_is_opted_out_input.CheckIfPhoneNumberIsOptedOutInput",
) -> dict[str, Any]:
import capo_sns.types.check_if_phone_number_is_opted_out_input
return capo_sns.types.check_if_phone_number_is_opted_out_input.redact_sensitive(
input_
)
interceptors_, options_ = self.operation_options(
config_overrides,
OperationLogging(
"CheckIfPhoneNumberIsOptedOut", redact_input=_redact_input
),
)
input_: capo_sns.types.check_if_phone_number_is_opted_out_input.CheckIfPhoneNumberIsOptedOutInput = {
"phone_number": phone_number
}
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|