当前位置:网站首页>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_参数名大写,如果参数名中有‘-’符号,会自动转化为‘_'
边栏推荐
- How to become a senior digital IC Design Engineer (5-3) theory: ULP low power design technology (Part 2)
- 洛谷P2482 [SDOI2010]猪国杀
- AI moves from perception to intelligent cognition
- Can flycdc use SqlClient to specify mysqlbinlog ID to execute tasks
- 内存==c语言1
- C# 初始化程序时查看初始化到哪里了示例
- C# Socke 服务器,客户端,UDP
- 2016 CCPC Hangzhou Onsite
- Lesson 1: hardness of eggs
- Diffusion模型详解
猜你喜欢
Sqlplus garbled code problem, find the solution
The applet realizes multi-level page switching back and forth, and supports sliding and clicking operations
JS reverse tutorial second issue - Ape anthropology first question
Bean 作⽤域和⽣命周期
Software modeling and analysis
内存==c语言1
[4g/5g/6g topic foundation-146]: Interpretation of white paper on 6G overall vision and potential key technologies-1-overall vision
Octopus future star won a reward of 250000 US dollars | Octopus accelerator 2022 summer entrepreneurship camp came to a successful conclusion
What development models did you know during the interview? Just read this one
Dynamics 365online applicationuser creation method change
随机推荐
Flinkcdc failed to collect Oracle in the snapshot stage. How do you adjust this?
Sword finger offer II 107 Distance in matrix
[untitled]
Pytest learning - dayone
Do you have a boss to help look at this error report and what troubleshooting ideas are there? Oracle CDC 2.2.1 flick 1.14.4
Impression notes finally support the default markdown preview mode
flink. CDC sqlserver. 可以再次写入sqlserver中么 有连接器的 dem
thinkphp3.2信息泄露
Bean 作⽤域和⽣命周期
EXT2 file system
HCIP 第一天 笔记整理
Applet sliding, clicking and switching simple UI
CDZSC_2022寒假个人训练赛21级(1)
Addition, deletion, modification and query of ThinkPHP database
Guys, have you ever encountered the case of losing data when Flink CDC reads mysqlbinlog? Every time the task restarts, there is a probability of losing data
Internship log - day04
flinkcdc采集oracle在snapshot阶段一直失败,这个得怎么调整啊?
Lesson 1: finding the minimum of a matrix
In addition to the objective reasons for overtime, what else is worth thinking about?
细说Mysql MVCC多版本控制