Twilio - Python:来自Udacity教程的NameError

时间:2015-07-21 17:52:51

标签: python sms twilio

希望我可以获得有关此错误意味着什么以及我必须采取哪些措施来修复它的信息。感谢。

这是出现的错误:

Traceback (most recent call last):
  File "/Users/davidongchoco/Desktop/Python Programming/send_text.py", line 11, in <module>
    from_="+13348331130") # Replace with your Twilio number
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/twilio/rest/resources/sms_messages.py", line 167, in create
    return self.create_instance(kwargs)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/twilio/rest/resources/base.py", line 365, in create_instance
    data=transform_params(body))
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/twilio/rest/resources/base.py", line 200, in request
    resp = make_twilio_request(method, uri, auth=self.auth, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/twilio/rest/resources/base.py", line 164, in make_twilio_request
    uri=resp.url, msg=message, code=code)
TwilioRestException: 
[31m[49mHTTP Error[0m [37m[49mYour request was:[0m

[36m[49mPOST https://api.twilio.com/2010-04-01/Accounts/ACf37c4004688accd3f501ab2a2c9dc7e1/SMS/Messages.json[0m

[37m[49mTwilio returned the following information:[0m

[34m[49mPermission to send an SMS has not been enabled for the region indicated by the 'To' number: +639228902063.[0m

[37m[49mMore information may be available here:[0m

[34m[49mhttps://www.twilio.com/docs/errors/21408[0m


>>> 

1 个答案:

答案 0 :(得分:1)

Twilio开发者传道者在这里。

该错误向您发送了一条信息:

  

尚未针对“收件人”号码所指示的区域启用发送短信的权限:+639228902063。

     

此处可提供更多信息:

     

https://www.twilio.com/docs/errors/21408

如果您关注该链接,则会告诉您需要为您的帐户启用一些全局权限。您可以在此处执行此操作:https://www.twilio.com/user/account/settings/international/sms

看起来您正试图从菲律宾发送一个号码,因此请确保勾选复选框。

Udacity课程祝你好运!