Python 如何在after_请求中捕获瓶装响应中的JSON?
我想用Bootle Py记录所有web服务响应。 最好的方法是什么 我正在使用以下代码写入MongoDB数据库:Python 如何在after_请求中捕获瓶装响应中的JSON?,python,bottle,Python,Bottle,我想用Bootle Py记录所有web服务响应。 最好的方法是什么 我正在使用以下代码写入MongoDB数据库: @hook('after_request') def f_after_request(): if request['bottle.route'].rule not in [ '/robots.txt', '/favicon.ico', ]: json_in = None if request.method
@hook('after_request')
def f_after_request():
if request['bottle.route'].rule not in [
'/robots.txt',
'/favicon.ico',
]:
json_in = None
if request.method not in ['GET']:
json_in = request.json
_save_in_out_message(
url=bottle.request.url,
json_in=json_in,
json_out=bottle.response.get_data(),
status_code=response.status_code,
method=request.method
)
但是response.get_data()
不存在
如何在after_请求中捕获瓶装响应中的JSON
什么是正确的响应。获取数据()
命令
谢谢请参阅。建议使用类似插件的