From bc88a9e067c67a6efc68d8e349d1a8206773da21 Mon Sep 17 00:00:00 2001 From: kongkongyzt Date: Fri, 11 Jan 2019 00:24:45 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=B7=BB=E5=8A=A0pushbear=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E9=80=9A=E7=9F=A5=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/pushbearConf.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 config/pushbearConf.py diff --git a/config/pushbearConf.py b/config/pushbearConf.py new file mode 100644 index 0000000..e69de29 From 1c5ba95ff879154e9e8d75a6e54b3a02099be5a5 Mon Sep 17 00:00:00 2001 From: kongkongyzt Date: Fri, 11 Jan 2019 00:41:41 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E7=94=A8=E4=BE=8B=EF=BC=8C=20=E5=AE=8C=E5=96=84pushbear?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- UnitTest/TestAll.py | 8 ++++++++ config/pushbearConf.py | 26 ++++++++++++++++++++++++++ config/ticket_config.yaml | 5 +++++ inter/QueryOrderWaitTime.py | 3 +++ tkcode.png | Bin 0 -> 1492 bytes 5 files changed, 42 insertions(+) create mode 100644 tkcode.png diff --git a/UnitTest/TestAll.py b/UnitTest/TestAll.py index 17eb608..3943e70 100644 --- a/UnitTest/TestAll.py +++ b/UnitTest/TestAll.py @@ -6,6 +6,7 @@ import requests from agency.agency_tools import proxy from config.emailConf import sendEmail +from config.pushbearConf import sendPushBear def _set_header_default(): @@ -38,6 +39,13 @@ class testAll(unittest.TestCase): :return: """ sendEmail("订票小助手测试一下") + + def testPushbear(self): + """ + 实测pushbear是否可用 + :return: + """ + sendPushBear("pushbear 微信通知测试一下") # def testConfig(self): # """ diff --git a/config/pushbearConf.py b/config/pushbearConf.py index e69de29..2f3a496 100644 --- a/config/pushbearConf.py +++ b/config/pushbearConf.py @@ -0,0 +1,26 @@ +# -*- coding: utf8 -*- +__author__ = 'kongkongyzt' +import requests +from config.ticketConf import _get_yaml + +PUSH_BEAR_API_PATH = "https://pushbear.ftqq.com/sub" + +def sendPushBear(msg): + """ + pushBear微信通知 + :param str: 通知内容 content + :return: + """ + conf = _get_yaml() + if conf["pushbear_conf"]["is_pushbear"] and conf["pushbear_conf"]["send_key"].strip() != "": + try: + requests.get("{}?sendkey={}&text=来自12306抢票助手的通知&desp={}".format(PUSH_BEAR_API_PATH, conf["pushbear_conf"]["send_key"].strip(), msg)) + print(u"已下发 pushbear 微信通知, 请查收") + except Exception as e: + print(u"pushbear 配置有误 {}".format(e)) + else: + pass + + +if __name__ == '__main__': + sendPushBear(1) \ No newline at end of file diff --git a/config/ticket_config.yaml b/config/ticket_config.yaml index 5738135..80d0509 100755 --- a/config/ticket_config.yaml +++ b/config/ticket_config.yaml @@ -103,6 +103,11 @@ email_conf: password: "" host: "smtp.qq.com" +# 是否开启 pushbear 微信提醒, 使用前需要前往 http://pushbear.ftqq.com 扫码绑定获取 send_key 并关注获得抢票结果通知的公众号 +pushbear_conf: + is_pushbear: False + send_key: "" + # 是否开启cdn查询,可以更快的检测票票 1为开启,2为关闭 is_cdn: 1 diff --git a/inter/QueryOrderWaitTime.py b/inter/QueryOrderWaitTime.py index 9dbc888..2e457ac 100644 --- a/inter/QueryOrderWaitTime.py +++ b/inter/QueryOrderWaitTime.py @@ -4,6 +4,7 @@ import time from config.TicketEnmu import ticket from config.emailConf import sendEmail +from config.pushbearConf import sendPushBear from myException.ticketIsExitsException import ticketIsExitsException from myException.ticketNumOutException import ticketNumOutException @@ -42,6 +43,8 @@ class queryOrderWaitTime: if data and 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): diff --git a/tkcode.png b/tkcode.png new file mode 100644 index 0000000000000000000000000000000000000000..35a70ff2c5d30380b1e9b32deaba0d5795f9afd1 GIT binary patch literal 1492 zcmex=Z;0e`ufJk z`uYy2fKia2Ur<<3R7glvL=Xt2M8w2Iq|~IOWTd3j43y=7K-oZBPhDMIPutYgz`)eh z!NDHci2nx|1UVS?F{&~%Dlsq#GBOJ?{y)Ny1#~tuBO}5;K=(2+v#_HIfusc(8JL)u z7@3)vxR@cz8JPr`6@^#~9fbpxL|79G8z*iwa!T5yys$`A5XD50^8dFOc$k4k2r>&Y z*fV^Am@ueF8RO?~I=V}GeC}T>JZfK6FI#!tyerJmv}4}Q{@t&SB=dQnP1`6eo0eU< z#&?mj**5iSwhx!x^7s9?YDd?fV8PdN^Dgi{KYKg6bjH#hoo988Wo~JI3IF*0N9lc$ z?wq%OE*r|{{9A5Ym+{tf&Z{-gE*pyWT>E&g@Qa%6k64qwi`gz8<-b3^AshJo>@uZ| z>o#`Gx%Hzj{dR}%p4-=JE-x$n-dnr*d}h)0_jAtpCEa>FFTLBZc44-AzFv}A+Qog7 zum4W6oKO;e`gU~G?5$t6N5}2??S6GmU2^4hv#x7uR*%%uif5ct7SuYc{rODR{)%x|`ouA2Ji zaLU7(V@@U(P{@blK`9`}}MsD$myWDv+ef|3D7yY$U->;izx9897PewN)gj1FG& z_3ey#>T@jq{SDh!9rQV}%caoRY|kU{FXe|Ajry5u$2Dtij}zEzh+P4-yh z@@<>Cai87BuO_)ax4NC%9Cz>1;d4i#k8k;%yWW0*$ow;A$L`G+mpEtl=08KT@4VQR zyG&hz=fB$e@$J0in+Hv{A2r{aq;}cX?$+n?+xP!5yZ@=?V~$_8=y7?E&I$R;&&}PP z9H%WgqyJgwxB32e*4i8FeSJ%N-Og{@PIUg`vB@p({P--Xa?WwfM@q%VEP{{jagWNm z`7wCOZHu1g+h2CF*Hni0hTY80`kkiycFURKuQNJR|1&Ji`|K0kaX#m^{KIL|)wkV# zT}n^eccm*@Q1bhHkLOd~th*bno_6k{*g7TMO~w}g4ERob($83OO}p-*v7y-WexI^K z(>|NmOt~H#IQzMLY3D$~p(Xv0Y&uHE3to4U0jwF{ZD*Up2f%W5( z^OLQrK8n1({q5mqiMjQiGtU3Ea!VF|IrDoCJhyTfOc3mt%*iMr#AML7@k<0t!XXDY imWCdeUo-mSOBxy#6u|suPDUmNCkME;!NZXMe-i+XX$A)X literal 0 HcmV?d00001 From 3da74df99c8c1548ff90a9a488c19e9253d71c7c Mon Sep 17 00:00:00 2001 From: kongkongyzt Date: Fri, 11 Jan 2019 01:11:18 +0800 Subject: [PATCH 3/5] remove tail whitespace --- config/pushbearConf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/pushbearConf.py b/config/pushbearConf.py index 2f3a496..dd24cc9 100644 --- a/config/pushbearConf.py +++ b/config/pushbearConf.py @@ -3,7 +3,7 @@ __author__ = 'kongkongyzt' import requests from config.ticketConf import _get_yaml -PUSH_BEAR_API_PATH = "https://pushbear.ftqq.com/sub" +PUSH_BEAR_API_PATH = "https://pushbear.ftqq.com/sub" def sendPushBear(msg): """ From 6c78809b4fef4d0fba4fd0a4690c9832cd3a5a49 Mon Sep 17 00:00:00 2001 From: kongkongyzt Date: Fri, 11 Jan 2019 01:14:48 +0800 Subject: [PATCH 4/5] remove tail whitespace --- UnitTest/TestAll.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UnitTest/TestAll.py b/UnitTest/TestAll.py index 3943e70..8e946fb 100644 --- a/UnitTest/TestAll.py +++ b/UnitTest/TestAll.py @@ -39,7 +39,7 @@ class testAll(unittest.TestCase): :return: """ sendEmail("订票小助手测试一下") - + def testPushbear(self): """ 实测pushbear是否可用 From c7ca1507325939830c320cd7c25d9f127f69857c Mon Sep 17 00:00:00 2001 From: ferried Date: Mon, 14 Jan 2019 11:27:09 +0800 Subject: [PATCH 5/5] remove settings of Interlij Idea --- .idea/12306.iml | 12 - .idea/inspectionProfiles/Project_Default.xml | 49 - .idea/markdown-exported-files.xml | 8 - .idea/markdown-navigator.xml | 72 -- .../markdown-navigator/profiles_settings.xml | 3 - .idea/misc.xml | 7 - .idea/modules.xml | 8 - .idea/vcs.xml | 6 - .idea/workspace.xml | 1042 ----------------- 9 files changed, 1207 deletions(-) delete mode 100644 .idea/12306.iml delete mode 100644 .idea/inspectionProfiles/Project_Default.xml delete mode 100644 .idea/markdown-exported-files.xml delete mode 100644 .idea/markdown-navigator.xml delete mode 100644 .idea/markdown-navigator/profiles_settings.xml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/vcs.xml delete mode 100644 .idea/workspace.xml diff --git a/.idea/12306.iml b/.idea/12306.iml deleted file mode 100644 index 3ae6b30..0000000 --- a/.idea/12306.iml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml deleted file mode 100644 index 36e6057..0000000 --- a/.idea/inspectionProfiles/Project_Default.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/markdown-exported-files.xml b/.idea/markdown-exported-files.xml deleted file mode 100644 index 5d1f129..0000000 --- a/.idea/markdown-exported-files.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/markdown-navigator.xml b/.idea/markdown-navigator.xml deleted file mode 100644 index dbe0e46..0000000 --- a/.idea/markdown-navigator.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/markdown-navigator/profiles_settings.xml b/.idea/markdown-navigator/profiles_settings.xml deleted file mode 100644 index 57927c5..0000000 --- a/.idea/markdown-navigator/profiles_settings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 1842d96..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index c883c3a..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml deleted file mode 100644 index 0b34bbf..0000000 --- a/.idea/workspace.xml +++ /dev/null @@ -1,1042 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 12306account - ticket - 联系人不在列表中,请查证后添加 - 飘飘 - select_refresh_interval - 正在尝试排队 - passengerDTOs - 提交订单失败 - ifshowPassCodeTime - 车票提交通过 - query - 出票成功 - 查询到有余票,尝试提交订单 - station_seat - ifShowPassCodeTime - checkOrderInfo - /otn/leftTicket/submitOrderRequest - 文贤平 - 当前余票数小于乘车人数,放弃订票 - 车票提交通过,正在尝试排队 - select_url - loginInit - 验证码提交安全期,等待 - 文贤平(二代身份证-43052419950223777X)存在与本次购票行程冲突的车票!! - logininit - confirmSingleForQueueAsys - is_auto_code - idateM - queryMyOrderNoCompleteUrl - queryMyOrderNoComplete - - - is_auto_code - auto_code_type - self.session.urls - self.session.httpClint - - - - - - - - - - - true - DEFINITION_ORDER - - - - - - - - - - - - - - - - - - - - - - - - -