mirror of https://github.com/testerSunshine/12306
update version 1.1.117
parent
0a8ae1dd08
commit
3708c4d84b
|
@ -21,6 +21,7 @@
|
|||
2. git仓库下载:https://github.com/testerSunshine/12306model.git
|
||||
```
|
||||
- 自托管云打码服务器搭建:[12306_code_server](https://github.com/YinAoXiong/12306_code_server)
|
||||
- 如果大家有空闲的服务器,可搭建之后再这个 [issues](https://github.com/testerSunshine/12306/issues/446) 里面填入自己的服务器(请注意服务器安全!)
|
||||
- 项目依赖包查看 [requirements.txt](requirements.txt)
|
||||
- 安装方法x:
|
||||
- root用户(避免多python环境产生问题): `pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt`
|
||||
|
|
|
@ -17,10 +17,10 @@ STATION_DATES = [
|
|||
STATION_TRAINS = []
|
||||
|
||||
# 出发城市,比如深圳北,就填深圳就搜得到
|
||||
FROM_STATION = "深圳北"
|
||||
FROM_STATION = ""
|
||||
|
||||
# 到达城市 比如深圳北,就填深圳就搜得到
|
||||
TO_STATION = "广州南"
|
||||
TO_STATION = ""
|
||||
|
||||
# 座位(list) 多个座位ex:
|
||||
# "商务座",
|
||||
|
@ -32,7 +32,7 @@ TO_STATION = "广州南"
|
|||
# "硬座",
|
||||
# "无座",
|
||||
# "动卧",
|
||||
SET_TYPE = ["二等座"]
|
||||
SET_TYPE = []
|
||||
|
||||
# 当余票小于乘车人,如果选择优先提交,则删减联系人和余票数一致在提交
|
||||
# bool
|
||||
|
@ -54,18 +54,17 @@ TICKET_BLACK_LIST_TIME = 5
|
|||
IS_AUTO_CODE = True
|
||||
|
||||
# 设置2本地自动打码,需要配置tensorflow和keras库,3为云打码,由于云打码服务器资源有限(为2h4C的cpu服务器),请不要恶意请求,不然只能关闭服务器
|
||||
# ps: 请不要一直依赖云服务器资源,在此向提供服务器的"do it"同学表示感谢
|
||||
# ps: 请不要一直依赖云服务器资源,在此向所有提供服务器同学表示感谢
|
||||
AUTO_CODE_TYPE = 3
|
||||
|
||||
HOST="34.97.127.118:8000"
|
||||
REQ_URL="/verify/base64/"
|
||||
HTTP_TYPE="http"
|
||||
# 此处设置云打码服务器地址,如果有自建的服务器,可以自行更改
|
||||
HOST = "161.117.202.218:8000"
|
||||
REQ_URL = "/verify/base64/"
|
||||
HTTP_TYPE = "http"
|
||||
# HOST="12306.yinaoxiong.cn" #备用服务器稳定性较差
|
||||
# REQ_URL="/verify/base64/"
|
||||
# HTTP_TYPE="https"
|
||||
|
||||
|
||||
|
||||
# 邮箱配置,如果抢票成功,将通过邮件配置通知给您
|
||||
# 列举163
|
||||
# email: "xxx@163.com"
|
||||
|
@ -149,4 +148,4 @@ MAX_TIME = 5
|
|||
MIN_TIME = 3
|
||||
|
||||
# 软件版本
|
||||
RE_VERSION = "1.1.116"
|
||||
RE_VERSION = "1.1.117"
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -32,7 +32,7 @@ def getDrvicesID(session):
|
|||
request_device_id(session)
|
||||
elif TickerConfig.COOKIE_TYPE is 3:
|
||||
# RAIL_DEVICEID,RAIL_EXPIRATION的值打开12306官网可以获取headers-Cookies
|
||||
if not TickerConfig.RAIL_DEVICEID or TickerConfig.RAIL_EXPIRATION:
|
||||
if not TickerConfig.RAIL_DEVICEID or not TickerConfig.RAIL_EXPIRATION:
|
||||
print("警告!!: RAIL_DEVICEID,RAIL_EXPIRATION的值为空,请手动打开12306官网可以获取headers-Cookies中的RAIL_DEVICEID,RAIL_EXPIRATION,填入配置文件中")
|
||||
cookies = [{
|
||||
"RAIL_DEVICEID": TickerConfig.RAIL_DEVICEID,
|
||||
|
|
|
@ -66,5 +66,3 @@ class chechFace:
|
|||
timeout=TickerConfig.TICKET_BLACK_LIST_TIME * 60)
|
||||
g = getSuccessRate(self.session, self.secretList)
|
||||
g.sendSuccessRate()
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# -*- coding: utf8 -*-
|
||||
import json
|
||||
import random
|
||||
import socket
|
||||
from collections import OrderedDict
|
||||
from time import sleep
|
||||
|
@ -23,8 +24,13 @@ def _set_header_default():
|
|||
|
||||
|
||||
def _set_user_agent():
|
||||
user_agent = UserAgent(verify_ssl=False).random
|
||||
return user_agent
|
||||
try:
|
||||
user_agent = UserAgent(verify_ssl=False).random
|
||||
return user_agent
|
||||
except:
|
||||
print("请求头设置失败,使用默认请求头")
|
||||
return 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.' + str(
|
||||
random.randint(5000, 7000)) + '.0 Safari/537.36'
|
||||
|
||||
|
||||
class HTTPClient(object):
|
||||
|
@ -172,9 +178,11 @@ class HTTPClient(object):
|
|||
logger.log(
|
||||
u"出参:{0}".format(response.content.decode()))
|
||||
if urls["is_json"]:
|
||||
return json.loads(response.content.decode() if isinstance(response.content, bytes) else response.content)
|
||||
return json.loads(
|
||||
response.content.decode() if isinstance(response.content, bytes) else response.content)
|
||||
else:
|
||||
return response.content.decode("utf8", "ignore") if isinstance(response.content, bytes) else response.content
|
||||
return response.content.decode("utf8", "ignore") if isinstance(response.content,
|
||||
bytes) else response.content
|
||||
else:
|
||||
print(f"url: {urls['req_url']}返回参数为空, 接口状态码: {response.status_code}")
|
||||
logger.log(
|
||||
|
|
Loading…
Reference in New Issue