Commit 041d0c6c8b8adfd619c9f830f4a22cd3a02a5eb5

Authored by liujiqiang
1 parent 5d15ed17

gx

commons/MySession.py
@@ -44,7 +44,7 @@ class mysession(): @@ -44,7 +44,7 @@ class mysession():
44 self.webHeaders, self.clientHeaders, self.userInfo = cliSession().loginUser() 44 self.webHeaders, self.clientHeaders, self.userInfo = cliSession().loginUser()
45 45
46 def get_session(self, account, **kwargs): 46 def get_session(self, account, **kwargs):
47 - print("get_session") 47 + # print("get_session")
48 "如下代码,可以通过配置文件来控制登录的账户session" 48 "如下代码,可以通过配置文件来控制登录的账户session"
49 self.body = self.body.replace("sg_wenze", 49 self.body = self.body.replace("sg_wenze",
50 com.get_global_config("global_data", "account", account).split("&")[0]) 50 com.get_global_config("global_data", "account", account).split("&")[0])
@@ -55,7 +55,7 @@ class mysession(): @@ -55,7 +55,7 @@ class mysession():
55 # 使用session对象的方法POST/GET等 55 # 使用session对象的方法POST/GET等
56 re = self.se.post(url=self.url, headers=self.header, data=self.body, proxies=self.proxies, **kwargs) 56 re = self.se.post(url=self.url, headers=self.header, data=self.body, proxies=self.proxies, **kwargs)
57 # 返回session对象,供其他接口使用 57 # 返回session对象,供其他接口使用
58 - print(self.se.cookies) 58 + # print(self.se.cookies)
59 return self.se 59 return self.se
60 60
61 def close_session(self): 61 def close_session(self):
commons/clientSession.py
@@ -12,6 +12,7 @@ @@ -12,6 +12,7 @@
12 import requests 12 import requests
13 import json 13 import json
14 from commons.scripts.readConf import readConfig 14 from commons.scripts.readConf import readConfig
  15 +from commons.scripts.pwdCry import pwdCry
15 16
16 class cliSession(object): 17 class cliSession(object):
17 def __init__(self): 18 def __init__(self):
@@ -20,7 +21,7 @@ class cliSession(object): @@ -20,7 +21,7 @@ class cliSession(object):
20 def __init__(self): 21 def __init__(self):
21 rC = readConfig() 22 rC = readConfig()
22 self.userName = rC.returnOptionsItems("loginInfo","userName") 23 self.userName = rC.returnOptionsItems("loginInfo","userName")
23 - self.password = rC.returnOptionsItems("loginInfo","password") 24 + self.password = pwdCry(rC.returnOptionsItems("loginInfo","password"))
24 self.loginUrl = rC.returnOptionsItems("host","uapHost")+"/api/authenticationApi/loginWeb" 25 self.loginUrl = rC.returnOptionsItems("host","uapHost")+"/api/authenticationApi/loginWeb"
25 self.loginData = {"userName":self.userName,"password":self.password} 26 self.loginData = {"userName":self.userName,"password":self.password}
26 self.webHeaders = {"X-Requested-With":"XMLHttpRequest", 27 self.webHeaders = {"X-Requested-With":"XMLHttpRequest",
commons/scripts/pwdCry.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +
  3 +# @Time : 2021/7/20 10:36
  4 +# @Author : Ljq
  5 +# @File : pwdCry.py
  6 +# @Software: PyCharm
  7 +
  8 +"""
  9 +
  10 +"""
  11 +
  12 +import base64
  13 +from Crypto.Cipher import PKCS1_v1_5 as Cipher_pksc1_v1_5
  14 +from Crypto.PublicKey import RSA
  15 +
  16 +def pwdCry(string):
  17 + public_key = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCgN7kda5L4ztOUquoHjubQIEyqBpjpaYeq+DBKXA3JNOZsMjGwLGVqfCwQg3HHAGTaWnxsp5gjmh0tSziJFgQf2u45TqA2UObOvklRhbWr56QoTNsjm72wZoSOlUzW3xHi/6PocHdy/7bMOiDf6fmYhFBZdRleX6tCAp7w6DsdbQIDAQAB'
  18 + key = '-----BEGIN PUBLIC KEY-----\n' + public_key + '\n-----END PUBLIC KEY-----'
  19 + rsakey = RSA.importKey(key)
  20 + cipher = Cipher_pksc1_v1_5.new(rsakey)
  21 + encrypt_text = cipher.encrypt(string.encode("utf-8"))
  22 + cipher_text = base64.b64encode(encrypt_text)
  23 + return cipher_text.decode()
0 \ No newline at end of file 24 \ No newline at end of file
config/marketConfig/test_config_hg
1 #沈阳市场信息 1 #沈阳市场信息
2 [loginInfo] 2 [loginInfo]
3 userName=scgy 3 userName=scgy
4 -password=DYdgRcAyx2bPboAmu0tgIYBM1kMxFAuDty7IQk4162Zh+8KKa8jtu6xIjG9W4yauTfPiuP1sqxDatskXFqCOz76ea14AqRCYEBz53xVr+vLfcz9zOB2d1T3aIlJbEk8yi2c21pd/MFkBw+Fhd0tky/6eN8kJA8mtsj3uDwSb9qo= 4 +password=123123
5 5
6 [testInfo] 6 [testInfo]
7 #已添加的身份证号 7 #已添加的身份证号