标签:files python json params requests data post
request库里边传参时params和data和json的区别:
params =
params是get请求的参数,传入后等同于'https:xx.com/search?q=python&cat=1001'
data是post请求的参数,.post(url,data=params),使用application/x-www-form-urlencoded编码
json是post请求的参数:.post(url,json=params),内部自动序列化为json
request库里边file通过files传入:
定义file:upload_files =
r = requests.post(url,files=upload_files)
读取文件时使用'rb'即二进制模式读取,这样获取的bytes长度才是文件长度
标签:files,
python,
json,
params,
requests,
data,
post
From: https://www.cnblogs.com/jinziguang/p/18289640