1.data的类型:有dict和json之分,get记得用params。
2.图片上传有额外处理:
def uploadPicture(url,header,data,filename=“11.jpg”,filepath=picture_path):
data[‘fileList’]= (filename,open(filepath,‘rb’).read())
encode_data = encode_multipart_formdata(data)
data = encode_data[0]
header[‘Content-Type’] = encode_data[1]
res = HttpRequest.httprequest(method=“post”,url=url, headers=header, data=data)
return res
3.字典里嵌套字符串字典,注意格式:
{‘personIds’: ‘5371afcd67174333be07abed0ae05e82’, ‘buildingId’: ‘e19b2749f6534c37a50b28fc7e0f0aaa’, ‘customerId’: ‘a4e57823808449debd91182215f458d7’, ‘data’: ‘{“assets_building_nature_property”:“住宅”,“assets_building_street”:“上海”}’}
4.串联请求之间有时 需要sleep
接口测试中小坑总结
最新推荐文章于 2021-04-20 16:30:51 发布