#coding=utf-8 import requests import time import json url="http://xxx/companies" payload={"companyName":"test产废单位10081934","companyType":2,"companyLinkman":"小明","companyPhone":"13111112222","address":{"province":330000,"city":330300,"area":330303,"street":330303006,"detail":"东京市红高粱村"},"gpsLocation":"130,40","email":"ewew@qq.com","businessLicenceUrl":r"http://test-icloudeep-img.oss-cn-beijing.aliyuncs.com/module/uploads/e23f0c096745428ab72b00ff2f89ffcf.png","nearWater":1,"industryType":"mouldOfPlastics","companyStatus":"2",'companyDesc':'yuanliao'} headers={'Accept': 'application/json, text/plain, */*' ,'client': 'Web' ,'Content-Type': 'application/json;charset=UTF-8' ,'Origin': 'xxx' ,'Referer': 'xxx/' ,'token': 'NGKPaLge8urbOlOAuHasURwYP4AKQIo8O1zad5F3vLA=' ,'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36'} for i in range(100): payload["companyName"]="test产废单位110914172"+str(i) #带有嵌套的字典,需要转换为json传输 r = requests.post(url, data=json.dumps(payload),headers=headers) print(r.json()) assert r.json()['code']==200 time.sleep(0.5)