【发布时间】:2021-07-05 10:52:47
【问题描述】:
我正在 Django 中设置我的 Braintree 网络挂钩,因为 Braintree docs 说我必须添加此方法
from flask import Flask, request, render_template, Response
...
def webhook():
webhook_notification = gateway.webhook_notification.parse(str(request.form['bt_signature']), request.form['bt_payload'])
# Example values for webhook notification properties
print(webhook_notification.kind)
print(webhook_notification.timestamp)
return Response(status=200)
一切正常,除了我不知道 gateway 是什么,而且我收到 undefined name error
我的 Django 代码
@csrf_exempt
def webhook(request):
print("post:: ", request.POST)
webhook_notification = gateway.webhook_notification.parse(str(request.form["bt_signature"]), request.form["bt_payload"])
print(webhook_notification.kind)
print(webhook_notification.timestamp)
return HttpResponse("Ok")
抱歉,如果遗漏了一些东西,我还没有尝试 flask。
【问题讨论】: