Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/298.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 获取boto3中失败短信的传递状态_Python_Amazon Web Services_Boto3_Amazon Sns - Fatal编程技术网

Python 获取boto3中失败短信的传递状态

Python 获取boto3中失败短信的传递状态,python,amazon-web-services,boto3,amazon-sns,Python,Amazon Web Services,Boto3,Amazon Sns,我正在尝试使用SNS服务发送短信 client = boto3.client('sns') response = client.publish(PhoneNumber='+12312312321', Message="Test message") 我得到了成功的回应 { "MessageId": "8fadd4b8-ee20-5d83-8f97-8cb3a18ea511", "ResponseMetadata

我正在尝试使用SNS服务发送短信

client = boto3.client('sns')
response = client.publish(PhoneNumber='+12312312321', Message="Test message")
我得到了成功的回应

{
    "MessageId": "8fadd4b8-ee20-5d83-8f97-8cb3a18ea511",
    "ResponseMetadata": {
        "RequestId": "d12548e6-ab8e-5115-95f4-11ede4207997",
        "HTTPStatusCode": 200,
        "HTTPHeaders": {
            "x-amzn-requestid": "d12548e6-ab9e-5105-95f4-11ede4207997",
            "content-type": "text/xml",
            "content-length": "294",
            "date": "Tue, 04 May 2021 13:34:38 GMT"
        },
        "RetryAttempts": 0
    }
}
但当我转到cloudwatch日志时,它的状态为
失败
,文本为:
帐户没有配额
。 有没有办法在代码中获取此错误,以便在无法发送SMS时实现自定义逻辑?

您看到了吗?