mirror of https://github.com/testerSunshine/12306
parent
b37aadfc93
commit
b36595aead
|
@ -23,7 +23,7 @@ def sendEmail(msg):
|
|||
host = email_conf["email_conf"]["host"]
|
||||
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['From'] = sender
|
||||
msg['To'] = receiver
|
||||
|
|
|
@ -166,11 +166,16 @@ class GoLogin:
|
|||
uamauthclientUrl = self.urlConf["uamauthclient"]["req_url"]
|
||||
data = {"tk": uamtk}
|
||||
uamauthclientResult = self.httpClint.send(uamauthclientUrl, data)
|
||||
if "result_code" in uamauthclientResult and uamauthclientResult["result_code"] == 0:
|
||||
print("欢迎 {} 登录".format(uamauthclientResult["username"]))
|
||||
return True
|
||||
if uamauthclientResult:
|
||||
if "result_code" in uamauthclientResult and uamauthclientResult["result_code"] == 0:
|
||||
print("欢迎 {} 登录".format(uamauthclientResult["username"]))
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
else:
|
||||
return False
|
||||
self.httpClint.send(uamauthclientUrl, data)
|
||||
url = self.urlConf["getUserInfo"]["req_url"]
|
||||
self.httpClint.send(url)
|
||||
|
||||
def go_login(self):
|
||||
"""
|
||||
|
@ -192,8 +197,8 @@ class GoLogin:
|
|||
if self.codeCheck():
|
||||
uamtk = self.baseLogin(user, passwd)
|
||||
if uamtk:
|
||||
if self.getUserName(uamtk):
|
||||
break
|
||||
self.getUserName(uamtk)
|
||||
break
|
||||
|
||||
def logout(self):
|
||||
url = 'https://kyfw.12306.cn/otn/login/loginOut'
|
||||
|
|
Loading…
Reference in New Issue