Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
janlyn06
12306
提交
85ae1b9f
1
12306
项目概览
janlyn06
/
12306
通知
4
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
1
12306
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
85ae1b9f
编写于
1月 10, 2018
作者:
W
wenxianping
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test
上级
c4806e63
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
10 addition
and
8 deletion
+10
-8
init/select_ticket_info.py
init/select_ticket_info.py
+10
-8
tkcode
tkcode
+0
-0
未找到文件。
init/select_ticket_info.py
浏览文件 @
85ae1b9f
...
...
@@ -498,20 +498,22 @@ class select:
排队获取订单等待信息,每隔3秒请求一次,最高请求次数为20次!
:return:
"""
queryOrderWaitTimeUrl
=
"https://kyfw.12306.cn/otn/confirmPassenger/queryOrderWaitTime"
data
=
{
"random"
:
"149545481029"
+
str
(
random
.
randint
(
1
,
9
)),
"tourFlag"
:
"dc"
,
"REPEAT_SUBMIT_TOKEN"
:
self
.
get_token
(),
}
#
queryOrderWaitTimeUrl = "https://kyfw.12306.cn/otn/confirmPassenger/queryOrderWaitTime"
#
data = {
# "random": "{0}{1}".format(int(time.time()),
random.randint(1, 9)),
#
"tourFlag": "dc",
#
"REPEAT_SUBMIT_TOKEN": self.get_token(),
#
}
num
=
1
while
True
:
_random
=
"{0}{1}"
.
format
(
int
(
time
.
time
()),
random
.
randint
(
1
,
9
)),
num
+=
1
if
num
>
30
:
print
(
"超出排队时间,自动放弃,正在重新刷票"
)
break
try
:
queryOrderWaitTimeResult
=
json
.
loads
(
myurllib2
.
Post
(
queryOrderWaitTimeUrl
,
data
))
queryOrderWaitTimeUrl
=
"https://kyfw.12306.cn/otn/confirmPassenger/queryOrderWaitTime?random={0}&tourFlag=dc&_json_att=&REPEAT_SUBMIT_TOKEN={1}"
.
format
(
_random
,
self
.
get_token
())
queryOrderWaitTimeResult
=
json
.
loads
(
myurllib2
.
get
(
queryOrderWaitTimeUrl
))
except
ValueError
:
queryOrderWaitTimeResult
=
{}
if
queryOrderWaitTimeResult
:
...
...
@@ -601,7 +603,7 @@ class select:
break
start_time
=
datetime
.
datetime
.
now
()
self
.
submitOrderRequest
(
from_station
,
to_station
)
print
"正在第{0}次查询 乘车日期: {1} 车次{2} 查询
无
票 代理设置 无 总耗时{3}ms"
.
format
(
num
,
self
.
station_date
,
","
.
join
(
self
.
station_trains
),
(
datetime
.
datetime
.
now
()
-
start_time
).
microseconds
/
1000
)
print
"正在第{0}次查询 乘车日期: {1} 车次{2} 查询
无
票 代理设置 无 总耗时{3}ms"
.
format
(
num
,
self
.
station_date
,
","
.
join
(
self
.
station_trains
),
(
datetime
.
datetime
.
now
()
-
start_time
).
microseconds
/
1000
)
except
PassengerUserException
as
e
:
print
e
.
message
break
...
...
tkcode
浏览文件 @
85ae1b9f
无法预览此类型文件
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录