验证码图片改后缀

pull/108/head
wenxianping 2019-01-07 17:48:41 +08:00
parent ec38172b3d
commit e6ce310eca
5 changed files with 19 additions and 15 deletions

View File

@ -18,17 +18,17 @@ RS_JSON_ERROR = 2
RS_OTHER_ERROR = 3
seat_conf = {'商务座': 32,
'一等座': 31,
'二等座': 30,
'特等座': 25,
'软卧': 23,
'硬卧': 28,
'软座': 24,
'硬座': 29,
'无座': 26,
}
'一等座': 31,
'二等座': 30,
'特等座': 25,
'软卧': 23,
'硬卧': 28,
'软座': 24,
'硬座': 29,
'无座': 26,
}
if sys.version_info.major == 2:
seat_conf_2 = dict([(v,k) for (k,v) in seat_conf.iteritems()])
seat_conf_2 = dict([(v, k) for (k, v) in seat_conf.iteritems()])
else:
seat_conf_2 = dict([(v, k) for (k, v) in seat_conf.items()])

View File

@ -13,4 +13,8 @@ def _get_yaml():
f = open(path)
s = yaml.load(f)
f.close()
return s.decode() if isinstance(s, bytes) else s
return s.decode() if isinstance(s, bytes) else s
if __name__ == '__main__':
print(_get_yaml())

View File

@ -18,11 +18,11 @@ def getPassCodeNewOrderAndLogin(session, imgType):
codeImgUrl = copy.deepcopy(session.urls["codeImgByOrder"])
codeImgUrl["req_url"] = codeImgUrl["req_url"].format(random.random())
print (u"下载验证码...")
img_path = './tkcode'
img_path = './tkcode.png'
result = session.httpClint.send(codeImgUrl)
try:
if isinstance(result, dict):
print(u"下载验证码失败, 请手动检查是否ip被封或者重试请求地址{}".format(codeImgUrl.get("req_url")))
print(u"下载验证码失败, 请手动检查是否ip被封或者重试请求地址https://kyfw.12306.cn/{}".format(codeImgUrl.get("req_url")))
return False
else:
print(u"下载验证码成功")

View File

@ -26,7 +26,7 @@ def getRandCode(is_auto_code, auto_code_type, result):
print(u"打码平台错误: {0}, 请登录打码平台查看-http://www.ruokuai.com/client/index?6726".format(Result["Error"]))
return ""
else:
img = Image.open('./tkcode')
img = Image.open('./tkcode.png')
img.show()
return codexy()
except Exception as e:
@ -46,7 +46,7 @@ def codexy(Ofset=None, is_raw_input=True):
| 5 | 6 | 7 | 8 |
*****************
""")
print(u"验证码分为8个对应上面数字例如第一和第二张输入1, 2")
print(u"验证码分为8个对应上面数字例如第一和第二张输入1, 2 如果开启cdn查询的话会冲掉提示直接鼠标点击命令行获取焦点输入即可不要输入空格")
Ofset = raw_input(u"输入对应的验证码: ")
Ofset = Ofset.replace("", ",")
select = Ofset.split(',')

BIN
tkcode

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB