我尝试在google app引擎中实现以下代码。虽然我已经通过pip(版本:2.7)安装了twilio(版本:3.6),但我得到一个错误,说明模块twilio丢失了?为什么会这样?我该如何克服这个问题?
import webapp2
from twilio import twiml
from twilio.rest import TwilioRestClient
class SendSMS(webapp2.RequestHandler):
def get(self):
account_sid = "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx6bc"
auth_token = "xxxxx24f327xxxxxxxxxxxxxxxxxxxxx"
client = TwilioRestClient(account_sid, auth_token)
rv = client.sms.messages.create(to="91xxxxxxxxx",
from_="+1xxxxxxxxxxx",
body="Hello Monkey!")
self.response.write(str(rv))
app = webapp2.WSGIApplication([('/send_sms', SendSMS)],
debug=True)
错误我得到了:
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 84, in LoadObject
obj = __import__(path[0])
File "C:\Users\TOSHIBA pc\Documents\apps\main\main.py", line 2, in <module>
from twilio import twiml
ImportError: No module named twilio
INFO 2014-07-08 14:40:35,552 module.py:639] default: "GET / HTTP/1.1" 500 -
答案 0 :(得分:1)
通过Google应用引擎运行Twillio有点棘手。有关实施的详细信息,请访问:https://twilio-python.readthedocs.org/en/latest/appengine.html