修正下载验证码失败问题

pull/29/head
wenxianping 7 years ago
parent 4c5c036286
commit ec88dffe4f

@ -45,28 +45,31 @@ class GoLogin:
codeimgUrl = code_url codeimgUrl = code_url
img_path = './tkcode' img_path = './tkcode'
result = self.httpClint.send(codeimgUrl, is_logger=False) result = self.httpClint.send(codeimgUrl, is_logger=False)
try: if "message" in result:
open(img_path, 'wb').write(result) print("验证码下载失败,正在重试")
if self.is_aotu_code: else:
if self.aotu_code_type == 1: try:
return DamatuApi(_get_yaml()["damatu"]["uesr"], _get_yaml()["damatu"]["pwd"], img_path).main() open(img_path, 'wb').write(result)
elif self.aotu_code_type == 2: if self.is_aotu_code:
rc = RClient(_get_yaml()["damatu"]["uesr"], _get_yaml()["damatu"]["pwd"]) if self.aotu_code_type == 1:
im = open('./tkcode', 'rb').read() return DamatuApi(_get_yaml()["damatu"]["uesr"], _get_yaml()["damatu"]["pwd"], img_path).main()
Result = rc.rk_create(im, 6113) elif self.aotu_code_type == 2:
if "Result" in Result: rc = RClient(_get_yaml()["damatu"]["uesr"], _get_yaml()["damatu"]["pwd"])
return self.codexy(Ofset=",".join(list(Result["Result"])), is_raw_input=False) im = open('./tkcode', 'rb').read()
else: Result = rc.rk_create(im, 6113)
if "Error" in Result and Result["Error"]: if "Result" in Result:
print Result["Error"] return self.codexy(Ofset=",".join(list(Result["Result"])), is_raw_input=False)
return "" else:
else: if "Error" in Result and Result["Error"]:
img = Image.open('./tkcode') print Result["Error"]
img.show() return ""
return self.codexy() else:
except OSError as e: img = Image.open('./tkcode')
print (e) img.show()
return "" return self.codexy()
except OSError as e:
print (e)
return ""
def codexy(self, Ofset=None, is_raw_input=True): def codexy(self, Ofset=None, is_raw_input=True):
""" """

Loading…
Cancel
Save