添加 README
This commit is contained in:
214
LICENSE
214
LICENSE
@@ -1,21 +1,201 @@
|
||||
MIT License
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
Copyright (c) 2019
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
1. Definitions.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
66
README.md
Normal file
66
README.md
Normal file
@@ -0,0 +1,66 @@
|
||||
# 🚂 py12306 购票助手
|
||||
多账号,多任务购票
|
||||
|
||||
## 前言
|
||||
今年回家的票明显要难买很多,早早就答应了父母今年的票没问题,到现在一张票没买到,虽然家里已经订了汽车票,让我不用操心,但是想想他们一行还有小孩,心还是很伤的。
|
||||
这段时间从 12306Bypass 到 testerSunshine 大佬写的 [12306](https://github.com/testerSunshine/12306),还是没抢到票,索性就自己写了一个,希望也能帮助到更多人
|
||||
|
||||
## Features
|
||||
- [x] 多日期查询余票
|
||||
- [x] 自动打码下单
|
||||
- [x] 用户状态恢复
|
||||
- [x] 电话语音通知
|
||||
- [x] 多账号、多任务、多线程支持
|
||||
- [ ] 单个任务多站点查询
|
||||
- [ ] Docker 支持
|
||||
- [ ] 邮件通知
|
||||
|
||||
## 使用
|
||||
py12306 需要运行 python 3.6 以上版本(其它版本暂未测试)
|
||||
|
||||
**1. 安装依赖**
|
||||
```bash
|
||||
git clone https://github.com/pjialin/py12306
|
||||
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
**2. 配置程序**
|
||||
```bash
|
||||
cp env.py.example env.py
|
||||
```
|
||||
自动打码
|
||||
|
||||
打码依赖于若快平台,需要先到 [http://www.ruokuai.com](http://www.ruokuai.com/login) 注册一个账号后填写到配置中
|
||||
|
||||
语音通知
|
||||
|
||||
语音验证码使用的是阿里云 API 市场上的一个服务商,需要到 [https://market.aliyun.com/products/57126001/cmapi019902.html](https://market.aliyun.com/products/57126001/cmapi019902.html) 购买后将 appcode 填写到配置中
|
||||
|
||||
**3. 启动前测试**
|
||||
|
||||
目前提供了一些简单的测试
|
||||
|
||||
开始测试 -t
|
||||
```bash
|
||||
python main.py -t
|
||||
```
|
||||
|
||||
测试语音通知 -t -n
|
||||
```bash
|
||||
# 默认不会进行通知测试,要对通知进行测试需要加上 -n 参数
|
||||
python main.py -t -n
|
||||
```
|
||||
|
||||
**4. 运行程序**
|
||||
```bash
|
||||
python main.py
|
||||
```
|
||||
|
||||
|
||||
## Thanks
|
||||
感谢大佬 [testerSunshine](https://github.com/testerSunshine/12306),借鉴了部分实现
|
||||
|
||||
## License
|
||||
|
||||
[Apache License.](https://github.com/pjialin/py12306/blob/master/LICENSE)
|
||||
2
main.py
2
main.py
@@ -20,7 +20,7 @@ def main():
|
||||
while True:
|
||||
sleep(10000)
|
||||
|
||||
CommonLog.test_complete()
|
||||
CommonLog.print_test_complete()
|
||||
|
||||
|
||||
def test():
|
||||
|
||||
@@ -6,24 +6,15 @@ BASE_URL_OF_12306 = 'https://kyfw.12306.cn'
|
||||
|
||||
LEFT_TICKETS = {
|
||||
"url": BASE_URL_OF_12306 + "/otn/{type}?leftTicketDTO.train_date={left_date}&leftTicketDTO.from_station={left_station}&leftTicketDTO.to_station={arrive_station}&purpose_codes=ADULT",
|
||||
"re_try": 10,
|
||||
"re_time": 0.01,
|
||||
"s_time": 0.01,
|
||||
"is_logger": False,
|
||||
"is_json": True,
|
||||
"is_cdn": True,
|
||||
}
|
||||
|
||||
API_BASE_LOGIN = {
|
||||
"url": BASE_URL_OF_12306 + '/passport/web/login',
|
||||
"method": "post",
|
||||
"is_cdn": True,
|
||||
}
|
||||
|
||||
API_USER_CHECK = {
|
||||
"url": BASE_URL_OF_12306 + '/otn/login/checkUser',
|
||||
"method": "post",
|
||||
"is_cdn": True,
|
||||
}
|
||||
|
||||
API_AUTH_CODE_DOWNLOAD = {
|
||||
@@ -52,347 +43,3 @@ API_QUERY_ORDER_WAIT_TIME = BASE_URL_OF_12306 + '/otn/confirmPassenger/queryOrde
|
||||
|
||||
API_NOTIFICATION_BY_VOICE_CODE = 'http://ali-voice.showapi.com/sendVoice?'
|
||||
|
||||
urls = {
|
||||
"auth": { # 登录接口
|
||||
"req_url": "/passport/web/auth/uamtk",
|
||||
"req_type": "post",
|
||||
"Referer": "https://kyfw.12306.cn/otn/passport?redirect=/otn/login/userLogin",
|
||||
"Host": "kyfw.12306.cn",
|
||||
"Content-Type": 1,
|
||||
"re_try": 10,
|
||||
"re_time": 0.1,
|
||||
"s_time": 0.1,
|
||||
"is_logger": True,
|
||||
"is_json": True,
|
||||
},
|
||||
"login": { # 登录接口
|
||||
"req_url": "/passport/web/login",
|
||||
"req_type": "post",
|
||||
"Referer": "https://kyfw.12306.cn/otn/login/init",
|
||||
"Host": "kyfw.12306.cn",
|
||||
"Content-Type": 1,
|
||||
"re_try": 10,
|
||||
"re_time": 0.1,
|
||||
"s_time": 0.1,
|
||||
"is_logger": True,
|
||||
"is_json": True,
|
||||
|
||||
},
|
||||
"left_ticket_init": { # 登录接口
|
||||
"req_url": "/otn/leftTicket/init",
|
||||
"req_type": "post",
|
||||
"Referer": "https://kyfw.12306.cn/otn/login/init",
|
||||
"Host": "kyfw.12306.cn",
|
||||
"Content-Type": 1,
|
||||
"re_try": 10,
|
||||
"re_time": 0.1,
|
||||
"s_time": 0.1,
|
||||
"is_logger": False,
|
||||
"is_json": False,
|
||||
|
||||
},
|
||||
"getCodeImg": { # 登录验证码
|
||||
"req_url": "/passport/captcha/captcha-image?login_site=E&module=login&rand=sjrand&{0}",
|
||||
"req_type": "get",
|
||||
"Referer": "https://kyfw.12306.cn/otn/login/init",
|
||||
"Host": "kyfw.12306.cn",
|
||||
"Content-Type": 1,
|
||||
"re_try": 10,
|
||||
"re_time": 0.1,
|
||||
"s_time": 0.1,
|
||||
"is_logger": False,
|
||||
"is_json": False,
|
||||
"not_decode": True,
|
||||
},
|
||||
"codeCheck": { # 验证码校验
|
||||
"req_url": "/passport/captcha/captcha-check",
|
||||
"req_type": "post",
|
||||
"Referer": "https://kyfw.12306.cn/otn/login/init",
|
||||
"Host": "kyfw.12306.cn",
|
||||
"Content-Type": 1,
|
||||
"re_try": 10,
|
||||
"re_time": 0.1,
|
||||
"s_time": 0.1,
|
||||
"is_logger": True,
|
||||
"is_json": True,
|
||||
},
|
||||
"loginInit": { # 登录页面
|
||||
"req_url": "/otn/login/init",
|
||||
"req_type": "get",
|
||||
"Referer": "https://kyfw.12306.cn/otn/index/init",
|
||||
"Host": "kyfw.12306.cn",
|
||||
"re_try": 1,
|
||||
"re_time": 0.1,
|
||||
"s_time": 0.1,
|
||||
"is_logger": False,
|
||||
"is_json": False,
|
||||
},
|
||||
"loginInitCdn": { # 登录页面
|
||||
"req_url": "/otn/login/init",
|
||||
"req_type": "get",
|
||||
"Referer": "https://kyfw.12306.cn/otn/index/init",
|
||||
"Host": "kyfw.12306.cn",
|
||||
"re_try": 1,
|
||||
"re_time": 0.1,
|
||||
"s_time": 0.1,
|
||||
"is_logger": False,
|
||||
"is_test_cdn": True,
|
||||
"is_json": False,
|
||||
},
|
||||
"getUserInfo": { # 获取用户信息
|
||||
"req_url": "/otn/index/initMy12306",
|
||||
"req_type": "get",
|
||||
"Referer": "https://kyfw.12306.cn/otn/passport?redirect=/otn/login/userLogin",
|
||||
"Host": "kyfw.12306.cn",
|
||||
"re_try": 10,
|
||||
"re_time": 0.1,
|
||||
"s_time": 0.01,
|
||||
"is_logger": False,
|
||||
"is_json": False,
|
||||
},
|
||||
"userLogin": { # 用户登录
|
||||
"req_url": "/otn/login/userLogin",
|
||||
"req_type": "get",
|
||||
"Referer": "https://kyfw.12306.cn/otn/passport?redirect=/otn/login/userLogin",
|
||||
"Host": "kyfw.12306.cn",
|
||||
"re_try": 10,
|
||||
"re_time": 0.1,
|
||||
"s_time": 0.1,
|
||||
"is_logger": True,
|
||||
"is_json": True,
|
||||
},
|
||||
"uamauthclient": { # 登录
|
||||
"req_url": "/otn/uamauthclient",
|
||||
"req_type": "post",
|
||||
"Referer": "https://kyfw.12306.cn/otn/passport?redirect=/otn/login/userLogin",
|
||||
"Host": "kyfw.12306.cn",
|
||||
"Content-Type": 1,
|
||||
"re_try": 10,
|
||||
"re_time": 0.1,
|
||||
"s_time": 0.1,
|
||||
"is_logger": True,
|
||||
"is_json": True,
|
||||
},
|
||||
"initdc_url": { # 生成订单页面
|
||||
"req_url": "/otn/confirmPassenger/initDc",
|
||||
"req_type": "get",
|
||||
"Referer": "https://kyfw.12306.cn/otn/leftTicket/init",
|
||||
"Host": "kyfw.12306.cn",
|
||||
"re_try": 10,
|
||||
"re_time": 0.1,
|
||||
"s_time": 1,
|
||||
"is_logger": False,
|
||||
"is_json": False,
|
||||
},
|
||||
"GetJS": { # 订单页面js
|
||||
"req_url": "/otn/HttpZF/GetJS",
|
||||
"req_type": "get",
|
||||
"Referer": "https://kyfw.12306.cn/otn/confirmPassenger/initDc",
|
||||
"Host": "kyfw.12306.cn",
|
||||
"re_try": 10,
|
||||
"re_time": 0.1,
|
||||
"s_time": 0.1,
|
||||
"is_logger": False,
|
||||
"is_json": False,
|
||||
},
|
||||
"odxmfwg": { # 订单页面js
|
||||
"req_url": "/otn/dynamicJs/odxmfwg",
|
||||
"req_type": "get",
|
||||
"Referer": "https://kyfw.12306.cn/otn/confirmPassenger/initDc",
|
||||
"Host": "kyfw.12306.cn",
|
||||
"re_try": 10,
|
||||
"re_time": 0.1,
|
||||
"s_time": 0.1,
|
||||
"is_logger": False,
|
||||
"is_json": False,
|
||||
},
|
||||
"get_passengerDTOs": { # 获取乘车人
|
||||
"req_url": "/otn/confirmPassenger/getPassengerDTOs",
|
||||
"req_type": "post",
|
||||
"Referer": "https://kyfw.12306.cn/otn/confirmPassenger/initDc",
|
||||
"Host": "kyfw.12306.cn",
|
||||
"re_try": 10,
|
||||
"re_time": 0.1,
|
||||
"s_time": 0.1,
|
||||
"is_logger": True,
|
||||
"is_json": True,
|
||||
},
|
||||
"select_url": { # 查询余票
|
||||
"req_url": "/otn/{3}?leftTicketDTO.train_date={0}&leftTicketDTO.from_station={1}&leftTicketDTO.to_station={2}&purpose_codes=ADULT",
|
||||
"req_type": "get",
|
||||
"Referer": "https://kyfw.12306.cn/otn/leftTicket/init",
|
||||
"Host": "kyfw.12306.cn",
|
||||
"re_try": 10,
|
||||
"re_time": 0.01,
|
||||
"s_time": 0.01,
|
||||
"is_logger": False,
|
||||
"is_json": True,
|
||||
"is_cdn": True,
|
||||
},
|
||||
"check_user_url": { # 检查用户登录
|
||||
"req_url": "/otn/login/checkUser",
|
||||
"req_type": "post",
|
||||
"Referer": "https://kyfw.12306.cn/otn/leftTicket/init",
|
||||
"Host": "kyfw.12306.cn",
|
||||
"re_try": 10,
|
||||
"re_time": 0.3,
|
||||
"s_time": 0.1,
|
||||
"is_logger": True,
|
||||
"is_json": True,
|
||||
},
|
||||
"submit_station_url": { # 提交订单
|
||||
"req_url": "/otn/leftTicket/submitOrderRequest",
|
||||
"req_type": "post",
|
||||
"Referer": "https://kyfw.12306.cn/otn/leftTicket/init",
|
||||
"Host": "kyfw.12306.cn",
|
||||
"re_try": 10,
|
||||
"re_time": 0.01,
|
||||
"s_time": 0.1,
|
||||
"is_logger": True,
|
||||
"is_json": True,
|
||||
},
|
||||
"checkOrderInfoUrl": { # 检查订单信息规范
|
||||
"req_url": "/otn/confirmPassenger/checkOrderInfo",
|
||||
"req_type": "post",
|
||||
"Referer": "https://kyfw.12306.cn/otn/confirmPassenger/initDc",
|
||||
"Host": "kyfw.12306.cn",
|
||||
"re_try": 10,
|
||||
"re_time": 0.01,
|
||||
"s_time": 0.1,
|
||||
"is_logger": True,
|
||||
"is_json": True,
|
||||
},
|
||||
"getQueueCountUrl": { # 剩余余票数
|
||||
"req_url": "/otn/confirmPassenger/getQueueCount",
|
||||
"req_type": "post",
|
||||
"Referer": "https://kyfw.12306.cn/otn/confirmPassenger/initDc",
|
||||
"Host": "kyfw.12306.cn",
|
||||
"re_try": 10,
|
||||
"re_time": 0.01,
|
||||
"s_time": 0.1,
|
||||
"is_logger": True,
|
||||
"is_json": True,
|
||||
},
|
||||
"checkQueueOrderUrl": { # 订单队列排队
|
||||
"req_url": "/otn/confirmPassenger/confirmSingleForQueue",
|
||||
"req_type": "post",
|
||||
"Referer": "https://kyfw.12306.cn/otn/confirmPassenger/initDc",
|
||||
"Host": "kyfw.12306.cn",
|
||||
"re_try": 10,
|
||||
"re_time": 0.01,
|
||||
"s_time": 0.1,
|
||||
"is_logger": True,
|
||||
"is_json": True,
|
||||
},
|
||||
"checkRandCodeAnsyn": { # 暂时没用到
|
||||
"req_url": "/otn/passcodeNew/checkRandCodeAnsyn",
|
||||
"req_type": "post",
|
||||
"Referer": "https://kyfw.12306.cn/otn/confirmPassenger/initDc",
|
||||
"Host": "kyfw.12306.cn",
|
||||
"re_try": 10,
|
||||
"re_time": 0.01,
|
||||
"s_time": 0.1,
|
||||
"is_logger": True,
|
||||
"is_json": True,
|
||||
},
|
||||
"codeImgByOrder": { # 订单页面验证码
|
||||
"req_url": "/otn/passcodeNew/getPassCodeNew?module=passenger&rand=randp&{}",
|
||||
"req_type": "post",
|
||||
"Referer": "https://kyfw.12306.cn/otn/confirmPassenger/initDc",
|
||||
"Host": "kyfw.12306.cn",
|
||||
"re_try": 10,
|
||||
"re_time": 0.01,
|
||||
"s_time": 0.1,
|
||||
"is_logger": False,
|
||||
"is_json": False,
|
||||
},
|
||||
"queryOrderWaitTimeUrl": { # 订单等待页面
|
||||
"req_url": "/otn/confirmPassenger/queryOrderWaitTime?random={0}&tourFlag=dc&_json_att=",
|
||||
"req_type": "get",
|
||||
"Referer": "https://kyfw.12306.cn/otn/confirmPassenger/initDc",
|
||||
"Host": "kyfw.12306.cn",
|
||||
"re_try": 10,
|
||||
"re_time": 0.01,
|
||||
"s_time": 0.1,
|
||||
"is_logger": True,
|
||||
"is_json": True,
|
||||
},
|
||||
"queryMyOrderNoCompleteUrl": { # 订单查询页面
|
||||
"req_url": "/otn/queryOrder/queryMyOrderNoComplete",
|
||||
"req_type": "post",
|
||||
"Referer": "https://kyfw.12306.cn/otn/queryOrder/initNoComplete",
|
||||
"Host": "kyfw.12306.cn",
|
||||
"re_try": 10,
|
||||
"re_time": 0.01,
|
||||
"s_time": 0.1,
|
||||
"is_logger": True,
|
||||
"is_json": True,
|
||||
},
|
||||
"initNoCompleteUrl": { # 获取订单列表
|
||||
"req_url": "/otn/queryOrder/initNoComplete",
|
||||
"req_type": "post",
|
||||
"Referer": "https://kyfw.12306.cn/otn/queryOrder/initNoComplete",
|
||||
"Host": "kyfw.12306.cn",
|
||||
"re_try": 10,
|
||||
"re_time": 0.01,
|
||||
"s_time": 0.1,
|
||||
"is_logger": False,
|
||||
"is_json": False,
|
||||
},
|
||||
"cancelNoCompleteMyOrder": { # 取消订单
|
||||
"req_url": "/otn/queryOrder/cancelNoCompleteMyOrder",
|
||||
"req_type": "post",
|
||||
"Referer": "https://kyfw.12306.cn/otn/queryOrder/initNoComplete",
|
||||
"Host": "kyfw.12306.cn",
|
||||
"re_try": 10,
|
||||
"re_time": 0.01,
|
||||
"s_time": 0.1,
|
||||
"is_logger": True,
|
||||
"is_json": True,
|
||||
},
|
||||
"autoSubmitOrderRequest": { # 快速自动提交订单
|
||||
"req_url": "/otn/confirmPassenger/autoSubmitOrderRequest",
|
||||
"req_type": "post",
|
||||
"Referer": "https://kyfw.12306.cn/otn/leftTicket/init",
|
||||
"Host": "kyfw.12306.cn",
|
||||
"Content-Type": 1,
|
||||
"re_try": 10,
|
||||
"re_time": 0.01,
|
||||
"s_time": 0.1,
|
||||
"is_logger": True,
|
||||
"is_json": True,
|
||||
},
|
||||
"getQueueCountAsync": { # 快速获取订单数据
|
||||
"req_url": "/otn/confirmPassenger/getQueueCountAsync",
|
||||
"req_type": "post",
|
||||
"Referer": "https://kyfw.12306.cn/otn/leftTicket/init",
|
||||
"Host": "kyfw.12306.cn",
|
||||
"Content-Type": 1,
|
||||
"re_try": 10,
|
||||
"re_time": 0.01,
|
||||
"s_time": 0.1,
|
||||
"is_logger": True,
|
||||
"is_json": True,
|
||||
},
|
||||
"confirmSingleForQueueAsys": { # 快速订单排队
|
||||
"req_url": "/otn/confirmPassenger/confirmSingleForQueueAsys",
|
||||
"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": {
|
||||
"req_url": "http://ping.chinaz.com/kyfw.12306.cn",
|
||||
"req_type": "post"
|
||||
},
|
||||
"cdn_list": {
|
||||
"req_url": "http://ping.chinaz.com/iframe.ashx?t=ping&callback=jQuery111304824429956769827_{}".format(
|
||||
int(round(time.time() * 1000))),
|
||||
"req_type": "post"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ class CommonLog(BaseLog):
|
||||
return self
|
||||
|
||||
@classmethod
|
||||
def test_complete(cls):
|
||||
def print_test_complete(cls):
|
||||
self = cls()
|
||||
self.add_quick_log('# 测试完成,请检查输出是否正确 #')
|
||||
self.flush()
|
||||
|
||||
Reference in New Issue
Block a user