微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

使用twilio API在python中发送SMS时出错

如何解决使用twilio API在python中发送SMS时出错

我正在尝试发送短信,但出现此错误

raise self.exception(method,uri,response,'Unable to create record')
twilio.base.exceptions.TwilioRestException: HTTP 400 error: Unable to create record: The 'To' number +9183xxxxxxxx is not a valid phone number.

这是我的代码

import twilio
from twilio.rest import Client

def send_sms(msg,mobile):
    account_sid = "AC72f9bbb867b24cc2491ef2718269f143"
    auth_token = "**REDACTED**"

    client = Client(account_sid,auth_token)

    sms = client.messages.create(from_ = "+15304276284",body = msg,to = mobile)

    print("Sms Sent Successfully sms sid is: ",sms.sid)

send_sms("Hello I am from twilio",+9183xxxxxxxx)

解决任何人。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。