createBatch.py
1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# -*- coding: utf-8 -*-
# @Time : 2021/9/29 10:11
# @Author : Ljq
# @File : createBatch.py
# @Software: PyCharm
"""
"""
import sys
from commons.api.hg.CheckIn import CheckInMoreGoods as CIMG
from commons.scripts.readConf import rC
from commons.MySession import sessionHg
class createBat(object):
def __init__(self):
data = {i.split("=")[0]: i.split("=")[1] for i in sys.argv if "=" in i}
print(data)
if "ic" not in data.keys() or data["ic"] == "":
self.ic = rC.returnOptionsItems("testInfo", "hg_cardNumRe_01")
if "goodsName" not in data.keys() or data["goodsName"] == "":
self.goodsName = "葡萄"
if "allLevelKeyword" not in data.keys() or data["allLevelKeyword"] == "":
self.allLevelKeyword = "万州"
if "nameLike" not in data.keys() or data["nameLike"] == "":
self.nameLike = "西区"
if "tradePassword" not in data.keys() or data["tradePassword"] == "":
self.tradePassword = "111111"
if "weight" not in data.keys() or data["weight"] == "":
self.weight = "50"
# host信息准备
self.host = rC.returnOptionsItems("host", "gatewayHost")
def main(self):
print("main")
res = CIMG.create_registerRecord(session=sessionHg,ic=self.ic,host=self.host,goodsName=self.goodsName,
allLevelKeyword=self.allLevelKeyword,nameLike=self.nameLike,
tradePassword=self.tradePassword,weight=self.weight)
print(res.text)
print(res.json()["data"]["batchCode"])
# 调用
createBat = createBat().main()