标签:工作 headers return block 简单的 ams 请求 __name__ lock
测试工作中,会需要测试人员自己写个接口,用于测试系统,下面的接口实现:请求该接口,接口返回该请求该接口时的所有请求信息
from flask import Flask, request
app = Flask(‘test_api‘)@app.route(‘/get_request_info‘, methods=[‘post‘,‘get‘])
def get_request_info():
resp = {‘params_data‘:‘‘, ‘headers‘:‘‘, ‘params_query‘:‘‘, ‘params_form‘:‘‘}
resp[‘headers‘] = dict(request.headers)
resp[‘params_data‘] = dict(request.data)
resp[‘params_form‘] = dict(request.form)
resp[‘params_query‘] = dict(request.args)return resp
if __name__ == ‘__main__‘:
app.run(port=8080, debug=‘true‘, host="0.0.0.0")
标签:工作 headers return block 简单的 ams 请求 __name__ lock
原文地址:https://www.cnblogs.com/testeyes/p/11445350.html