parent
aa6d628c82
commit
d7c5c7215c
|
@ -170,4 +170,10 @@
|
||||||
- 更新请求第三方库
|
- 更新请求第三方库
|
||||||
- 优化若干代码,小伙伴尽情的放肆起来
|
- 优化若干代码,小伙伴尽情的放肆起来
|
||||||
|
|
||||||
|
- 2018.1.21跟新
|
||||||
|
- 修复若干bug
|
||||||
|
- 合并dev
|
||||||
|
- 恢复之前因为12306改版引起的订票功能
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
# -*- coding: utf8 -*-
|
# -*- coding: utf8 -*-
|
||||||
__author__ = 'MR.wen'
|
__author__ = 'MR.wen'
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
|
|
|
@ -85,5 +85,4 @@ urls = {
|
||||||
"req_url": "https://kyfw.12306.cn/otn/queryOrder/initNoComplete",
|
"req_url": "https://kyfw.12306.cn/otn/queryOrder/initNoComplete",
|
||||||
"req_type": "post"
|
"req_type": "post"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -149,7 +149,7 @@ class GoLogin:
|
||||||
if messages.find("密码输入错误") is not -1:
|
if messages.find("密码输入错误") is not -1:
|
||||||
raise UserPasswordException("{0}".format(messages))
|
raise UserPasswordException("{0}".format(messages))
|
||||||
else:
|
else:
|
||||||
print ("登录失败: {0}".format("".join(tresult)))
|
print ("登录失败: {0}".format(messages))
|
||||||
print ("尝试重新登陆")
|
print ("尝试重新登陆")
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
|
@ -180,6 +180,8 @@ class GoLogin:
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
user, passwd = _get_yaml()["set"]["12306count"][0]["uesr"], _get_yaml()["set"]["12306count"][1]["pwd"]
|
user, passwd = _get_yaml()["set"]["12306count"][0]["uesr"], _get_yaml()["set"]["12306count"][1]["pwd"]
|
||||||
|
if not user or not passwd:
|
||||||
|
raise UserPasswordException("温馨提示: 用户名或者密码为空,请仔细检查!")
|
||||||
login_num = 0
|
login_num = 0
|
||||||
while True:
|
while True:
|
||||||
self.cookietp()
|
self.cookietp()
|
||||||
|
|
|
@ -1,17 +1,14 @@
|
||||||
# -*- coding=utf-8 -*-
|
# -*- coding=utf-8 -*-
|
||||||
import json
|
import json
|
||||||
import datetime
|
import datetime
|
||||||
import random
|
|
||||||
import re
|
import re
|
||||||
import socket
|
import socket
|
||||||
import urllib
|
import urllib
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
from config import urlConf
|
from config import urlConf
|
||||||
from init import login
|
from init import login
|
||||||
|
|
||||||
from config.emailConf import sendEmail
|
from config.emailConf import sendEmail
|
||||||
from config.ticketConf import _get_yaml
|
from config.ticketConf import _get_yaml
|
||||||
from damatuCode.damatuWeb import DamatuApi
|
from damatuCode.damatuWeb import DamatuApi
|
||||||
|
@ -141,7 +138,7 @@ class select:
|
||||||
获取提交车票请求token
|
获取提交车票请求token
|
||||||
:return: token
|
:return: token
|
||||||
"""
|
"""
|
||||||
initdc_url = self.confUrl["initdc_url"]["req+url"]
|
initdc_url = self.confUrl["initdc_url"]["req_url"]
|
||||||
initdc_result = self.httpClint.send(initdc_url)
|
initdc_result = self.httpClint.send(initdc_url)
|
||||||
token_name = re.compile(r"var globalRepeatSubmitToken = '(\S+)'")
|
token_name = re.compile(r"var globalRepeatSubmitToken = '(\S+)'")
|
||||||
ticketInfoForPassengerForm_name = re.compile(r'var ticketInfoForPassengerForm=(\{.+\})?')
|
ticketInfoForPassengerForm_name = re.compile(r'var ticketInfoForPassengerForm=(\{.+\})?')
|
||||||
|
@ -187,7 +184,7 @@ class select:
|
||||||
select_url = self.confUrl["select_url"]["req_url"].format(
|
select_url = self.confUrl["select_url"]["req_url"].format(
|
||||||
self.station_date if station_date is None else station_date, from_station, to_station)
|
self.station_date if station_date is None else station_date, from_station, to_station)
|
||||||
station_ticket = self.httpClint.send(select_url)
|
station_ticket = self.httpClint.send(select_url)
|
||||||
return station_ticket
|
return json.loads(station_ticket)
|
||||||
|
|
||||||
def submitOrderRequestImplement(self, from_station, to_station,):
|
def submitOrderRequestImplement(self, from_station, to_station,):
|
||||||
"""
|
"""
|
||||||
|
@ -652,8 +649,6 @@ class select:
|
||||||
print(e.message)
|
print(e.message)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
login()
|
login()
|
||||||
# a = select('上海', '北京')
|
# a = select('上海', '北京')
|
||||||
|
|
Loading…
Reference in New Issue