• python简单接口的测试(随机数等)


    import random
    
    import requests
    url='http://xxx'
    headers={
        'Authorization':'xxx',
        'Content-Type':'application/json'
    }
    data0=""
    for i in range(1,20):
        uid=str(i)
        score=str(round(random.uniform(0,100),1))
        cls=str(random.choice([1,2,3,4,5]))
        data0=data0+"{'UID':'"+uid+"','SCORE':'"+score+"','CLASS':'"+cls+"班','COMPANY_NO':'111'}"+","
    
    
    data0=data0[:-1]  #或者是data0=data0.rstrip(',')
    
    data='''{
      'info': {'interfaceCode':'uintfc_test01',
    			'CS_TEST_YHJRJK':[
    			'''+data0+'''
    			]}
    }'''
    print(data)
    data=data.encode('utf-8')
    
    response=requests.post(url=url,headers=headers,data=data)
    print(response.content.decode('utf-8'))
    

      

  • 相关阅读:
    csrf & xss
    android_sqlite
    android_error
    oracle笔记
    android_lesson_1
    mysql 设置编码
    前端进阶Event
    前端进阶Position
    chrome插件开发资料
    dom4j selectNodes
  • 原文地址:https://www.cnblogs.com/ceshixuexi/p/8134864.html
Copyright © 2020-2023  润新知