mirror of https://github.com/testerSunshine/12306
验证码图片改后缀
parent
ec38172b3d
commit
e6ce310eca
|
@ -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()])
|
||||
|
||||
|
|
|
@ -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())
|
|
@ -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"下载验证码成功")
|
||||
|
|
|
@ -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(',')
|
||||
|
|
Loading…
Reference in New Issue