Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/287.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
使用twilio API在python中发送SMS时出错_Python_Python 3.x_Twilio_Twilio Api - Fatal编程技术网

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

使用twilio API在python中发送SMS时出错,python,python-3.x,twilio,twilio-api,Python,Python 3.x,Twilio,Twilio Api,我试图发送短信,但我收到了这个错误 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 tw

我试图发送短信,但我收到了这个错误

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)

请解决任何问题。

尝试从电话号码中删除国家/地区代码。上面说,
收件人号码+9183xxxxxxxx不是有效的电话号码。
阅读有关正确输入电话号码的文档您应该轮换身份验证令牌,因为您已公开共享该令牌。验证令牌以及如何更改它们(旋转凭据)