当前位置:网站首页>request对象对请求体,请求头参数的解析
request对象对请求体,请求头参数的解析
2022-07-07 07:17:00 【chuntian_tester】
1.请求体参数解析:
1.1 GET请求
1.1.1 请求url中/?xxx&xxx格式为查询字符串参数,通过request.GET获取请求参数
1.1.2 请求url中/xxx/2/xxx格式为路径参数,通过request.GET获取
1.1.3 url中xx/?name=aa&age=19&name=bb,通过request.GET获取,若想获取所有name参数,通过getlist('key1')获取相同key的多个值,返回list类型
1.2 POS请求
1.2.1 json格式请求体参数
json格式的参数会存放在body中,一般为bytes字节类型,使用json.loads(request.body)处理后提取参数

1.2.2 www-form-urlencoded格式参数
一般在前端通过表单录入的参数就是www-form-urlencoded类型 ,通过request.POST获取
1.2.3 file文件类型参数
1.2.3.1 通过form-data中的file类型参数
content_type类型为multipart/form-data,参数从request.body中获取

1.2.3.2 通过binary中的file类型参数
纯文件,都用request.body获取
2.请求头参数解析:

2.1 request.headers['key']或者request.headers.get('key')获取

2.2 request.META['HTTP_AUTHORIZATION']获取
请求头参数会被转化为:HTTP_参数名大写,如果参数名中有‘-’符号,会自动转化为‘_'

边栏推荐
- Write VBA in Excel, connect to Oracle and query the contents in the database
- 2020 Zhejiang Provincial Games
- AI从感知走向智能认知
- How to become a senior digital IC Design Engineer (5-3) theory: ULP low power design technology (Part 2)
- PLC信号处理系列之开关量信号防抖FB
- Introduction to automated testing framework
- “十二星座女神降临”全新活动推出
- flink. CDC sqlserver. You can write the DEM without connector in sqlserver again
- 能源路由器入门必读:面向能源互联网的架构和功能
- 小程序弹出半角遮罩层
猜你喜欢

Deep understanding of UDP, TCP

Pit encountered by vs2015 under win7 (successful)

arcgis操作:dwg数据转为shp数据

小程序滑动、点击切换简洁UI

Esp8266 uses TF card and reads and writes data (based on Arduino)

What development models did you know during the interview? Just read this one

字节跳动 Kitex 在森马电商场景的落地实践

Future development blueprint of agriculture and animal husbandry -- vertical agriculture + artificial meat

Software modeling and analysis
![[Frida practice]](/img/20/fc68bcf2f55b140d6754af6364896b.png)
[Frida practice] "one line" code teaches you to obtain all Lua scripts in wegame platform
随机推荐
JS reverse tutorial second issue - Ape anthropology first question
内存==c语言1
Gym - 102219j kitchen plates (violent or topological sequence)
js逆向教程第二发-猿人学第一题
How to become a senior digital IC Design Engineer (1-6) Verilog coding Grammar: Classic Digital IC Design
Writing file types generated by C language
sql 里面使用中文字符判断有问题,哪位遇到过?比如value<>`无`
Write it into the SR table in the way of flinksql. It is found that the data to be deleted has not been deleted. Refer to the document https://do
Bean 作⽤域和⽣命周期
[bw16 application] Anxin can realize mqtt communication with bw16 module / development board at instruction
PLC信号处理系列之开关量信号防抖FB
中国首款电音音频类“山野电音”数藏发售来了!
Impression notes finally support the default markdown preview mode
Pit encountered by vs2015 under win7 (successful)
Lesson 1: finding the minimum of a matrix
C# XML的应用
终于可以一行代码也不用改了!ShardingSphere 原生驱动问世
Diffusion模型详解
In fact, it's very simple. It teaches you to easily realize the cool data visualization big screen
[4g/5g/6g topic foundation-146]: Interpretation of white paper on 6G overall vision and potential key technologies-1-overall vision