def sendQueryOrderWaitTime(self):
     """
     排队获取订单等待信息,每隔3秒请求一次,最高请求次数为20次!
     :return:
     """
     num = 1
     while True:
         num += 1
         if num > ticket.OUT_NUM:
             print(ticket.WAIT_OUT_NUM)
             order_id = self.queryMyOrderNoComplete()  # 排队失败,自动取消排队订单
             if order_id:
                 self.cancelNoCompleteMyOrder(order_id)
             break
         try:
             queryOrderWaitTimeUrl = copy.deepcopy(
                 self.session.urls["queryOrderWaitTimeUrl"])
             queryOrderWaitTimeUrl["req_url"] = queryOrderWaitTimeUrl[
                 "req_url"].format(int(round(time.time() * 1000)))
             queryOrderWaitTimeResult = self.session.httpClint.send(
                 queryOrderWaitTimeUrl)
         except ValueError:
             queryOrderWaitTimeResult = {}
         if queryOrderWaitTimeResult:
             if queryOrderWaitTimeResult.get("status", False):
                 data = queryOrderWaitTimeResult.get("data", False)
                 if data and data.get("orderId", ""):
                     sendIFTTT(
                         ticket.WAIT_ORDER_SUCCESS.format(
                             data.get("orderId", "")))
                     sendEmail(
                         ticket.WAIT_ORDER_SUCCESS.format(
                             data.get("orderId", "")))
                     sendPushBear(
                         ticket.WAIT_ORDER_SUCCESS.format(
                             data.get("orderId", "")))
                     raise ticketIsExitsException(
                         ticket.WAIT_ORDER_SUCCESS.format(
                             data.get("orderId")))
                 elif data.get("msg", False):
                     print(data.get("msg", ""))
                     break
                 elif data.get("waitTime", False):
                     print(
                         ticket.WAIT_ORDER_CONTINUE.format(
                             0 - data.get("waitTime", False)))
                 else:
                     pass
             elif queryOrderWaitTimeResult.get("messages", False):
                 print(
                     ticket.WAIT_ORDER_FAIL.format(
                         queryOrderWaitTimeResult.get("messages", "")))
             else:
                 print(ticket.WAIT_ORDER_NUM.format(num + 1))
         else:
             pass
         time.sleep(2)
     else:
         print(ticketNumOutException(ticket.WAIT_ORDER_SUB_FAIL))
Beispiel #2
0
 def sendQueryQueueByAfterNate(self):
     for i in range(10):
         queryQueueByAfterNateRsp = self.session.httpClint.send(urls.get("queryQueue"))
         if not queryQueueByAfterNateRsp.get("status"):
             print("".join(queryQueueByAfterNateRsp.get("messages")) or queryQueueByAfterNateRsp.get("validateMessages"))
             time.sleep(1)
         else:
             sendEmail(ticket.WAIT_ORDER_SUCCESS)
             sendPushBear(ticket.WAIT_ORDER_SUCCESS)
             sendServerChan(ticket.WAIT_ORDER_SUCCESS)
             raise ticketIsExitsException(ticket.WAIT_AFTER_NATE_SUCCESS)
Beispiel #3
0
 def testPushbear(self):
     """
     实测pushbear是否可用
     :return:
     """
     sendPushBear("pushbear 微信通知测试一下")
Beispiel #4
0
def PushbearConf():
    sendPushBear("订票小助手测试一下")