The requests package is a very useful package in the python language for sending requests. It integrates many http request methods. This article focuses on the post submission form.
Some of the server-side APIs accept form form submissions, and some accept json data submissions. The difference between their python writing is as follows:
form:
header = {
"Content-Type": "application/x-www-form-urlencoded"
}
requests.post(url , data={"appname": '111'}, headers=header)
json:
header = {
"Content-Type": "application/json"
}
requests.post(url , data={"appname": '111'}, headers=header)
The main difference between the two lies in the headers.