request对象的常用属性
postman请求示例
request.host: 127.0.0.1:5000:
request.host_url: http://127.0.0.1:5000/:
request.base_url: http://127.0.0.1:5000/demo/data:
request.url: http://127.0.0.1:5000/demo/data?a=1:
request.full_path: /demo/data?a=1:
request.path: /demo/data
request.url_charset: utf-8:
request.args.get("xxx") # GET请求的参数
request.json: {'userid': 'b725', 'username': '张三'} # POST请求的body中json格式参数
request.data: # POST请求的body中text格式参数
request.content_length: 80:
request.headers:返回headers集合
更多信息可参考官方文档:https://dormousehole.readthedocs.io/en/latest/api.html?highlight=request#flask.Request