forked from pjialin/py12306
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
147 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,5 @@ | |
venv | ||
__pycache__ | ||
env.py | ||
env.slave.py | ||
env.slave.py | ||
env.docker.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
FROM python:3.6.6-slim | ||
|
||
MAINTAINER <pjialin [email protected]> | ||
|
||
WORKDIR /code | ||
|
||
COPY requirements.txt . | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
|
||
|
||
RUN mkdir /data | ||
RUN mkdir -p /data/query /data/user | ||
VOLUME /data | ||
|
||
COPY . . | ||
|
||
COPY env.docker.py.example /config/env.py | ||
|
||
CMD [ "python", "main.py" , "-c", "/config/env.py"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
# encoding=utf8 | ||
|
||
# 12306 账号 | ||
USER_ACCOUNTS = [ | ||
# 目前已支持仅查询,不下单,屏蔽掉下面的账号即可 | ||
{ | ||
'key': 0, # 如使用多个账号 key 不能重复 | ||
'user_name': 'your user name', | ||
'password': 'your password' | ||
}, | ||
# { | ||
# 'key': 'wangwu', | ||
# 'user_name': '[email protected]', | ||
# 'password': 'wangwu' | ||
# } | ||
] | ||
|
||
# 查询间隔(指每一个任务中每一个日期的间隔 / 单位秒) | ||
# 默认取间隔/2 到 间隔之间的随机数 如设置为 1 间隔则为 0.5 ~ 1 之间的随机数 | ||
# 接受字典形式 格式: {'min': 0.5, 'max': 1} | ||
QUERY_INTERVAL = 1 | ||
|
||
# 用户心跳检测间隔 格式同上 | ||
USER_HEARTBEAT_INTERVAL = 120 | ||
|
||
# 多线程查询 | ||
QUERY_JOB_THREAD_ENABLED = 0 # 是否开启多线程查询,开启后第个任务会单独分配线程处理 | ||
|
||
# 打码平台账号 | ||
# 目前只支持若快打码,注册地址:http://www.ruokuai.com/login | ||
AUTO_CODE_ACCOUNT = { | ||
'user': 'your user name', | ||
'pwd': 'your password' | ||
} | ||
|
||
# 语音验证码 | ||
# 没找到比较好用的,现在用的这个是阿里云 API 市场上的,基本满足要求,价格也便宜 | ||
# 购买成功后到控制台找到 APPCODE 放在下面就可以了 | ||
# 地址:https://market.aliyun.com/products/57126001/cmapi019902.html | ||
NOTIFICATION_BY_VOICE_CODE = 1 # 开启语音验证码 | ||
NOTIFICATION_API_APP_CODE = 'your app code' | ||
NOTIFICATION_VOICE_CODE_PHONE = 'your phone' # 接受通知的手机号 | ||
|
||
# 输出日志到文件 (Docker 中不建议修改此组配置项) | ||
OUT_PUT_LOG_TO_FILE_ENABLED = 1 | ||
OUT_PUT_LOG_TO_FILE_PATH = '/config/12306.log' # 日志目录 | ||
RUNTIME_DIR = '/data/' | ||
QUERY_DATA_DIR = '/data/query/' | ||
USER_DATA_DIR = '/data/user/' | ||
|
||
# 分布式集群配置 | ||
CLUSTER_ENABLED = 0 # 集群状态 | ||
NODE_IS_MASTER = 1 # 是否是主节点 同时只能启用 1 个主节点 | ||
NODE_SLAVE_CAN_BE_MASTER = 1 # 主节点宕机后,子节点是否可以自动提升为主节点(建议打开) | ||
NODE_NAME = 'master' # 节点名称,不能重复 | ||
REDIS_HOST = 'localhost' # Redis host | ||
REDIS_PORT = '6379' # Redis post | ||
REDIS_PASSWORD = '' # # Redis 密码 没有可以留空 | ||
|
||
# 查询任务 | ||
QUERY_JOBS = [ | ||
{ | ||
# 'job_name': 'bj -> sz', # 任务名称,不填默认会以车站名命名,不可重复 | ||
'account_key': 0, # 将会使用指定账号下单 | ||
'left_dates': [ # 出发日期 :Array | ||
"2019-01-25", | ||
"2019-01-26", | ||
], | ||
'stations': { # 车站 支持多个车站同时查询 :Dict or :List | ||
'left': '北京', | ||
'arrive': '深圳', | ||
}, | ||
# # 多个车站示例 (建议添加多个,有时多买几站成功率会高一点) | ||
# 'stations': [{ | ||
# 'left': '北京', | ||
# 'arrive': '深圳', | ||
# },{ # 多个车站示例 | ||
# 'left': '北京', | ||
# 'arrive': '广州', | ||
# }], | ||
'members': [ # 乘客姓名,会根据当前账号自动识别乘客类型 购买儿童票 设置两个相同的姓名即可,程序会自动识别 如 ['张三', '张三'] | ||
"张三", | ||
"王五", | ||
], | ||
'allow_less_member': 0, # 是否允许余票不足时提交部分乘客 | ||
'seats': [ # 筛选座位 有先后顺序 :Array | ||
# 可用值: 特等座, 商务座, 一等座, 二等座, 软卧, 硬卧, 动卧, 硬座, 无座 | ||
'硬卧', | ||
'硬座' | ||
], | ||
'train_numbers': [ # 筛选车次 可以为空,为空则所有车次都可以提交 | ||
"K356", | ||
"K1172", | ||
"K4184" | ||
] | ||
|
||
}, | ||
# { | ||
# 'job_name': 'cd -> gz', # 任务名称,不填默认会以车站名命名,不可重复 | ||
# 'account_key': 0, # 将会使用指定账号下单 | ||
# 'left_dates': [ | ||
# "2019-01-27", | ||
# "2019-01-28" | ||
# ], | ||
# 'stations': { | ||
# 'left': '成都', | ||
# 'arrive': '广州', | ||
# }, | ||
# 'members': [ | ||
# "小王", | ||
# ], | ||
# 'allow_less_member': 0, | ||
# 'seats': [ | ||
# '硬卧', | ||
# ], | ||
# 'train_numbers': [] | ||
# } | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters