Commit 30355be4140e43aef106cc980fe793199c5d1588

Authored by lixi
1 parent dd6dcc30

更新文件

commons/api/transaction/createAndTrade.py
... ... @@ -15,8 +15,8 @@ from commons.MySession import hg
15 15 class createAndTrade():
16 16 url = "http://test.gateway.diligrp.com:8285/hg-trading/api/tradingOrder/createAndTrade"
17 17 header = {
18   - "UAP_accessToken":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiJXRUIiLCJuYmYiOjE2MzAzOTE5MjQsImRhdGEiOiJ7XCJjZWxscGhvbmVcIjpcIjE4ODU5ODk4ODk1XCIsXCJjcmVhdGVkXCI6MTYyOTg1NzY2NDAwMCxcImRlcGFydG1lbnRJZFwiOjE3NixcImVtYWlsXCI6XCJoYW5nZ3Vvamlla3VhbkBkaWxpZ3JwLmNvbVwiLFwiZmlybUNvZGVcIjpcImh6Z3BcIixcImZpcm1JZFwiOjE1LFwiZmlybU5hbWVcIjpcIuadreW3nuaenOWTgeW4guWculwiLFwiaWRcIjo0NTMsXCJsYXN0TG9naW5UaW1lXCI6MTYzMDM5MTkyNDU4NixcIm1ldGFkYXRhXCI6e30sXCJtb2RpZmllZFwiOjE2Mjk5NTkxMTAwMDAsXCJwYXNzd29yZFwiOlwiMTg5NjVFQjcyQzkyQTU0OUREXCIsXCJyZWFsTmFtZVwiOlwi5p2t5p6c5YCf5qy-XCIsXCJzZXJpYWxOdW1iZXJcIjpcIjAwMFwiLFwic3RhdGVcIjoxLFwic3lzdGVtVHlwZVwiOjEsXCJ1c2VyTmFtZVwiOlwiMTExMjIyXCIsXCJ1c2VyVHlwZVwiOjF9IiwiaXNzIjoiVUFQX0FVVEgwIiwiZXhwIjoxNjMwNDA5OTI0LCJpYXQiOjE2MzAzOTE5MjQsImp0aSI6IjU4OWNkZThlLWE3NDItNDk5OC1hYmRiLWQ5NmFkMWM4NzZkNyJ9.j4-_Y2YakS275AjYni_x3aYwHP0G8SVczSeWl4zi7OdP_SOKUpFdKl-sD5vSDeJAH4RDV0_ZwrPLjCWGMaLPVXpdin5NT8_oiJqyovvJt3ZyGO_PB-MtO7-biDuhnARdOAOuI1_-9kd3Bj4PbZ0-PhHw8LGBaKlo4uByp-wbj-Q",
19   - "UAP_refreshToken":"86ae066b-9446-408f-9bc6-b7ae3550ea7b",
  18 + "UAP_accessToken":"demo",
  19 + "UAP_refreshToken":"demo",
20 20 "Content-Type":"application/json;charset=utf-8",
21 21 "Host":"test.gateway.diligrp.com:8285",
22 22 "Content-Length":"740"
... ... @@ -64,14 +64,17 @@ class createAndTrade():
64 64 ]
65 65 }
66 66  
67   - def __init__(self):
  67 + def __init__(self,market):
  68 + self.market = market
68 69 self.url = createAndTrade.url.replace("http://test.",com.get_global_config("global_data", "environment", "en") )
69 70 self.header = createAndTrade.header
  71 + self.header["UAP_accessToken"] = self.market.cookies["UAP_accessToken"]
  72 + self.header["UAP_refreshToken"] = self.market.cookies["UAP_refreshToken"]
70 73 self.body = createAndTrade.body
71 74  
72 75  
73   -crat = createAndTrade()
  76 +crat = createAndTrade(hg)
74 77 print(crat.body)
75   -re = hg.post(url = crat.url,data = crat.body.encode('utf-8'),headers = crat.header)
  78 +re = hg.post(url = crat.url,json = crat.body,headers = crat.header,proxies=hg.myproxies)
76 79 print(re.json())
77 80 print(re.headers)
78 81 \ No newline at end of file
... ...