diff --git a/config/TicketEnmu.py b/config/TicketEnmu.py index 377e09f..075bc5d 100644 --- a/config/TicketEnmu.py +++ b/config/TicketEnmu.py @@ -22,7 +22,7 @@ class ticket(object): QUEUE_JOIN_BLACK = u"排队发现未知错误{0},将此列车 {1}加入小黑屋" QUEUE_WARNING_MSG = u"排队异常,错误信息:{0}, 将此列车 {1}加入小黑屋" - OUT_NUM = 30 # 排队请求12306的次数 + OUT_NUM = 120 # 排队请求12306的次数 WAIT_OUT_NUM = u"超出排队时间,自动放弃,正在重新刷票" WAIT_ORDER_SUCCESS = u"恭喜您订票成功,订单号为:{0}, 请立即打开浏览器登录12306,访问‘未完成订单’,在30分钟内完成支付!" WAIT_ORDER_CONTINUE = u"排队等待时间预计还剩 {0} ms" diff --git a/inter/Query.py b/inter/Query.py index 0d20bcc..0bbc48b 100644 --- a/inter/Query.py +++ b/inter/Query.py @@ -39,6 +39,7 @@ class query: self.arrival_time = session.arrival_time self.take_time = session.take_time + @classmethod def station_seat(self, index): """ @@ -80,9 +81,9 @@ class query: 查询 :return: """ - t1 = threading.Thread(target=self.set_cdn, args=()) - t1.setDaemon(True) - t1.start() + if self.session.is_cdn == 1: + if self.session.cdn_list: + self.httpClint.cdn = self.session.cdn_list[random.randint(0, len(self.session.cdn_list) - 1)] for station_date in self.station_dates: 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, @@ -163,19 +164,6 @@ class query: print u"车次配置信息有误,或者返回数据异常,请检查 {}".format(station_ticket) 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__": q = query()