mirror of https://github.com/testerSunshine/12306
parent
b37aadfc93
commit
b36595aead
|
@ -23,7 +23,7 @@ def sendEmail(msg):
|
||||||
host = email_conf["email_conf"]["host"]
|
host = email_conf["email_conf"]["host"]
|
||||||
s = "{0}".format(msg)
|
s = "{0}".format(msg)
|
||||||
|
|
||||||
msg = MIMEText(s, 'text', 'utf-8') # 中文需参数‘utf-8’,单字节字符不需要
|
msg = MIMEText(s, 'plain', 'utf-8') # 中文需参数‘utf-8’,单字节字符不需要
|
||||||
msg['Subject'] = Header(subject, 'utf-8')
|
msg['Subject'] = Header(subject, 'utf-8')
|
||||||
msg['From'] = sender
|
msg['From'] = sender
|
||||||
msg['To'] = receiver
|
msg['To'] = receiver
|
||||||
|
|
|
@ -166,11 +166,16 @@ class GoLogin:
|
||||||
uamauthclientUrl = self.urlConf["uamauthclient"]["req_url"]
|
uamauthclientUrl = self.urlConf["uamauthclient"]["req_url"]
|
||||||
data = {"tk": uamtk}
|
data = {"tk": uamtk}
|
||||||
uamauthclientResult = self.httpClint.send(uamauthclientUrl, data)
|
uamauthclientResult = self.httpClint.send(uamauthclientUrl, data)
|
||||||
if "result_code" in uamauthclientResult and uamauthclientResult["result_code"] == 0:
|
if uamauthclientResult:
|
||||||
print("欢迎 {} 登录".format(uamauthclientResult["username"]))
|
if "result_code" in uamauthclientResult and uamauthclientResult["result_code"] == 0:
|
||||||
return True
|
print("欢迎 {} 登录".format(uamauthclientResult["username"]))
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
else:
|
else:
|
||||||
return False
|
self.httpClint.send(uamauthclientUrl, data)
|
||||||
|
url = self.urlConf["getUserInfo"]["req_url"]
|
||||||
|
self.httpClint.send(url)
|
||||||
|
|
||||||
def go_login(self):
|
def go_login(self):
|
||||||
"""
|
"""
|
||||||
|
@ -192,8 +197,8 @@ class GoLogin:
|
||||||
if self.codeCheck():
|
if self.codeCheck():
|
||||||
uamtk = self.baseLogin(user, passwd)
|
uamtk = self.baseLogin(user, passwd)
|
||||||
if uamtk:
|
if uamtk:
|
||||||
if self.getUserName(uamtk):
|
self.getUserName(uamtk)
|
||||||
break
|
break
|
||||||
|
|
||||||
def logout(self):
|
def logout(self):
|
||||||
url = 'https://kyfw.12306.cn/otn/login/loginOut'
|
url = 'https://kyfw.12306.cn/otn/login/loginOut'
|
||||||
|
|
Loading…
Reference in New Issue