Merge branch 'test'

pull/23/head
wenxianping 2018-01-13 09:39:33 +08:00
commit 9170177769
4 changed files with 165 additions and 128 deletions

View File

@ -1,9 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="79a86edc-721f-4aad-920d-b595d0348b7f" name="Default" comment="跳出下单循环">
<list default="true" id="79a86edc-721f-4aad-920d-b595d0348b7f" name="Default" comment="转义">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/config/ticket_config.yaml" afterPath="$PROJECT_DIR$/config/ticket_config.yaml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/init/select_ticket_info.py" afterPath="$PROJECT_DIR$/init/select_ticket_info.py" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
@ -25,7 +24,7 @@
<SUITE FILE_PATH="coverage/12306$ticketConf.coverage" NAME="ticketConf Coverage Results" MODIFIED="1515140061195" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/yixing/config" />
<SUITE FILE_PATH="coverage/12306$login.coverage" NAME="login Coverage Results" MODIFIED="1501571219088" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/yixing/init" />
<SUITE FILE_PATH="coverage/12306$tiket.coverage" NAME="tiket Coverage Results" MODIFIED="1495973122962" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/yixing" />
<SUITE FILE_PATH="coverage/12306$run__1_.coverage" NAME="run (1) Coverage Results" MODIFIED="1515735004838" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
<SUITE FILE_PATH="coverage/12306$run__1_.coverage" NAME="run (1) Coverage Results" MODIFIED="1515806621909" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
<SUITE FILE_PATH="coverage/12306$haha.coverage" NAME="haha Coverage Results" MODIFIED="1515250987704" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/yixing" />
<SUITE FILE_PATH="coverage/12306$12306.coverage" NAME="12306 Coverage Results" MODIFIED="1495722251078" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
</component>
@ -41,9 +40,11 @@
<entry file="file://$PROJECT_DIR$/init/login.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2030">
<caret line="145" column="38" lean-forward="false" selection-start-line="141" selection-start-column="7" selection-end-line="145" selection-end-column="38" />
<caret line="145" column="38" lean-forward="false" selection-start-line="145" selection-start-column="38" selection-end-line="145" selection-end-column="38" />
<folding>
<element signature="e#41#54#0" expanded="true" />
<marker date="1515762076269" expanded="true" signature="1221:1288" ph="..." />
<marker date="1515762076269" expanded="true" signature="4854:5102" ph="..." />
</folding>
</state>
</provider>
@ -83,34 +84,33 @@
</provider>
</entry>
</file>
<file leaf-file-name="select_ticket_info.py" pinned="false" current-in-tab="false">
<file leaf-file-name="select_ticket_info.py" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/init/select_ticket_info.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="214">
<caret line="268" column="8" lean-forward="false" selection-start-line="268" selection-start-column="8" selection-end-line="268" selection-end-column="8" />
<state relative-caret-position="659">
<caret line="223" column="57" lean-forward="true" selection-start-line="223" selection-start-column="57" selection-end-line="223" selection-end-column="57" />
<folding>
<element signature="e#23#34#0" expanded="true" />
<marker date="1515739269114" expanded="true" signature="31992:32032" ph="..." />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="ticket_config.yaml" pinned="false" current-in-tab="true">
<file leaf-file-name="ticket_config.yaml" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/config/ticket_config.yaml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="626">
<caret line="60" column="9" lean-forward="false" selection-start-line="60" selection-start-column="9" selection-end-line="60" selection-end-column="9" />
<state relative-caret-position="472">
<caret line="49" column="13" lean-forward="false" selection-start-line="49" selection-start-column="13" selection-end-line="49" selection-end-column="13" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="requirements.txt" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/requirements.txt">
<file leaf-file-name=".gitignore" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/.gitignore">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="70">
<caret line="5" column="6" lean-forward="false" selection-start-line="5" selection-start-column="0" selection-end-line="5" selection-end-column="6" />
<state relative-caret-position="0">
<caret line="0" column="6" lean-forward="true" selection-start-line="0" selection-start-column="6" selection-end-line="0" selection-end-column="6" />
<folding />
</state>
</provider>
@ -137,10 +137,6 @@
</component>
<component name="FindInProjectRecents">
<findStrings>
<find>DTO</find>
<find>\u4e0a\u6d77</find>
<find>长沙</find>
<find>_json_att</find>
<find>myurllib2</find>
<find>订单提交中,请耐心等待</find>
<find>乘车人</find>
@ -167,13 +163,17 @@
<find>恭喜您订票成功</find>
<find>checkRandCodeAnsyn</find>
<find>initDc</find>
<find>from_station</find>
<find>checkOrderInfo</find>
<find>queryLeftTicketRequestDTO</find>
<find>加入小黑屋</find>
</findStrings>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
<option name="RECENT_BRANCH_BY_REPOSITORY">
<map>
<entry key="$PROJECT_DIR$" value="c114077926c834ce85e64f9fc2620185dcf196ac" />
<entry key="$PROJECT_DIR$" value="2075ea4b8a32eaf7ebf4b02c1d30ad87d36161bc" />
</map>
</option>
</component>
@ -213,8 +213,8 @@
<option value="$PROJECT_DIR$/damatuCode/damatuWeb.py" />
<option value="$PROJECT_DIR$/.gitignore" />
<option value="$PROJECT_DIR$/init/login.py" />
<option value="$PROJECT_DIR$/init/select_ticket_info.py" />
<option value="$PROJECT_DIR$/config/ticket_config.yaml" />
<option value="$PROJECT_DIR$/init/select_ticket_info.py" />
</list>
</option>
</component>
@ -249,7 +249,6 @@
</navigator>
<panes>
<pane id="Scratches" />
<pane id="Scope" />
<pane id="ProjectPane">
<subPane>
<expand>
@ -281,6 +280,7 @@
<select />
</subPane>
</pane>
<pane id="Scope" />
</panes>
</component>
<component name="PropertiesComponent">
@ -821,24 +821,73 @@
<option name="project" value="LOCAL" />
<updated>1515736276438</updated>
</task>
<option name="localTasksCounter" value="23" />
<task id="LOCAL-00023" summary="跳出下单循环">
<created>1515739350489</created>
<option name="number" value="00023" />
<option name="presentableId" value="LOCAL-00023" />
<option name="project" value="LOCAL" />
<updated>1515739350490</updated>
</task>
<task id="LOCAL-00024" summary="fix">
<created>1515750040458</created>
<option name="number" value="00024" />
<option name="presentableId" value="LOCAL-00024" />
<option name="project" value="LOCAL" />
<updated>1515750040458</updated>
</task>
<task id="LOCAL-00025" summary="fix">
<created>1515761949031</created>
<option name="number" value="00025" />
<option name="presentableId" value="LOCAL-00025" />
<option name="project" value="LOCAL" />
<updated>1515761949031</updated>
</task>
<task id="LOCAL-00026" summary="fix">
<created>1515762020962</created>
<option name="number" value="00026" />
<option name="presentableId" value="LOCAL-00026" />
<option name="project" value="LOCAL" />
<updated>1515762020962</updated>
</task>
<task id="LOCAL-00027" summary="排队提交订单规范加强,依赖减弱&#10;测试版本">
<created>1515770162371</created>
<option name="number" value="00027" />
<option name="presentableId" value="LOCAL-00027" />
<option name="project" value="LOCAL" />
<updated>1515770162371</updated>
</task>
<task id="LOCAL-00028" summary="转义">
<created>1515771530206</created>
<option name="number" value="00028" />
<option name="presentableId" value="LOCAL-00028" />
<option name="project" value="LOCAL" />
<updated>1515771530206</updated>
</task>
<task id="LOCAL-00029" summary="fix">
<created>1515807414611</created>
<option name="number" value="00029" />
<option name="presentableId" value="LOCAL-00029" />
<option name="project" value="LOCAL" />
<updated>1515807414611</updated>
</task>
<option name="localTasksCounter" value="30" />
<servers />
</component>
<component name="ToolWindowManager">
<frame x="0" y="0" width="1440" height="900" extended-state="0" />
<editor active="true" />
<layout>
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.17238913" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.17453505" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.5465538" sideWeight="0.50429183" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32889965" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Python Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.47922438" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.54413545" sideWeight="0.49570817" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32889965" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Python Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4788392" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.24964234" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32889965" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.2623942" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3297568" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.7315599" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Data View" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3297568" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
@ -917,22 +966,23 @@
<MESSAGE value="优化订购车票流程" />
<MESSAGE value="1、12306接口无响应的时候给出合理提示&#10;2、优化订票排队时间" />
<MESSAGE value="更改冗余目录结构" />
<MESSAGE value="fix" />
<MESSAGE value="更改车次提示不间断" />
<MESSAGE value="修改提交需要验证码逻辑" />
<MESSAGE value="提交验证码拉去类别问题" />
<MESSAGE value="增加提交订单验证码校验" />
<MESSAGE value="跳出下单循环" />
<option name="LAST_COMMIT_MESSAGE" value="跳出下单循环" />
<MESSAGE value="排队提交订单规范加强,依赖减弱&#10;测试版本" />
<MESSAGE value="转义" />
<MESSAGE value="fix" />
<option name="LAST_COMMIT_MESSAGE" value="fix" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<option name="time" value="18" />
<option name="time" value="19" />
</breakpoint-manager>
<watches-manager />
</component>
<component name="editorHistoryManager">
<entry file="file://$USER_HOME$/.PyCharm2016.3/system/python_stubs/-762174762/PyQt5/QtWidgets/QColorDialog.py" />
<entry file="file://$USER_HOME$/.PyCharm2016.3/system/python_stubs/-762174762/PyQt5/Qt.py" />
<entry file="file://$USER_HOME$/.PyCharm2016.3/system/python_stubs/-762174762/PyQt5/QtWidgets/QGridLayout.py" />
<entry file="file://$PROJECT_DIR$/yixing/ChildrenForm.py" />
@ -1037,14 +1087,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/.gitignore">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="28">
<caret line="2" column="6" lean-forward="false" selection-start-line="2" selection-start-column="6" selection-end-line="2" selection-end-column="6" />
<folding />
</state>
</provider>
</entry>
<entry file="file:///System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/random.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="117">
@ -1056,9 +1098,30 @@
<entry file="file://$PROJECT_DIR$/init/login.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2030">
<caret line="145" column="38" lean-forward="false" selection-start-line="141" selection-start-column="7" selection-end-line="145" selection-end-column="38" />
<caret line="145" column="38" lean-forward="false" selection-start-line="145" selection-start-column="38" selection-end-line="145" selection-end-column="38" />
<folding>
<element signature="e#41#54#0" expanded="true" />
<marker date="1515762076269" expanded="true" signature="1221:1288" ph="..." />
<marker date="1515762076269" expanded="true" signature="4854:5102" ph="..." />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/myException/ticketNumOutException.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="27" lean-forward="false" selection-start-line="0" selection-start-column="27" selection-end-line="0" selection-end-column="27" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/init/select_ticket_info.py.bak" />
<entry file="file://$PROJECT_DIR$/config/ticketConf.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="168">
<caret line="12" column="54" lean-forward="false" selection-start-line="12" selection-start-column="54" selection-end-line="12" selection-end-column="54" />
<folding>
<element signature="e#46#55#0" expanded="true" />
</folding>
</state>
</provider>
@ -1073,6 +1136,22 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/requirements.txt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="70">
<caret line="5" column="6" lean-forward="false" selection-start-line="5" selection-start-column="6" selection-end-line="5" selection-end-column="6" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/.gitignore">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="6" lean-forward="true" selection-start-line="0" selection-start-column="6" selection-end-line="0" selection-end-column="6" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/run.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="84">
@ -1081,50 +1160,23 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/config/ticketConf.py">
<entry file="file://$PROJECT_DIR$/config/ticket_config.yaml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="168">
<caret line="12" column="54" lean-forward="false" selection-start-line="12" selection-start-column="54" selection-end-line="12" selection-end-column="54" />
<folding>
<element signature="e#46#55#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/myException/ticketNumOutException.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="27" lean-forward="false" selection-start-line="0" selection-start-column="27" selection-end-line="0" selection-end-column="27" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/requirements.txt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="70">
<caret line="5" column="6" lean-forward="false" selection-start-line="5" selection-start-column="0" selection-end-line="5" selection-end-column="6" />
<state relative-caret-position="472">
<caret line="49" column="13" lean-forward="false" selection-start-line="49" selection-start-column="13" selection-end-line="49" selection-end-column="13" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/init/select_ticket_info.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="214">
<caret line="268" column="8" lean-forward="false" selection-start-line="268" selection-start-column="8" selection-end-line="268" selection-end-column="8" />
<state relative-caret-position="659">
<caret line="223" column="57" lean-forward="true" selection-start-line="223" selection-start-column="57" selection-end-line="223" selection-end-column="57" />
<folding>
<element signature="e#23#34#0" expanded="true" />
<marker date="1515739269114" expanded="true" signature="31992:32032" ph="..." />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/config/ticket_config.yaml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="626">
<caret line="60" column="9" lean-forward="false" selection-start-line="60" selection-start-column="9" selection-end-line="60" selection-end-column="9" />
<folding />
</state>
</provider>
</entry>
</component>
</project>

View File

@ -124,4 +124,3 @@ class DamatuApi():
# print(dmt.decode('tkcode', 287)) # 上传打码
# # print(dmt.decodeUrl('https://kyfw.12306.cn/otn/passcodeNew/getPassCodeNew?module=login&rand=sjrand&0.7586344633015405', 310)) # 上传打码
# # print(dmt.reportError('894657096')) # 上报错误

View File

@ -176,25 +176,13 @@ class select:
print("未查找到常用联系人")
raise PassengerUserException("未查找到常用联系人,请先添加联系人在试试")
def leftTicketLog(self, from_station, to_station):
"""
模拟进入车次列表页
:param from_station:
:param to_station:
:return:
"""
leftTicketLogUrl = 'https://kyfw.12306.cn/otn/leftTicket/log?leftTicketDTO.train_date={0}&leftTicketDTO.from_station={1}&leftTicketDTO.to_station={2}&purpose_codes=ADULT'.format(
self.station_date, from_station, to_station)
leftTicketLog = json.loads(myurllib2.get(leftTicketLogUrl), encoding='utf-8')
if "status" in leftTicketLog and leftTicketLog["status"] is True:
return True
else:
if "message" in leftTicketLog and leftTicketLog["message"]:
print leftTicketLog["message"]
elif "validateMessages" in leftTicketLog and leftTicketLog["validateMessages"]:
print leftTicketLog["validateMessages"]
def submitOrderRequestFunc(self, from_station, to_station, station_date=None):
select_url = 'https://kyfw.12306.cn/otn/leftTicket/queryZ?leftTicketDTO.train_date={0}&leftTicketDTO.from_station={1}&leftTicketDTO.to_station={2}&purpose_codes=ADULT'.format(
self.station_date if station_date is None else station_date, from_station, to_station)
station_ticket = json.loads(myurllib2.get(select_url), encoding='utf-8')
return station_ticket
def submitOrderRequest(self, from_station, to_station):
def submitOrderRequestImplement(self, from_station, to_station,):
"""
提交车次信息
车次对应字典
@ -209,8 +197,7 @@ class select:
} 参照station_seat()方法
:return:
"""
select_url = 'https://kyfw.12306.cn/otn/leftTicket/queryZ?leftTicketDTO.train_date={0}&leftTicketDTO.from_station={1}&leftTicketDTO.to_station={2}&purpose_codes=ADULT'.format(self.station_date, from_station, to_station)
station_ticket = json.loads(myurllib2.get(select_url), encoding='utf-8')
station_ticket = self.submitOrderRequestFunc(from_station, to_station)
value = station_ticket['data']
if not value:
print ('{0}-{1} 车次坐席查询为空...'.format(self.from_station, self.to_station))
@ -233,6 +220,7 @@ class select:
break
else:
print ('正在尝试提交订票...')
self.submitOrderRequestFunc(from_station, to_station, self.time())
if self.check_user():
self.submit_station()
self.getPassengerTicketStr(self._station_seat[j].encode("utf8"))
@ -393,13 +381,11 @@ class select:
:param token:
:return:
"""
old_train_date = self.get_ticketInfoForPassengerForm()['queryLeftTicketRequestDTO']['train_date']+"00:00:00" # 模仿12306格式 Sun May 21 2017 00:00:00 GMT+0800 (中国标准时间)
m_time = time.mktime(time.strptime(old_train_date, "%Y%m%d%H:%M:%S"))
l_time = time.localtime(m_time)
new_train_date = time.strftime("%a %b %d %Y %H:%M:%S", l_time)
l_time = time.localtime(time.time())
new_train_date = time.strftime("%a %b %d %Y", l_time)
getQueueCountUrl = 'https://kyfw.12306.cn/otn/confirmPassenger/getQueueCount'
data = {
'train_date': new_train_date,
'train_date': str(new_train_date) + " 00:00:00 GMT+0800 (CST)",
'train_no': self.get_ticketInfoForPassengerForm()['queryLeftTicketRequestDTO']['train_no'],
'stationTrainCode': self.get_ticketInfoForPassengerForm()['queryLeftTicketRequestDTO']['station_train_code'],
'seatType': self.set_type,
@ -547,7 +533,7 @@ class select:
elif "messages" in queryOrderWaitTimeResult and queryOrderWaitTimeResult["messages"]:
print("排队等待失败: " + queryOrderWaitTimeResult["messages"])
else:
print("{}排队中,请耐心等待".format(num))
print("{}排队中,请耐心等待".format(num))
else:
print("排队中")
time.sleep(2)
@ -609,37 +595,37 @@ class select:
def main(self):
from_station, to_station = self.station_table(self.from_station, self.to_station)
if self.leftTicketLog(from_station, to_station):
num = 1
while 1:
try:
num += 1
time.sleep(self.select_refresh_interval)
if time.strftime('%H:%M:%S', time.localtime(time.time())) > "23:00:00":
print "12306休息时间本程序自动停止,明天早上七点运行"
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)
except PassengerUserException as e:
print e.message
# if self.leftTicketLog(from_station, to_station):
num = 1
while 1:
try:
num += 1
time.sleep(self.select_refresh_interval)
if time.strftime('%H:%M:%S', time.localtime(time.time())) > "23:00:00":
print "12306休息时间本程序自动停止,明天早上七点运行"
break
except ticketConfigException as e:
print e.message
break
except ticketIsExitsException as e:
print e.message
break
except ticketNumOutException as e:
print e.message
break
except ValueError as e:
if e.message == "No JSON object could be decoded":
print("12306接口无响应正在重试")
else:
print(e.message)
except KeyError as e:
start_time = datetime.datetime.now()
self.submitOrderRequestImplement(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)
except PassengerUserException as e:
print e.message
break
except ticketConfigException as e:
print e.message
break
except ticketIsExitsException as e:
print e.message
break
except ticketNumOutException as e:
print e.message
break
except ValueError as e:
if e.message == "No JSON object could be decoded":
print("12306接口无响应正在重试")
else:
print(e.message)
except KeyError as e:
print(e.message)
# class selectProducer(threading.Thread):

BIN
tkcode

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.9 KiB

After

Width:  |  Height:  |  Size: 14 KiB