我正在使用Flask和fbmq,此处的文档:https://github.com/conbus/fbmq, 我有正确的访问和验证代码,但仍然出现404 NOT FOUND错误。这是我的server.pt代码:
from flask import Flask, request
from fbmq import Page
app = Flask(__name__)
page = Page()
@app.route('/webhook', methods=['GET'])
def validate():
if request.args.get('hub.mode', '') == 'subscribe' and \
request.args.get('hub.verify_token', '') == '':
print("Validating webhook")
return request.args.get('hub.challenge', '')
else:
return 'Failed validation. Make sure the validation tokens match.'
@app.route('/webhook', methods=['POST'])
def webhook():
payload = request.get_data(as_text=True)
print(payload)
page.handle_webhook(payload)
return "ok"
if __name__ == '__main__':
app.run( port=5000, debug=True, threaded=True)
答案 0 :(得分:0)
我放弃了这个项目,但这可能是因为我没有在ngrok网址之后添加/ webhook /。(我知道,因为这解决了另一个项目中的问题)