mirror of https://github.com/testerSunshine/12306
增加余票不足优先提交功能
parent
109967ca70
commit
c68cc016e0
|
@ -79,8 +79,9 @@
|
||||||
- 测试下单接口是否可用,有两个下单接口,随便用哪个都ok
|
- 测试下单接口是否可用,有两个下单接口,随便用哪个都ok
|
||||||
- 如果下载验证码过期或者下载失败的问题,应该是12306封ip的策略,多重试几次,12306现在封服务器(阿里云和腾讯云)ip比较严重,尽量不要放在服务器里面
|
- 如果下载验证码过期或者下载失败的问题,应该是12306封ip的策略,多重试几次,12306现在封服务器(阿里云和腾讯云)ip比较严重,尽量不要放在服务器里面
|
||||||
- 感谢一下小伙伴对本项目提供的帮助
|
- 感谢一下小伙伴对本项目提供的帮助
|
||||||
- @ sun7127@126.com
|
- @sun7127@126.com
|
||||||
- @才
|
- @ 才
|
||||||
|
- @MonsterTan
|
||||||
- 以及所有为此项目提供pr的同学
|
- 以及所有为此项目提供pr的同学
|
||||||
- [更新日志](Update.md)
|
- [更新日志](Update.md)
|
||||||
|
|
||||||
|
|
|
@ -134,3 +134,6 @@
|
||||||
- mac和linux服务器自动对点
|
- mac和linux服务器自动对点
|
||||||
- 增加预售踩点查询下单,经测试,误差在0.004s
|
- 增加预售踩点查询下单,经测试,误差在0.004s
|
||||||
|
|
||||||
|
- 2019.01.12更新
|
||||||
|
- 增加对python3语法的支持
|
||||||
|
- 删除校验时间很多机器不兼容的问题(win10会阻拦对时功能,导致大面积报错),如果是预售,为了不耽误宝贵的时间,请手动对时
|
||||||
|
|
|
@ -76,4 +76,4 @@ class CDNProxy:
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
cdn = CDNProxy()
|
cdn = CDNProxy()
|
||||||
cdn.open_cdn_file()
|
print(cdn.open_cdn_file())
|
||||||
|
|
|
@ -15,21 +15,21 @@ def autoSynchroTime():
|
||||||
|
|
||||||
hosts = ['ntp1.aliyun.com', 'ntp2.aliyun.com', 'ntp3.aliyun.com', 'ntp4.aliyun.com', 'cn.pool.ntp.org']
|
hosts = ['ntp1.aliyun.com', 'ntp2.aliyun.com', 'ntp3.aliyun.com', 'ntp4.aliyun.com', 'cn.pool.ntp.org']
|
||||||
|
|
||||||
print(u"正在同步时间,请耐心等待30秒左右")
|
print(u"正在同步时间,请耐心等待30秒左右,如果下面有错误发送,可以忽略!!")
|
||||||
print(u"系统当前时间{}".format(str(datetime.datetime.now())[:22]))
|
print(u"系统当前时间{}".format(str(datetime.datetime.now())[:22]))
|
||||||
system = platform.system()
|
system = platform.system()
|
||||||
if system == "Windows": # windows 同步时间未测试过,参考地址:https://www.jianshu.com/p/92ec15da6cc3
|
if system == "Windows": # windows 同步时间未测试过,参考地址:https://www.jianshu.com/p/92ec15da6cc3
|
||||||
for host in hosts:
|
for host in hosts:
|
||||||
os.system('w32tm /register')
|
os.popen('w32tm /register')
|
||||||
os.system('net start w32time')
|
os.popen('net start w32time')
|
||||||
os.system('w32tm /config /manualpeerlist:"{}" /syncfromflags:manual /reliable:yes /update'.format(host))
|
os.popen('w32tm /config /manualpeerlist:"{}" /syncfromflags:manual /reliable:yes /update'.format(host))
|
||||||
os.system('ping -n 3 127.0.0.1 >nul')
|
os.popen('ping -n 3 127.0.0.1 >nul')
|
||||||
sin = os.system('w32tm /resync')
|
sin = os.popen('w32tm /resync')
|
||||||
if sin is 0:
|
if sin is 0:
|
||||||
break
|
break
|
||||||
else: # mac同步地址,如果ntpdate未安装,brew install ntpdate linux 安装 yum install -y ntpdate
|
else: # mac同步地址,如果ntpdate未安装,brew install ntpdate linux 安装 yum install -y ntpdate
|
||||||
for host in hosts:
|
for host in hosts:
|
||||||
sin = os.system('ntpdate {}'.format(host))
|
sin = os.popen('ntpdate {}'.format(host))
|
||||||
if sin is 0:
|
if sin is 0:
|
||||||
break
|
break
|
||||||
print(u"同步后时间:{}".format(str(datetime.datetime.now())[:22]))
|
print(u"同步后时间:{}".format(str(datetime.datetime.now())[:22]))
|
||||||
|
|
|
@ -11,7 +11,7 @@ urls = {
|
||||||
"Host": "kyfw.12306.cn",
|
"Host": "kyfw.12306.cn",
|
||||||
"Content-Type": 1,
|
"Content-Type": 1,
|
||||||
"re_try": 10,
|
"re_try": 10,
|
||||||
"re_time": 0.1,
|
"re_time": 1,
|
||||||
"s_time": 0.1,
|
"s_time": 0.1,
|
||||||
"is_logger": True,
|
"is_logger": True,
|
||||||
"is_json": True,
|
"is_json": True,
|
||||||
|
@ -23,7 +23,7 @@ urls = {
|
||||||
"Host": "kyfw.12306.cn",
|
"Host": "kyfw.12306.cn",
|
||||||
"Content-Type": 1,
|
"Content-Type": 1,
|
||||||
"re_try": 10,
|
"re_try": 10,
|
||||||
"re_time": 0.1,
|
"re_time": 1,
|
||||||
"s_time": 0.1,
|
"s_time": 0.1,
|
||||||
"is_logger": True,
|
"is_logger": True,
|
||||||
"is_json": True,
|
"is_json": True,
|
||||||
|
@ -36,7 +36,7 @@ urls = {
|
||||||
"Host": "kyfw.12306.cn",
|
"Host": "kyfw.12306.cn",
|
||||||
"Content-Type": 1,
|
"Content-Type": 1,
|
||||||
"re_try": 10,
|
"re_try": 10,
|
||||||
"re_time": 0.1,
|
"re_time": 1,
|
||||||
"s_time": 0.1,
|
"s_time": 0.1,
|
||||||
"is_logger": False,
|
"is_logger": False,
|
||||||
"is_json": False,
|
"is_json": False,
|
||||||
|
@ -49,7 +49,7 @@ urls = {
|
||||||
"Host": "kyfw.12306.cn",
|
"Host": "kyfw.12306.cn",
|
||||||
"Content-Type": 1,
|
"Content-Type": 1,
|
||||||
"re_try": 10,
|
"re_try": 10,
|
||||||
"re_time": 0.1,
|
"re_time": 1,
|
||||||
"s_time": 0.1,
|
"s_time": 0.1,
|
||||||
"is_logger": False,
|
"is_logger": False,
|
||||||
"is_json": False,
|
"is_json": False,
|
||||||
|
@ -62,7 +62,7 @@ urls = {
|
||||||
"Host": "kyfw.12306.cn",
|
"Host": "kyfw.12306.cn",
|
||||||
"Content-Type": 1,
|
"Content-Type": 1,
|
||||||
"re_try": 10,
|
"re_try": 10,
|
||||||
"re_time": 0.1,
|
"re_time": 1,
|
||||||
"s_time": 0.1,
|
"s_time": 0.1,
|
||||||
"is_logger": True,
|
"is_logger": True,
|
||||||
"is_json": True,
|
"is_json": True,
|
||||||
|
@ -73,7 +73,7 @@ urls = {
|
||||||
"Referer": "https://kyfw.12306.cn/otn/index/init",
|
"Referer": "https://kyfw.12306.cn/otn/index/init",
|
||||||
"Host": "kyfw.12306.cn",
|
"Host": "kyfw.12306.cn",
|
||||||
"re_try": 1,
|
"re_try": 1,
|
||||||
"re_time": 0.1,
|
"re_time": 1,
|
||||||
"s_time": 0.1,
|
"s_time": 0.1,
|
||||||
"is_logger": False,
|
"is_logger": False,
|
||||||
"is_json": False,
|
"is_json": False,
|
||||||
|
@ -84,7 +84,7 @@ urls = {
|
||||||
"Referer": "https://kyfw.12306.cn/otn/index/init",
|
"Referer": "https://kyfw.12306.cn/otn/index/init",
|
||||||
"Host": "kyfw.12306.cn",
|
"Host": "kyfw.12306.cn",
|
||||||
"re_try": 1,
|
"re_try": 1,
|
||||||
"re_time": 0.1,
|
"re_time": 1,
|
||||||
"s_time": 0.1,
|
"s_time": 0.1,
|
||||||
"is_logger": False,
|
"is_logger": False,
|
||||||
"is_test_cdn": True,
|
"is_test_cdn": True,
|
||||||
|
@ -96,7 +96,7 @@ urls = {
|
||||||
"Referer": "https://kyfw.12306.cn/otn/passport?redirect=/otn/login/userLogin",
|
"Referer": "https://kyfw.12306.cn/otn/passport?redirect=/otn/login/userLogin",
|
||||||
"Host": "kyfw.12306.cn",
|
"Host": "kyfw.12306.cn",
|
||||||
"re_try": 10,
|
"re_try": 10,
|
||||||
"re_time": 0.1,
|
"re_time": 1,
|
||||||
"s_time": 0.01,
|
"s_time": 0.01,
|
||||||
"is_logger": False,
|
"is_logger": False,
|
||||||
"is_json": False,
|
"is_json": False,
|
||||||
|
@ -107,7 +107,7 @@ urls = {
|
||||||
"Referer": "https://kyfw.12306.cn/otn/passport?redirect=/otn/login/userLogin",
|
"Referer": "https://kyfw.12306.cn/otn/passport?redirect=/otn/login/userLogin",
|
||||||
"Host": "kyfw.12306.cn",
|
"Host": "kyfw.12306.cn",
|
||||||
"re_try": 10,
|
"re_try": 10,
|
||||||
"re_time": 0.1,
|
"re_time": 1,
|
||||||
"s_time": 0.1,
|
"s_time": 0.1,
|
||||||
"is_logger": True,
|
"is_logger": True,
|
||||||
"is_json": True,
|
"is_json": True,
|
||||||
|
@ -119,7 +119,7 @@ urls = {
|
||||||
"Host": "kyfw.12306.cn",
|
"Host": "kyfw.12306.cn",
|
||||||
"Content-Type": 1,
|
"Content-Type": 1,
|
||||||
"re_try": 10,
|
"re_try": 10,
|
||||||
"re_time": 0.1,
|
"re_time": 1,
|
||||||
"s_time": 0.1,
|
"s_time": 0.1,
|
||||||
"is_logger": True,
|
"is_logger": True,
|
||||||
"is_json": True,
|
"is_json": True,
|
||||||
|
@ -337,6 +337,18 @@ urls = {
|
||||||
"is_logger": True,
|
"is_logger": True,
|
||||||
"is_json": True,
|
"is_json": True,
|
||||||
},
|
},
|
||||||
|
"loginAysnSuggest": { # 快速订单排队
|
||||||
|
"req_url": "/otn/login/loginAysnSuggest",
|
||||||
|
"req_type": "post",
|
||||||
|
"Referer": "https://kyfw.12306.cn/otn/leftTicket/init",
|
||||||
|
"Content-Type": 1,
|
||||||
|
"Host": "kyfw.12306.cn",
|
||||||
|
"re_try": 10,
|
||||||
|
"re_time": 0.01,
|
||||||
|
"s_time": 0.1,
|
||||||
|
"is_logger": True,
|
||||||
|
"is_json": True,
|
||||||
|
},
|
||||||
"cdn_host": {
|
"cdn_host": {
|
||||||
"req_url": "http://ping.chinaz.com/kyfw.12306.cn",
|
"req_url": "http://ping.chinaz.com/kyfw.12306.cn",
|
||||||
"req_type": "post"
|
"req_type": "post"
|
||||||
|
|
|
@ -7,7 +7,10 @@ class RClient(object):
|
||||||
|
|
||||||
def __init__(self, username, password):
|
def __init__(self, username, password):
|
||||||
self.username = username
|
self.username = username
|
||||||
|
try:
|
||||||
self.password = md5(password).hexdigest()
|
self.password = md5(password).hexdigest()
|
||||||
|
except TypeError:
|
||||||
|
self.password = md5(password.encode('utf-8')).hexdigest()
|
||||||
self.soft_id = '96061'
|
self.soft_id = '96061'
|
||||||
self.soft_key = '6facb9da7bb645ad9c4a229464b2cf89'
|
self.soft_key = '6facb9da7bb645ad9c4a229464b2cf89'
|
||||||
self.base_params = {
|
self.base_params = {
|
||||||
|
|
|
@ -70,7 +70,10 @@ class select:
|
||||||
to_station = ticket_info_config["set"]["to_station"]
|
to_station = ticket_info_config["set"]["to_station"]
|
||||||
station_dates = ticket_info_config["set"]["station_dates"]
|
station_dates = ticket_info_config["set"]["station_dates"]
|
||||||
set_names = ticket_info_config["set"]["set_type"]
|
set_names = ticket_info_config["set"]["set_type"]
|
||||||
|
try:
|
||||||
set_type = [seat_conf[x.encode("utf-8")] for x in ticket_info_config["set"]["set_type"]]
|
set_type = [seat_conf[x.encode("utf-8")] for x in ticket_info_config["set"]["set_type"]]
|
||||||
|
except KeyError:
|
||||||
|
set_type = [seat_conf[x] for x in ticket_info_config["set"]["set_type"]]
|
||||||
is_more_ticket = ticket_info_config["set"]["is_more_ticket"]
|
is_more_ticket = ticket_info_config["set"]["is_more_ticket"]
|
||||||
ticke_peoples = ticket_info_config["set"]["ticke_peoples"]
|
ticke_peoples = ticket_info_config["set"]["ticke_peoples"]
|
||||||
station_trains = ticket_info_config["set"]["station_trains"]
|
station_trains = ticket_info_config["set"]["station_trains"]
|
||||||
|
@ -134,8 +137,12 @@ class select:
|
||||||
for i in range(0, len(info)):
|
for i in range(0, len(info)):
|
||||||
n_info = info[i].split('|')
|
n_info = info[i].split('|')
|
||||||
station_name[n_info[1]] = n_info[2]
|
station_name[n_info[1]] = n_info[2]
|
||||||
|
try:
|
||||||
from_station = station_name[from_station.encode("utf8")]
|
from_station = station_name[from_station.encode("utf8")]
|
||||||
to_station = station_name[to_station.encode("utf8")]
|
to_station = station_name[to_station.encode("utf8")]
|
||||||
|
except KeyError:
|
||||||
|
from_station = station_name[from_station]
|
||||||
|
to_station = station_name[to_station]
|
||||||
return from_station, to_station
|
return from_station, to_station
|
||||||
|
|
||||||
def call_login(self, auth=False):
|
def call_login(self, auth=False):
|
||||||
|
@ -182,7 +189,8 @@ class select:
|
||||||
raise ticketConfigException(u"cdn列表为空,请先加载cdn")
|
raise ticketConfigException(u"cdn列表为空,请先加载cdn")
|
||||||
|
|
||||||
def main(self):
|
def main(self):
|
||||||
autoSynchroTime() # 同步时间
|
# autoSynchroTime() # 同步时间
|
||||||
|
try:
|
||||||
self.cdn_certification()
|
self.cdn_certification()
|
||||||
l = liftTicketInit(self)
|
l = liftTicketInit(self)
|
||||||
l.reqLiftTicketInit()
|
l.reqLiftTicketInit()
|
||||||
|
@ -193,8 +201,9 @@ class select:
|
||||||
t.start()
|
t.start()
|
||||||
from_station, to_station = self.station_table(self.from_station, self.to_station)
|
from_station, to_station = self.station_table(self.from_station, self.to_station)
|
||||||
num = 0
|
num = 0
|
||||||
|
s = getPassengerDTOs(session=self, ticket_peoples=self.ticke_peoples)
|
||||||
|
s.sendGetPassengerDTOs()
|
||||||
while 1:
|
while 1:
|
||||||
try:
|
|
||||||
num += 1
|
num += 1
|
||||||
now = datetime.datetime.now() # 感谢群里大佬提供整点代码
|
now = datetime.datetime.now() # 感谢群里大佬提供整点代码
|
||||||
configCommon.checkSleepTime(self) # 晚上到点休眠
|
configCommon.checkSleepTime(self) # 晚上到点休眠
|
||||||
|
@ -282,19 +291,14 @@ class select:
|
||||||
time.sleep(random_time)
|
time.sleep(random_time)
|
||||||
except PassengerUserException as e:
|
except PassengerUserException as e:
|
||||||
print(e)
|
print(e)
|
||||||
break
|
|
||||||
except ticketConfigException as e:
|
except ticketConfigException as e:
|
||||||
print(e)
|
print(e)
|
||||||
break
|
|
||||||
except ticketIsExitsException as e:
|
except ticketIsExitsException as e:
|
||||||
print(e)
|
print(e)
|
||||||
break
|
|
||||||
except ticketNumOutException as e:
|
except ticketNumOutException as e:
|
||||||
print(e)
|
print(e)
|
||||||
break
|
|
||||||
except UserPasswordException as e:
|
except UserPasswordException as e:
|
||||||
print(e)
|
print(e)
|
||||||
break
|
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
if e == "No JSON object could be decoded":
|
if e == "No JSON object could be decoded":
|
||||||
print(u"12306接口无响应,正在重试")
|
print(u"12306接口无响应,正在重试")
|
||||||
|
|
|
@ -25,7 +25,10 @@ class autoSubmitOrderRequest:
|
||||||
leftTicket,
|
leftTicket,
|
||||||
set_type,):
|
set_type,):
|
||||||
self.set_type = set_type
|
self.set_type = set_type
|
||||||
|
try:
|
||||||
self.secretStr = urllib.unquote(secretStr)
|
self.secretStr = urllib.unquote(secretStr)
|
||||||
|
except AttributeError:
|
||||||
|
self.secretStr = urllib.parse.unquote(secretStr)
|
||||||
self.train_date = train_date
|
self.train_date = train_date
|
||||||
self.query_from_station_name = query_from_station_name
|
self.query_from_station_name = query_from_station_name
|
||||||
self.query_to_station_name = query_to_station_name
|
self.query_to_station_name = query_to_station_name
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
# coding=utf-8
|
# coding=utf-8
|
||||||
|
import json
|
||||||
|
|
||||||
from config.TicketEnmu import ticket
|
from config.TicketEnmu import ticket
|
||||||
from myException.PassengerUserException import PassengerUserException
|
from myException.PassengerUserException import PassengerUserException
|
||||||
import wrapcache
|
import wrapcache
|
||||||
|
@ -14,19 +16,21 @@ class getPassengerDTOs:
|
||||||
获取乘客信息
|
获取乘客信息
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
def __init__(self, session, ticket_peoples, set_type, is_more_ticket_num):
|
def __init__(self, session, ticket_peoples=None, set_type=None, is_more_ticket_num=None):
|
||||||
"""
|
"""
|
||||||
:param session: 登录实例
|
:param session: 登录实例
|
||||||
:param ticket_peoples: 乘客
|
:param ticket_peoples: 乘客
|
||||||
:param set_type: 坐席
|
:param set_type: 坐席
|
||||||
"""
|
"""
|
||||||
|
if ticket_peoples is None:
|
||||||
|
ticket_peoples = []
|
||||||
self.session = session
|
self.session = session
|
||||||
self.ticket_peoples = ticket_peoples
|
self.ticket_peoples = ticket_peoples
|
||||||
self.is_more_ticket_num = is_more_ticket_num
|
self.is_more_ticket_num = is_more_ticket_num
|
||||||
self.set_type = set_type.encode("utf8")
|
self.set_type = set_type
|
||||||
|
|
||||||
def sendGetPassengerDTOs(self):
|
def sendGetPassengerDTOs(self):
|
||||||
getPassengerDTOsResult = self.session.httpClint.send(self.session.urls["get_passengerDTOs"], {})
|
getPassengerDTOsResult = self.session.httpClint.send(self.session.urls["get_passengerDTOs"], json.dumps({"_json_att": ""}))
|
||||||
if getPassengerDTOsResult.get("data", False) and getPassengerDTOsResult["data"].get("normal_passengers", False):
|
if getPassengerDTOsResult.get("data", False) and getPassengerDTOsResult["data"].get("normal_passengers", False):
|
||||||
normal_passengers = getPassengerDTOsResult['data']['normal_passengers']
|
normal_passengers = getPassengerDTOsResult['data']['normal_passengers']
|
||||||
_normal_passenger = [normal_passengers[i] for i in range(len(normal_passengers)) if
|
_normal_passenger = [normal_passengers[i] for i in range(len(normal_passengers)) if
|
||||||
|
@ -38,8 +42,10 @@ class getPassengerDTOs:
|
||||||
elif getPassengerDTOsResult.get('messages', False):
|
elif getPassengerDTOsResult.get('messages', False):
|
||||||
print(getPassengerDTOsResult.get('messages', False))
|
print(getPassengerDTOsResult.get('messages', False))
|
||||||
else:
|
else:
|
||||||
print(getPassengerDTOsResult)
|
print(u"警告:您的账号可能买票有问题,获取不到联系人,请测试是否能正常下单,在捡漏或者购票!!!")
|
||||||
raise PassengerUserException(ticket.DTO_NOT_FOUND)
|
print(u"警告:您的账号可能买票有问题,获取不到联系人,请测试是否能正常下单,在捡漏或者购票!!!")
|
||||||
|
print(u"警告:您的账号可能买票有问题,获取不到联系人,请测试是否能正常下单,在捡漏或者购票!!!")
|
||||||
|
# raise PassengerUserException(ticket.DTO_NOT_FOUND)
|
||||||
|
|
||||||
def getPassengerTicketStr(self, set_type):
|
def getPassengerTicketStr(self, set_type):
|
||||||
"""
|
"""
|
||||||
|
@ -57,7 +63,6 @@ class getPassengerDTOs:
|
||||||
'软座': 2,
|
'软座': 2,
|
||||||
'软卧': 4,
|
'软卧': 4,
|
||||||
'硬卧': 3,
|
'硬卧': 3,
|
||||||
'动卧': 1,
|
|
||||||
}
|
}
|
||||||
return str(passengerTicketStr[set_type.replace(' ', '')])
|
return str(passengerTicketStr[set_type.replace(' ', '')])
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
# coding=utf-8
|
# coding=utf-8
|
||||||
import datetime
|
import datetime
|
||||||
|
import sys
|
||||||
import time
|
import time
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
import wrapcache
|
import wrapcache
|
||||||
|
@ -46,7 +47,10 @@ class getQueueCount:
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if sys.version_info.major is 2:
|
||||||
new_train_date = filter(None, str(time.asctime(time.strptime(self.station_dates, "%Y-%m-%d"))).split(" "))
|
new_train_date = filter(None, str(time.asctime(time.strptime(self.station_dates, "%Y-%m-%d"))).split(" "))
|
||||||
|
else:
|
||||||
|
new_train_date = list(filter(None, str(time.asctime(time.strptime(self.station_dates, "%Y-%m-%d"))).split(" ")))
|
||||||
data = OrderedDict()
|
data = OrderedDict()
|
||||||
data['train_date'] = "{0} {1} 0{2} {3} 00:00:00 GMT+0800 (中国标准时间)".format(
|
data['train_date'] = "{0} {1} 0{2} {3} 00:00:00 GMT+0800 (中国标准时间)".format(
|
||||||
new_train_date[0],
|
new_train_date[0],
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
# coding=utf-8
|
# coding=utf-8
|
||||||
import datetime
|
import datetime
|
||||||
|
import sys
|
||||||
import time
|
import time
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
|
@ -56,7 +57,10 @@ class getQueueCountAsync:
|
||||||
- _json_att 没啥卵用,还是带上吧
|
- _json_att 没啥卵用,还是带上吧
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
|
if sys.version_info.major is 2:
|
||||||
new_train_date = filter(None, str(time.asctime(time.strptime(self.station_dates, "%Y-%m-%d"))).split(" "))
|
new_train_date = filter(None, str(time.asctime(time.strptime(self.station_dates, "%Y-%m-%d"))).split(" "))
|
||||||
|
else:
|
||||||
|
new_train_date = list(filter(None, str(time.asctime(time.strptime(self.station_dates, "%Y-%m-%d"))).split(" ")))
|
||||||
data = OrderedDict()
|
data = OrderedDict()
|
||||||
data['train_date'] = "{0} {1} {2} {3} 00:00:00 GMT+0800 (中国标准时间)".format(
|
data['train_date'] = "{0} {1} {2} {3} 00:00:00 GMT+0800 (中国标准时间)".format(
|
||||||
new_train_date[0],
|
new_train_date[0],
|
||||||
|
|
|
@ -103,7 +103,7 @@ class query:
|
||||||
if result:
|
if result:
|
||||||
for i in value['result']:
|
for i in value['result']:
|
||||||
ticket_info = i.split('|')
|
ticket_info = i.split('|')
|
||||||
if ticket_info[11] == "Y" and ticket_info[1].encode("utf8") == "预订": # 筛选未在开始时间内的车次
|
if ticket_info[11] == "Y" and ticket_info[1] == "预订": # 筛选未在开始时间内的车次
|
||||||
for j in self._station_seat:
|
for j in self._station_seat:
|
||||||
is_ticket_pass = ticket_info[j]
|
is_ticket_pass = ticket_info[j]
|
||||||
if is_ticket_pass != '' and is_ticket_pass != '无' and is_ticket_pass != '*' and self.check_is_need_train(
|
if is_ticket_pass != '' and is_ticket_pass != '无' and is_ticket_pass != '*' and self.check_is_need_train(
|
||||||
|
|
|
@ -19,7 +19,10 @@ class submitOrderRequest:
|
||||||
def __init__(self, session, secretStr, from_station, to_station, train_no, set_type,
|
def __init__(self, session, secretStr, from_station, to_station, train_no, set_type,
|
||||||
passengerTicketStrList, oldPassengerStr, train_date, ticke_peoples):
|
passengerTicketStrList, oldPassengerStr, train_date, ticke_peoples):
|
||||||
self.session = session
|
self.session = session
|
||||||
self.secretStr = secretStr
|
try:
|
||||||
|
self.secretStr = urllib.unquote(secretStr)
|
||||||
|
except AttributeError:
|
||||||
|
self.secretStr = urllib.parse.unquote(secretStr)
|
||||||
self.from_station = from_station
|
self.from_station = from_station
|
||||||
self.to_station = to_station
|
self.to_station = to_station
|
||||||
self.to_station = to_station
|
self.to_station = to_station
|
||||||
|
@ -34,7 +37,7 @@ class submitOrderRequest:
|
||||||
"""
|
"""
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
data = [('secretStr', urllib.unquote(self.secretStr)), # 字符串加密
|
data = [('secretStr', self.secretStr), # 字符串加密
|
||||||
('train_date', self.train_date), # 出发时间
|
('train_date', self.train_date), # 出发时间
|
||||||
('back_train_date', time()), # 返程时间
|
('back_train_date', time()), # 返程时间
|
||||||
('tour_flag', 'dc'), # 旅途类型
|
('tour_flag', 'dc'), # 旅途类型
|
||||||
|
|
Loading…
Reference in New Issue