createAndTrade.py
3.13 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# -*- coding: utf-8 -*-
"""
@Time : 2021/8/31 14:43
@Auth : wlm
@File :createAndTrade.py
@IDE :PyCharm
"""
"""
大客户模式——新增交易单
"""
from commons import common as com
from commons.MySession import hg
class createAndTrade():
url = "http://test.gateway.diligrp.com:8285/hg-trading/api/tradingOrder/createAndTrade"
header = {
"UAP_accessToken":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiJXRUIiLCJuYmYiOjE2MzAzOTE5MjQsImRhdGEiOiJ7XCJjZWxscGhvbmVcIjpcIjE4ODU5ODk4ODk1XCIsXCJjcmVhdGVkXCI6MTYyOTg1NzY2NDAwMCxcImRlcGFydG1lbnRJZFwiOjE3NixcImVtYWlsXCI6XCJoYW5nZ3Vvamlla3VhbkBkaWxpZ3JwLmNvbVwiLFwiZmlybUNvZGVcIjpcImh6Z3BcIixcImZpcm1JZFwiOjE1LFwiZmlybU5hbWVcIjpcIuadreW3nuaenOWTgeW4guWculwiLFwiaWRcIjo0NTMsXCJsYXN0TG9naW5UaW1lXCI6MTYzMDM5MTkyNDU4NixcIm1ldGFkYXRhXCI6e30sXCJtb2RpZmllZFwiOjE2Mjk5NTkxMTAwMDAsXCJwYXNzd29yZFwiOlwiMTg5NjVFQjcyQzkyQTU0OUREXCIsXCJyZWFsTmFtZVwiOlwi5p2t5p6c5YCf5qy-XCIsXCJzZXJpYWxOdW1iZXJcIjpcIjAwMFwiLFwic3RhdGVcIjoxLFwic3lzdGVtVHlwZVwiOjEsXCJ1c2VyTmFtZVwiOlwiMTExMjIyXCIsXCJ1c2VyVHlwZVwiOjF9IiwiaXNzIjoiVUFQX0FVVEgwIiwiZXhwIjoxNjMwNDA5OTI0LCJpYXQiOjE2MzAzOTE5MjQsImp0aSI6IjU4OWNkZThlLWE3NDItNDk5OC1hYmRiLWQ5NmFkMWM4NzZkNyJ9.j4-_Y2YakS275AjYni_x3aYwHP0G8SVczSeWl4zi7OdP_SOKUpFdKl-sD5vSDeJAH4RDV0_ZwrPLjCWGMaLPVXpdin5NT8_oiJqyovvJt3ZyGO_PB-MtO7-biDuhnARdOAOuI1_-9kd3Bj4PbZ0-PhHw8LGBaKlo4uByp-wbj-Q",
"UAP_refreshToken":"86ae066b-9446-408f-9bc6-b7ae3550ea7b",
"Content-Type":"application/json;charset=utf-8",
"Host":"test.gateway.diligrp.com:8285",
"Content-Length":"740"
}
body = {
"sellerId":141962,
"sellerName":"云康飞卖",
"sellerAccountId":107663,
"sellerCardNo":"888810062816",
"buyerId":141966,
"buyerName":"严永志买",
"buyerAccountId":107675,
"buyerCardNo":"888810055039",
"posCode":"111222",
"tradePassword":"111111",
"orderItemList":[{
"number":0,
"batchCode":"2108000019",
"productId":44,
"productCode":"754107",
"productName":"葡萄",
"categoryId":754107,
"weightType":1,
"quantity":12,
"pieceWeight":50,
"grossWeight":0,
"tareWeight":0,
"weight":600,
"price":200,
"PriceStr":"2",
"amount":2400,
"amountStr":24.0,
"originId":510100,
"originName":"成都市",
"feeItemList":[{
"type":1,
"chargeItemId":521,
"chargeItemName":"买家手续费",
"amount":2
},{"type":2,
"chargeItemId":522,
"chargeItemName":"卖家手续费",
"amount":12}]}
]
}
def __init__(self):
self.url = createAndTrade.url.replace("http://test.",com.get_global_config("global_data", "environment", "en") )
self.header = createAndTrade.header
self.body = createAndTrade.body
crat = createAndTrade()
print(crat.body)
re = hg.post(url = crat.url,data = crat.body.encode('utf-8'),headers = crat.header)
print(re.json())
print(re.headers)