使用http请求成功后返回response对象。其中response.headers
是响应头,response.request.headers
就是请求头
import requests
from baseDatas import userAgents
data = {"a":2, "b":"abc"}
headers = {"User-Agent": userAgents[2]}
res = requests.post(url, data=data, headers = headers)
print("请求头:%s" %res.request.headers)
print("响应头:%s" %res.headers)