|
|
@ -39,6 +39,7 @@ class query:
|
|
|
|
self.arrival_time = session.arrival_time
|
|
|
|
self.arrival_time = session.arrival_time
|
|
|
|
self.take_time = session.take_time
|
|
|
|
self.take_time = session.take_time
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
@classmethod
|
|
|
|
def station_seat(self, index):
|
|
|
|
def station_seat(self, index):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
@ -80,9 +81,9 @@ class query:
|
|
|
|
查询
|
|
|
|
查询
|
|
|
|
:return:
|
|
|
|
:return:
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
t1 = threading.Thread(target=self.set_cdn, args=())
|
|
|
|
if self.session.is_cdn == 1:
|
|
|
|
t1.setDaemon(True)
|
|
|
|
if self.session.cdn_list:
|
|
|
|
t1.start()
|
|
|
|
self.httpClint.cdn = self.session.cdn_list[random.randint(0, len(self.session.cdn_list) - 1)]
|
|
|
|
for station_date in self.station_dates:
|
|
|
|
for station_date in self.station_dates:
|
|
|
|
select_url = copy.copy(self.urls["select_url"])
|
|
|
|
select_url = copy.copy(self.urls["select_url"])
|
|
|
|
select_url["req_url"] = select_url["req_url"].format(station_date, self.from_station, self.to_station,
|
|
|
|
select_url["req_url"] = select_url["req_url"].format(station_date, self.from_station, self.to_station,
|
|
|
@ -163,19 +164,6 @@ class query:
|
|
|
|
print u"车次配置信息有误,或者返回数据异常,请检查 {}".format(station_ticket)
|
|
|
|
print u"车次配置信息有误,或者返回数据异常,请检查 {}".format(station_ticket)
|
|
|
|
return {"code": ticket.FAIL_CODE, "status": False}
|
|
|
|
return {"code": ticket.FAIL_CODE, "status": False}
|
|
|
|
|
|
|
|
|
|
|
|
def set_cdn(self):
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
设置cdn
|
|
|
|
|
|
|
|
:return:
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
if self.session.is_cdn == 1:
|
|
|
|
|
|
|
|
while True:
|
|
|
|
|
|
|
|
if self.session.cdn_list:
|
|
|
|
|
|
|
|
time.sleep(0.1)
|
|
|
|
|
|
|
|
self.httpClint.cdn = self.session.cdn_list[random.randint(0, len(self.session.cdn_list) - 1)]
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
time.sleep(0.1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
if __name__ == "__main__":
|
|
|
|
q = query()
|
|
|
|
q = query()
|
|
|
|