zoukankan      html  css  js  c++  java
  • 202001031

    #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)

  • 相关阅读:
    Dictionary集合 字典
    装箱和拆箱
    List< >泛型集合
    Hashtable 键值对集合
    File 类 的基本操作
    简体转换繁体
    ArrayList集合长度的问题
    ArrayList  集合
    里式转换
    字符串中常用的方法
  • 原文地址:https://www.cnblogs.com/sea-stream/p/12142963.html
Copyright © 2011-2022 走看看