【发布时间】:2020-10-09 08:54:41
【问题描述】:
我可以使用 MessagingResponse 发送位置吗?
当我尝试以下方法时,我得到 AttributeError: 'Message' 对象没有属性 'persistent_action'
from flask import Flask, request
import requests
from twilio.twiml.messaging_response import MessagingResponse
app = Flask(__name__)
@app.route('/bot', methods=['POST'])
def bot():
resp = MessagingResponse()
msg = resp.message()
if request.values.get('Latitude'):
lat = request.values.get('Latitude')
long = request.values.get('Longitude')
location = 'geo:'+lat+','+long
loc = [location]
msg.persistent_action(loc)
return str(resp)
if __name__ == '__main__':
app.run()
【问题讨论】:
-
您能否确认您的 Twilio Helper Library 的版本是 6.33.1 或更高版本? github.com/twilio/twilio-python/blob/main/…,
pip show twilio. -
版本:6.45.4
-
有什么方法可以发送位置吗?