Compared with the multi-post requests get request a body part, the parameters can be placed post request url, body can be placed, can be placed simultaneously url body and, of course, may not post requests with parameters
Common post submission of data types
parameter passing the post - application / json format (JSON parameter passing)
#!/usr/bin/python3
# coding=utf-8
# Author: 文
import requests
cookie = {"PSTM": "553180542","HMACCOUNT": "BA4C08D999D27E4E"}
payload = {"username": "user_name","password": "pass_word"}
r = requests.post(url="http://httpbin.org/post", headers=header, cookies=cookie, json=payload)
print(r.text)
fiddler capture the view of the original request, as shown:
parameter passing the post - application / x-www-form-urlencoded format (body parameter passing)
#!/usr/bin/python3
# coding=utf-8
# Author: 文
import requests
header = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)AppleWebKit/537.36(KHTML, like Gecko)Chrome/74.0.3729.108 Safari/537.36","Content-Type": "application/x-www-form-urlencoded"}
cookie = {"PSTM": "553180542", "HMACCOUNT": "BA4C08D999D27E4E"}
payload = {"username": "user_name","password": "pass_word"}
r = requests.post(url="http://httpbin.org/post", headers=header, cookies=cookie, data=payload)
print(r.text)
After capture fiddler view original request (see parameter Webforms), as shown: