我正在尝试使用我的Flask服务器接收来自Zap的帖子中的webhooks,但是当我测试时,我得到了一个500内部服务器错误。
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 2073, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1518, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1516, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1502, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
TypeError: receive_webhook() missing 1 required positional argument: 'request'下面是我的web钩子处理程序:
@app.route("/webhook", methods=['POST'])
def receive_webhook(request):
print(request.json)
return request.json这是我的Zap的截图,我想把这篇文章发到

谢谢你的帮助。
看来Zapier是在毫无争议的情况下调用我的处理程序。它不应该将有效载荷作为request参数传递,还是我在这里误解了什么?
编辑:而且,如果它是相关的,我使用Nginx和Gunicorn托管。在Ubuntu Linode上。
发布于 2022-02-24 18:43:22
我解决了问题。我不正确地使用了水瓶请求模块。这个密码让它起作用-
@app.route("/webhook", methods=['POST'])
def receive_webhook():
print(request.data)
return request.datahttps://stackoverflow.com/questions/71256337
复制相似问题