Exemplo n.º 1
0
import time
import threading
from baibaoxiang import baibaoxiangInterface, excel, sys_powel

ex = excel.InputExcel()
go = baibaoxiangInterface.go()
all_jieguo = []


class a(threading.Thread):
    def __init__(self, url, data, header, name, user_sum):
        threading.Thread.__init__(self)
        self.url = url
        self.data = data
        self.header = header
        self.name = name
        self.user_sum = int(user_sum)

    def run(self):
        for i in range(self.user_sum):
            # iss=[]
            # run_time=time.time()
            name = str(self.name) + "-" + str(i)
            # print(self.name,"-",i,"本次执行时间是:",run_time)
            f = go.post(self.url, self.data, self.header, name)
            on_to_over_time = f.elapsed.total_seconds()
            print(name, "发送请求到接收完数据的时间(总时长)", on_to_over_time, "秒,相当于",
                  on_to_over_time * 1000, "毫秒")
            all_jieguo.append([
                name, self.url,
                str(self.data), f.status_code,
Exemplo n.º 2
0
from baibaoxiang import baibaoxiangInterface
url = "https://test-plus.moliyan.com.cn/api/Kpi/add"
data = {
    "name":
    "1905",
    "type":
    "1",
    "data[0][id]":
    "100",
    "data[0][target]":
    "100",
    "data[0][data][0-0]":
    "1",
    "data[0][data][1-5]":
    "50",
    "data[0][data][6-10]":
    "100",
    "data[0][weight]":
    "100",
    "uids":
    "1067,1435",
    "date":
    "2019-05",
    "token":
    "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJwbHVzIiwiaWF0IjoxNTU2MjU4MDI2LCJleHAiOjE1NTYzNDQ0MjYsInVpZCI6IjEwMTYifQ.s_VQXxi-EPc-4li3eNdSvMFHlYQ5hG5bDMjhxBJloH8",
}
baibaoxiangInterface.go().post(url, data, "", "添加考核")