'客户'对象没有属性'sms'

问题描述 投票:1回答:1

我是编程学生的介绍。以下代码应该向我的手机发送短信,但是它给了我错误信息:

'客户'对象没有属性'sms'

from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
auth_token = "42xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
client = Client(account_sid, auth_token)

message = client.sms.messages.create(
    body="Hello!",
    to="+19545555555", # Replace with your phone number
    from_="+17725555555") # Replace with your twilio number
print message.sid
python python-2.7
1个回答
0
投票
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
auth_token = "42xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
client = Client(account_sid, auth_token)

message = client.messages.create(
    body="Hello!",
    to="+19545555555", # Replace with your phone number
    from_="+17725555555") # Replace with your twilio number
print message.sid

试试这个。它不应该有sms

© www.soinside.com 2019 - 2024. All rights reserved.