我正在使用Facebook聊天机器人。我知道有类似问题的帖子,但我无法使它生效。
下面是我的代码:
from __future__ import print_function
import sys
from flask import Flask, request, app
API_ROOT = '/webhook'
app = Flask(__name__)
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
@app.route(API_ROOT, methods=['POST'])
def fb_receive_message():
eprint('message received')
if __name__ == '__main__':
eprint('Hello world!')
app.run(host='XXX.XXX.XXX.XXX',debug=True,port=XXX)
结果:
Hello world!
* Restarting with stat
当我尝试使用“ post”时,它不会打印任何内容