Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
py12306
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
python
py12306
Commits
68445e19
Commit
68445e19
authored
Jan 25, 2019
by
Jalin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化停留间隔,循环获取乘客问题
parent
547300b6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
6 deletions
+9
-6
order.py
py12306/order/order.py
+4
-2
job.py
py12306/query/job.py
+3
-4
job.py
py12306/user/job.py
+2
-0
No files found.
py12306/order/order.py
View file @
68445e19
...
@@ -141,8 +141,10 @@ class Order:
...
@@ -141,8 +141,10 @@ class Order:
return
True
return
True
else
:
else
:
if
(
str
(
result
.
get
(
'messages'
,
''
))
.
find
(
'未处理'
)
>=
0
):
# 未处理订单
if
(
str
(
result
.
get
(
'messages'
,
''
))
.
find
(
'未处理'
)
>=
0
):
# 未处理订单
self
.
order_id
=
0
# 需要拿到订单号 TODO
# 0125 增加排队时长到 5 分钟之后,更多的是 排队失败,得通过拿到订单列表才能确认,再打个 TODO
return
-
1
# self.order_id = 0 # 需要拿到订单号 TODO
# return -1
pass
OrderLog
.
add_quick_log
(
OrderLog
.
add_quick_log
(
OrderLog
.
MESSAGE_SUBMIT_ORDER_REQUEST_FAIL
.
format
(
OrderLog
.
MESSAGE_SUBMIT_ORDER_REQUEST_FAIL
.
format
(
result
.
get
(
'messages'
,
CommonLog
.
MESSAGE_RESPONSE_EMPTY_ERROR
)))
.
flush
()
result
.
get
(
'messages'
,
CommonLog
.
MESSAGE_RESPONSE_EMPTY_ERROR
)))
.
flush
()
...
...
py12306/query/job.py
View file @
68445e19
...
@@ -45,6 +45,7 @@ class Job:
...
@@ -45,6 +45,7 @@ class Job:
interval
=
{}
interval
=
{}
interval_additional
=
0
interval_additional
=
0
interval_additional_max
=
5
query
=
None
query
=
None
cluster
=
None
cluster
=
None
...
@@ -224,10 +225,8 @@ class Job:
...
@@ -224,10 +225,8 @@ class Job:
"""
"""
if
response
.
status_code
!=
200
:
if
response
.
status_code
!=
200
:
QueryLog
.
print_query_error
(
response
.
reason
,
response
.
status_code
)
QueryLog
.
print_query_error
(
response
.
reason
,
response
.
status_code
)
if
self
.
interval_additional
:
if
self
.
interval_additional
<
self
.
interval_additional_max
:
self
.
interval_additional
+=
self
.
interval_additional
self
.
interval_additional
+=
self
.
interval
.
get
(
'min'
)
else
:
self
.
interval_additional
=
self
.
interval
.
get
(
'min'
)
else
:
else
:
self
.
interval_additional
=
0
self
.
interval_additional
=
0
result
=
response
.
json
()
.
get
(
'data.result'
)
result
=
response
.
json
()
.
get
(
'data.result'
)
...
...
py12306/user/job.py
View file @
68445e19
...
@@ -311,6 +311,8 @@ class UserJob:
...
@@ -311,6 +311,8 @@ class UserJob:
UserLog
.
add_quick_log
(
UserLog
.
add_quick_log
(
UserLog
.
MESSAGE_GET_USER_PASSENGERS_FAIL
.
format
(
UserLog
.
MESSAGE_GET_USER_PASSENGERS_FAIL
.
format
(
result
.
get
(
'messages'
,
CommonLog
.
MESSAGE_RESPONSE_EMPTY_ERROR
),
self
.
retry_time
))
.
flush
()
result
.
get
(
'messages'
,
CommonLog
.
MESSAGE_RESPONSE_EMPTY_ERROR
),
self
.
retry_time
))
.
flush
()
if
Config
()
.
is_slave
():
self
.
load_user_from_remote
()
# 加载最新 cookie
stay_second
(
self
.
retry_time
)
stay_second
(
self
.
retry_time
)
return
self
.
get_user_passengers
()
return
self
.
get_user_passengers
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment