Commit a4a746814d29f31724b58db2ab9f146e58de3dea
1 parent
f8af1ae7
更新进门称重的方法
Showing
2 changed files
with
14 additions
and
7 deletions
commons/MySession.py
... | ... | @@ -111,7 +111,6 @@ class mysession(): |
111 | 111 | co.set("UAP_firmId", str(self.re.json()["data"]["user"]["firmId"])) |
112 | 112 | co.set("UAP_accessToken", self.re.json()["data"]["accessToken"]) |
113 | 113 | co.set("UAP_refreshToken", self.re.json()["data"]["refreshToken"]) |
114 | - print(dir(co)) | |
115 | 114 | self.se.cookies.update(co) |
116 | 115 | # 返回session对象,供其他接口使用 |
117 | 116 | return self.se | ... | ... |
commons/api/duplicateToken.py
... | ... | @@ -2,8 +2,9 @@ |
2 | 2 | # -*- coding: UTF-8 -*- |
3 | 3 | import urllib3 |
4 | 4 | from commons import common as com |
5 | -from commons.MySession import my,s1 | |
5 | +from commons.MySession import my,s1,s2 | |
6 | 6 | import requests |
7 | +from requests.cookies import remove_cookie_by_name | |
7 | 8 | |
8 | 9 | urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) |
9 | 10 | |
... | ... | @@ -20,18 +21,25 @@ class duplicateToken(): |
20 | 21 | def __init__(self): |
21 | 22 | self.url = duplicateToken.url.replace("http://test.", com.get_global_config("global_data", "environment", "en")) |
22 | 23 | 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"] | |
24 | + self.header["UAP_accessToken"] = s2.cookies["UAP_accessToken"] | |
25 | + self.header["UAP_refreshToken"] = s2.cookies["UAP_refreshToken"] | |
26 | + self.header["UAP_firmId"] = s2.cookies["UAP_firmId"] | |
26 | 27 | self.header["Host"] = com.get_global_config("global_data", "host", "gateway") |
27 | 28 | |
28 | 29 | def jmsf_duplicate_commit_token(self): |
29 | - re = s1.get(url=self.url, headers=self.header) | |
30 | + re = s2.get(url=self.url, headers=self.header) | |
31 | + print(s2.cookies) | |
32 | + print(s2.cookies.list_domains()) | |
33 | + print(s2.cookies.list_paths()) | |
34 | + # remove_cookie_by_name(s2.cookies,domain="",name="UAP_accessToken") | |
35 | + # remove_cookie_by_name(s2.cookies,domain="",name="UAP_refreshToken") | |
36 | + # print(s2.cookies) | |
30 | 37 | return re.json()["data"] |
31 | 38 | |
32 | 39 | |
33 | 40 | # print(s1.headers) |
34 | -# du=duplicateToken() | |
41 | +du=duplicateToken() | |
42 | +du.jmsf_duplicate_commit_token() | |
35 | 43 | # print(du.jmsf_duplicate_commit_token()) |
36 | 44 | # print(re.json()) |
37 | 45 | # print(re.headers) |
38 | 46 | \ No newline at end of file | ... | ... |