python flask框架request对象属性

request对象的常用属性

postman请求示例
python flask框架request对象属性

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.json: {'userid': 'b725', 'username': '张三'} # POST请求的body中json格式参数
request.content_length: 80:
request.headers:返回headers集合

更多信息可参考官方文档:https://dormousehole.readthedocs.io/en/latest/api.html?highlight=request#flask.Request

上一篇:Docker私有仓库搭建


下一篇:python通过http上传文件