我在twilio上创建了试用帐户,并使用安装了twilio
pip install twilio
在ubuntu 14.04 LTS上.
下面是我发送短信的python代码
from twilio.rest import TwilioRestClient account_sid = "MY TEST ACCOUNT SID" auth_token = "MY TEST ACCOUNT TOKEN" client = TwilioRestClient(account_sid, auth_token) print "running!!" sms = client.sms.messages.create(body="All in the game, yo", to="+91MYNUMBER", from_="+1MY_TWILIO_NUMBER") print sms.sid print sms.status
运行这个python文件时,我从twilio得到低于日志错误.
回溯(最近一次调用最后一次):文件"/home/software/ws/extra/scripts/test.py",第40行,来自_ ="+ 1MY_TWILIO_NUMBER")文件"/usr/local/lib/python2.7/ dist-packages/twilio/rest/resources/sms_messages.py",第167行,在create return self.create_instance(kwargs)File"/usr/local/lib/python2.7/dist-packages/twilio/rest/resources/ base.py",第365行,在create_instance data = transform_params(body)中)文件"/usr/local/lib/python2.7/dist-packages/twilio/rest/resources/base.py",第200行,请求中resp = make_twilio_request(方法,uri,auth = self.auth,**kwargs)文件"/usr/local/lib/python2.7/dist-packages/twilio/rest/resources/base.py",第164行,in make_twilio_request uri = resp.url,msg = message,code = code)twilio.rest.exceptions.TwilioRestException:HTTP 400错误:来自电话号码+ 1MY_TWILIO_NUMBER不是有效的,支持短信的入站电话号码或您帐户的短代码.
我检查了我的号码有语音,短信和彩信功能.
我在这里检查了这个错误.然后我尝试使用+15005550006号码,它正在运行,但我从未收到手机上的短信.消息进入队列,从不处理.
runnnign!! SM3f51b1c3e5ad43d38bd548cfada14175 queued
我错过了什么?为什么我没有收到短信?