Commit 165ae2bfee52a40689c0c1fb9f67321437d0f6f9

Authored by lixi
1 parent e3f10192

上传卡片管理查询接口的封装类,accountQuery.py

commons/MySession.py
1 1 #!/usr/bin/python
2 2 # -*- coding: UTF-8 -*-
3 3 import requests
4   -import json
5 4 from commons import common as com
6 5 from commons.Logging import Logger
7 6 from commons.clientSession import cliSession
... ... @@ -29,13 +28,13 @@ class mysession():
29 28 "Accept-Language": "zh-CN,zh-TW;q=0.9,zh;q=0.8,en;q=0.7",
30 29 "Cookie": "UAP_accessToken=;UAP_refreshToken=;UAP_loginPath="}
31 30 header_client = {
32   - "Content-Type": "text/plain;charset\u003dutf-8",
  31 + "Content-Type": "text/plain;charset=utf-8",
33 32 "Host": "test.uap.diligrp.com",
34 33 "Content-Length": "209",
35 34 "Expect": "100-continue"}
36 35  
37 36 body = "userName=sg_wenze&password=111111"
38   - body_client= {"userName":"sg_wenze","password":"key"}
  37 + body_client= {"userName":"sg_wenze","password":"111111"}
39 38  
40 39 def __init__(self):
41 40 "如下代码,可以通过配置文件来控制测试环境和灰度环境,http和https"
... ... @@ -100,7 +99,6 @@ class mysession():
100 99 # 返回session对象,供其他接口使用
101 100 return self.se
102 101  
103   -
104 102 def close_session(self):
105 103 "关闭session"
106 104 self.se.close()
... ... @@ -255,8 +253,9 @@ my = mysession()
255 253 my.set_mark()
256 254 my.cliLogin()
257 255 s1 = my.get_session("sg_user01")
258   -s2 = my.get_session("sg_user02")
259   -s3 = my.get_session_client("sg_user01")
  256 +# s2 = my.get_session("sg_user02")
  257 +# print(s1.cookies)
  258 +# s3 = my.get_session_client("sg_user02")
  259 +# print(s3.cookies)
260 260 # sg1=my.get_session("sg_user01")
261 261 # sy1=my.get_session("sy_user01")
262   -
... ...
commons/api/upStream.py
... ... @@ -4,7 +4,7 @@ import requests
4 4 import json
5 5 import urllib3
6 6 from commons import common as com
7   -from commons.MySession import my
  7 +from commons.MySession import my,s1,s3
8 8 urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
9 9  
10 10 class upStream():
... ...
report/test.log
  1 +[2021-07-22 15:46:06] [INFO] : ======================================================================================
  2 +[2021-07-22 15:46:06] [INFO] : http://test.card.diligrp.com:8386/accountQuery/page.action
  3 +rows=10&page=1&sort=card_create_time&order=desc
  4 +None
  5 +{'headers': {'Host': 'test.card.diligrp.com:8386', 'Connection': 'keep-alive', 'Content-Length': '47', 'Accept': 'application/json,text/javascript,*/*;q=0.01', 'Origin': 'http://test.card.diligrp.com:8386', 'X-Requested-With': 'XMLHttpRequest', 'User-Agent': 'Mozilla/5.0(WindowsNT6.2;WOW64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/84.0.4147.105Safari/537.36', 'Content-Type': 'application/x-www-form-urlencoded', 'Accept-Language': 'zh-CN,zh;q=0.9', 'Referer': 'http://test.card.diligrp.com:8386/accountQuery/list.html', 'Accept-Encoding': 'gzip,deflate'}}
... ...