admin管理员组文章数量:1410689
I am trying to integrate Payfast on my flask application. The users are able to make payments but the ITN is not sent back. I always get the 307 Temporary Redirect response instead of 200 Ok. I am using flask so I have no idea why I always get this response.
In their documentation, they give a PHP example:
// Tell Payfast that this page is reachable by triggering a header 200
header('HTTP/1.0 200 OK');
flush();
I have tried everything like the following:
@orders.route('/status/notify', methods=['GET', 'POST'], strict_slashes=False)
def notify():
return 'Ok', 200
@orders.route('/status/notify', methods=['GET', 'POST'])
@orders.route('/status/notify/', methods=['GET', 'POST'])
def notify():
return 'Ok', 200
@orders.route('/status/notify', methods=['GET', 'POST'], strict_slashes=False)
def notify():
current_app.logger.debug("Request received:")
current_app.logger.debug(f"Method: {request.method}")
current_app.logger.debug(f"Headers: {request.headers}")
current_app.logger.debug(f"Data: {request.get_data()}")
current_app.logger.debug(f"URL: {request.url}")
pf_data = request.get_data()
response = Response('OK', status=200)
response.headers['Connection'] = 'close'
return 'Ok'
And none of these work, I always get the same response.
How would I prevent the auto redirection for this route?
本文标签: pythonHow to immediately sent 200 Ok response in FlaskStack Overflow
版权声明:本文标题:python - How to immediately sent 200 Ok response in Flask? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744808812a2626312.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论