mirror of https://github.com/testerSunshine/12306
自动切换ip说明
parent
ed4e4dc688
commit
e2c645f7f7
|
@ -5,9 +5,9 @@
|
|||
- 依赖库
|
||||
- 依赖若快 若快注册地址:http://www.ruokuai.com/client/index?6726 推荐用若快,打码兔平台已经关闭
|
||||
- 项目依赖包 requirements.txt
|
||||
- 安装方法-Windows: pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
|
||||
- 安装方法-Windows:
|
||||
- 安装方法-Linux:
|
||||
- root用户(避免多python环境产生问题): python2 -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
|
||||
- root用户(避免多python环境产生问题): python2 -m pip install -i https://pypi.tuna.tsinghua.e pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txtdu.cn/simple -r requirements.txt
|
||||
- 非root用户(避免安装和运行时使用了不同环境): sudo python2 -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
|
||||
|
||||
- 项目使用说明
|
||||
|
|
|
@ -11,7 +11,6 @@ import wrapcache
|
|||
|
||||
from agency.cdn_utils import CDNProxy
|
||||
from config import urlConf, configCommon
|
||||
from config.AutoSynchroTime import autoSynchroTime
|
||||
from config.TicketEnmu import ticket
|
||||
from config.configCommon import seat_conf
|
||||
from config.configCommon import seat_conf_2
|
||||
|
@ -213,7 +212,8 @@ class select:
|
|||
from_station, to_station = self.station_table(self.from_station, self.to_station)
|
||||
num = 0
|
||||
s = getPassengerDTOs(session=self, ticket_peoples=self.ticke_peoples)
|
||||
s.sendGetPassengerDTOs()
|
||||
passenger = s.sendGetPassengerDTOs()
|
||||
wrapcache.set("user_info", passenger, timeout=9999999)
|
||||
while 1:
|
||||
try:
|
||||
num += 1
|
||||
|
|
|
@ -17,7 +17,7 @@ def getPassCodeNewOrderAndLogin(session, imgType):
|
|||
else:
|
||||
codeImgUrl = copy.deepcopy(session.urls["codeImgByOrder"])
|
||||
codeImgUrl["req_url"] = codeImgUrl["req_url"].format(random.random())
|
||||
print (u"下载验证码...")
|
||||
print(u"下载验证码...")
|
||||
img_path = './tkcode.png'
|
||||
result = session.httpClint.send(codeImgUrl)
|
||||
try:
|
||||
|
@ -34,4 +34,4 @@ def getPassCodeNewOrderAndLogin(session, imgType):
|
|||
img.write(result)
|
||||
return result
|
||||
except OSError:
|
||||
print (u"验证码下载失败,可能ip被封,确认请手动请求: {0}".format(codeImgUrl))
|
||||
print(u"验证码下载失败,可能ip被封,确认请手动请求: {0}".format(codeImgUrl))
|
||||
|
|
|
@ -130,6 +130,7 @@ class HTTPClient(object):
|
|||
url_host = urls["Host"]
|
||||
else:
|
||||
url_host = urls["Host"]
|
||||
http = urls.get("httpType") or "https"
|
||||
for i in range(re_try):
|
||||
try:
|
||||
# sleep(urls["s_time"]) if "s_time" in urls else sleep(0.001)
|
||||
|
@ -141,7 +142,7 @@ class HTTPClient(object):
|
|||
response = self._s.request(method=method,
|
||||
timeout=2,
|
||||
proxies=self._proxies,
|
||||
url="https://" + url_host + req_url,
|
||||
url=http + "://" + url_host + req_url,
|
||||
data=data,
|
||||
allow_redirects=allow_redirects,
|
||||
verify=False,
|
||||
|
@ -160,7 +161,7 @@ class HTTPClient(object):
|
|||
else:
|
||||
logger.log(
|
||||
u"url: {} 返回参数为空".format(urls["req_url"]))
|
||||
return error_data
|
||||
continue
|
||||
else:
|
||||
sleep(urls["re_time"])
|
||||
except (requests.exceptions.Timeout, requests.exceptions.ReadTimeout, requests.exceptions.ConnectionError):
|
||||
|
|
Loading…
Reference in New Issue