test_createTradingOrder.py 1.09 KB
import sys,os
#windows
# sys.path.extend(['E:\\PycharmWorkspace\\test-scripts'])
#liunx
sys.path.extend(['/usr/jenkins/workspace/辅助脚本-创建交易单simple'])
import commons as com
from commons.MySession import hg
from commons.basic.createAndTrade import createAndTrade
from tmp import d
create = createAndTrade()
# path = os.path.dirname(os.path.abspath(sys.argv[0]))
#查看文件有效路径
# print(sys.path)

print("\n开始运行订单创建脚本...\n")


#打印第三方请求json
print(d)

#获取命令行参数,市场和请求次数
cmd_list=sys.argv[1:]
print(cmd_list)

if len(cmd_list)!=0:
    for i in range(len(cmd_list)):
        print("参数值",i,cmd_list[i])
    # print("测试市场{}".format(cmd_list[0]))
    # print("请求body{}".format(cmd_list[1]))
    # print("请求次数{}".format(cmd_list[2]))


if d!="None" and len(cmd_list)!=0:
    for i in range(int(cmd_list[1])):
        body = d
        print("创建订单,第{}次请求,请求body={}".format(i+1,body))
        re = hg.post(url = create.url, headers = create.header, json = body)
        print(re.json())