/* 时间:2020/10/25 目录: 一: json=dict 二: data=json.dumps(dict) 三: 总结 */
# 传递方法 : json=dict r = requests.post(url, json=dict, verify = False) POST https://www.baidu.com/ HTTP/1.1 Host: www.baidu.com User-Agent: python-requests/2.24.0 Accept-Encoding: gzip, deflate Accept: */* Connection: keep-alive Content-Length: 2064 Content-Type: application/json
# 传递方法 : data=json.dumps(dict) r = requests.post(url, data=json.dumps(dict), verify = False) POST https://www.baidu.com/ HTTP/1.1 Host: www.baidu.com User-Agent: python-requests/2.24.0 Accept-Encoding: gzip, deflate Accept: */* Connection: keep-alive Content-Length: 2064
# 总结 json=dict 比 data=json.dumps(dict)在头部信息多了个Content-Type: application/json