【发布时间】:2014-10-02 01:04:31
【问题描述】:
我在使用 Twilio API 时遇到了一些问题。我尝试获取已发送、排队、失败或其他状态的短信状态,但在 Rest API 中找不到此方法。
我使用 Python 和 Django。
def send_sms(self, msg):
ACCOUNT_SID = self.profile.twilio_sid
AUTH_TOKEN = self.profile.twilio_auth_token
client_phone_number = self.profile.phone_number
twilio_phone_number = "+1"+str(self.profile.twilio_number)
client = TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN)
message = client.messages.create(
body=msg,
to=client_phone_number,
from_=twilio_phone_number,
)
sid = message.sid
那么我怎样才能通过我所拥有的 sid 获得短信状态?如果可能,不进行响应处理
我找到了答案。我需要的所有内容都添加到我的代码中
body = client.messages.get(sid)
status =body.status
【问题讨论】:
标签: python sms response twilio status