Django_ get the parameters of the api interface

Table of contents

When the parameter is form-data or x-www-form-urlencoded type, use request.POST to get the parameter

When the parameter is of raw type, use request.body to obtain the parameter, and the obtained parameter needs to be processed before it can be used

Source code and other data acquisition methods


When the parameter is form-data or x-www-form-urlencoded type, use request.POST to get the parameter

How to get parameters

request.POST.get('username')

When the parameter is of raw type, use request.body to obtain the parameter, and the obtained parameter needs to be processed before it can be used

 How to get parameters

params = eval(request.body.decode('utf-8'))
print(params)
username = params.get("username")
password = params.get("password")


Source code and other data acquisition methods

 Friends who want to get the source code, please like + comment + favorite , triple!

After three times in a row , I will send you private messages one by one in the comment area~

 

Guess you like

Origin blog.csdn.net/GDYY3721/article/details/131683670