Commit 2635b8d30e1f78f6dc27304b1912cbbdb4acadbd
1 parent
93d12d58
上传文件
Showing
5 changed files
with
121 additions
and
10 deletions
commons/MySession.py
... | ... | @@ -50,6 +50,7 @@ class mysession(): |
50 | 50 | self.ssl_verify = False |
51 | 51 | self.proxies = None |
52 | 52 | # self.proxies={'http': 'http://localhost:8888', 'https': 'http://localhost:8888'} |
53 | + self.myproxies={'http': 'http://localhost:8888', 'https': 'http://localhost:8888'} | |
53 | 54 | self.allow_redirects = False |
54 | 55 | self.firmid={"group":"1","hd":"2","cd":"3","qqhe":"4","mdj":"5","gy":"6","cc":"7","sg":"8","sy":"9"} |
55 | 56 | |
... | ... | @@ -110,6 +111,7 @@ class mysession(): |
110 | 111 | co.set("UAP_firmId", str(self.re.json()["data"]["user"]["firmId"])) |
111 | 112 | co.set("UAP_accessToken", self.re.json()["data"]["accessToken"]) |
112 | 113 | co.set("UAP_refreshToken", self.re.json()["data"]["refreshToken"]) |
114 | + print(dir(co)) | |
113 | 115 | self.se.cookies.update(co) |
114 | 116 | # 返回session对象,供其他接口使用 |
115 | 117 | return self.se |
... | ... | @@ -281,9 +283,10 @@ class mysession(): |
281 | 283 | my = mysession() |
282 | 284 | my.set_mark() |
283 | 285 | my.cliLogin() |
284 | -s1 = my.get_session_client("sg_user01") | |
285 | -s2 = my.get_session_client("sg_user02") | |
286 | -s3 = my.get_session_client("sg_user01") | |
286 | +# s1 = my.get_session_client("sy_user01") | |
287 | +s1 = my.get_session("sy_user01") | |
288 | +s2 = my.get_session_client("sy_user01") | |
289 | +# s3 = my.get_session_client("sy_user03") | |
287 | 290 | # s3= my.get_session_client("sg_user02") |
288 | 291 | # sg01=my.get_session_client("sg_user01") |
289 | 292 | # sg02=my.get_session_client("sg_user02") | ... | ... |
commons/api/duplicateToken.py
0 → 100644
1 | +#!/usr/bin/python | |
2 | +# -*- coding: UTF-8 -*- | |
3 | +import urllib3 | |
4 | +from commons import common as com | |
5 | +from commons.MySession import my,s1 | |
6 | +import requests | |
7 | + | |
8 | +urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) | |
9 | + | |
10 | + | |
11 | +class duplicateToken(): | |
12 | + url = "http://test.gateway.diligrp.com:8285/jmsf-web/appCommon/duplicateToken.action" | |
13 | + header = { | |
14 | + "UAP_accessToken": "demo", | |
15 | + "UAP_refreshToken": "demo", | |
16 | + "UAP_firmId": "9", | |
17 | + "Host": "test.gateway.diligrp.com:8285", | |
18 | + "Connection":"Keep-Alive"} | |
19 | + | |
20 | + def __init__(self): | |
21 | + self.url = duplicateToken.url.replace("http://test.", com.get_global_config("global_data", "environment", "en")) | |
22 | + self.header = duplicateToken.header | |
23 | + self.header["UAP_accessToken"] = s1.cookies["UAP_accessToken"] | |
24 | + self.header["UAP_refreshToken"] = s1.cookies["UAP_refreshToken"] | |
25 | + self.header["UAP_firmId"] = s1.cookies["UAP_firmId"] | |
26 | + self.header["Host"] = com.get_global_config("global_data", "host", "gateway") | |
27 | + | |
28 | + def jmsf_duplicate_commit_token(self): | |
29 | + re = s1.get(url=self.url, headers=self.header) | |
30 | + return re.json()["data"] | |
31 | + | |
32 | + | |
33 | +# print(s1.headers) | |
34 | +# du=duplicateToken() | |
35 | +# print(du.jmsf_duplicate_commit_token()) | |
36 | +# print(re.json()) | |
37 | +# print(re.headers) | |
0 | 38 | \ No newline at end of file | ... | ... |
commons/api/weighingServiceSave.py
0 → 100644
1 | +#!/usr/bin/python | |
2 | +# -*- coding: UTF-8 -*- | |
3 | +import urllib3 | |
4 | +from commons import common as com | |
5 | +from commons.MySession import my,s1 | |
6 | +from commons.api.duplicateToken import duplicateToken | |
7 | +urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) | |
8 | +du=duplicateToken() | |
9 | + | |
10 | +class weighingServiceSave(): | |
11 | + url = "http://test.gateway.diligrp.com:8285/jmsf-web/api/entrace/weighingServiceSave" | |
12 | + header = { | |
13 | + "jmsf_duplicate_commit_token": "demo", | |
14 | + "UAP_accessToken": "demo", | |
15 | + "UAP_refreshToken": "demo", | |
16 | + "UAP_firmId": "9", | |
17 | + "Content-Type": "application/json", | |
18 | + "Host": "test.gateway.diligrp.com:8285", | |
19 | + "Content-Length": "453"} | |
20 | + body = { | |
21 | + "carTypeId": 128, | |
22 | + "carTypeName": "玉玺", | |
23 | + "carTypeCode": "888", | |
24 | + "driverTel": "16111111111", | |
25 | + "fee": "18.00", | |
26 | + "greeterId": 0, | |
27 | + "greeterName": None, | |
28 | + "plate": "京A666666", | |
29 | + "remark": "test_称重服务接口测试", | |
30 | + "weighImgs": [], | |
31 | + "weight": 10.0, | |
32 | + "weightDate": "2021-07-29 15:50:26", | |
33 | + "pathAddress": "40-5B-D8-DF-CA-C7", | |
34 | + "entryPlateInputType": 1, | |
35 | + "customerType": 0, | |
36 | + "carryStatus": 0, | |
37 | + "customerName": None, | |
38 | + "pwd": "", | |
39 | + "totalPrice": 18.00, | |
40 | + "ic": "", | |
41 | + "customerId": 0, | |
42 | + "accountId": 0, | |
43 | + "protocolId": None} | |
44 | + | |
45 | + def __init__(self): | |
46 | + self.url = weighingServiceSave.url.replace("http://test.", com.get_global_config("global_data", "environment", "en")) | |
47 | + self.header = weighingServiceSave.header | |
48 | + self.header["jmsf_duplicate_commit_token"] = du.jmsf_duplicate_commit_token() | |
49 | + self.header["UAP_accessToken"] = s1.cookies["UAP_accessToken"] | |
50 | + self.header["UAP_refreshToken"] = s1.cookies["UAP_refreshToken"] | |
51 | + self.header["UAP_firmId"] = s1.cookies["UAP_firmId"] | |
52 | + self.header["Host"] = com.get_global_config("global_data", "host", "gateway") | |
53 | + | |
54 | + | |
55 | + | |
56 | +# tt=weighingServiceSave() | |
57 | +# re=s1.post(url=tt.url,headers=tt.header,json=tt.body,proxies=my.myproxies) | |
58 | +# print(re.json()) | |
0 | 59 | \ No newline at end of file | ... | ... |
config/global_data.conf
... | ... | @@ -3,10 +3,10 @@ |
3 | 3 | [account] |
4 | 4 | #取值字段根据市场拼音首字母缩写组合而成,尾号数字按照01-99叠加 |
5 | 5 | #账户和密码通过&符号隔开 |
6 | -sg_user01=sy_chen&123456 | |
7 | -sg_user02=sygangda&111111 | |
8 | -sg_user03=sg_wenze&111111 | |
9 | -sy_user01=sy_wenze&111111 | |
6 | +sy_user01=sy_chen&123456 | |
7 | +sy_user02=sygangda&111111 | |
8 | +heb_user01=sg_wenze&111111 | |
9 | +heb_user02=sy_wenze&111111 | |
10 | 10 | |
11 | 11 | [userId] |
12 | 12 | #冗余配置字段,可不配置 |
... | ... | @@ -24,6 +24,16 @@ demo=["tg@diligrp.com","175930106@qq.com"] |
24 | 24 | list=["heb1","P3","v1.6","沈阳"] |
25 | 25 | demo=["p1","P2",1,"test"] |
26 | 26 | |
27 | + | |
28 | +[environment] | |
29 | +#格式只能为一下几种 | |
30 | +#http://test. | |
31 | +#https://test. | |
32 | +#http:// | |
33 | +#https:// | |
34 | +en=http://test. | |
35 | + | |
36 | + | |
27 | 37 | [Database] |
28 | 38 | dbhost=10.35.100.34 |
29 | 39 | dbport=3306 |
... | ... | @@ -32,13 +42,16 @@ dbuser=root |
32 | 42 | dbpassword=123456 |
33 | 43 | dbcharset=utf8 |
34 | 44 | |
35 | -[environment] | |
45 | + | |
46 | +[host] | |
36 | 47 | #格式只能为一下几种 |
37 | 48 | #http://test. |
38 | 49 | #https://test. |
39 | 50 | #http:// |
40 | 51 | #https:// |
41 | -en=http://test. | |
52 | +gateway=test.gateway.diligrp.com:8285 | |
53 | + | |
54 | + | |
42 | 55 | |
43 | 56 | |
44 | 57 | ... | ... |
main.py