Skip to content

Commit

Permalink
修改chromedriver作为全局配置文件
Browse files Browse the repository at this point in the history
  • Loading branch information
nick2834 committed Sep 11, 2019
1 parent 3d33aa2 commit 3f628b0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# 🚂 py12306 购票助手
感谢大佬
基于[https://github.com/pjialin](pjialin)购票助手基础上修改 [https://github.com/pjialin/py12306](https://github.com/pjialin/py12306) 十分感谢!
❤️感谢大佬[pjialin](https://github.com/pjialin)❤️

基于购票助手[https://github.com/pjialin/py12306](https://github.com/pjialin/py12306)基础上修改 ❤️十分感谢!

## Features
- [] 修复12306更新导致device_id丢失 而不能重新登录
- [x] 修复12306更新导致device_id丢失 而不能重新登录


分布式,多账号,多任务购票
Expand Down Expand Up @@ -151,8 +152,6 @@ docker-compose up -d
### 关于防封
目前查询和登录操作是分开的,查询是不依赖用户是否登录,放在 A 云 T 云容易被限制 ip,建议在其它网络环境下运行

交流群 [274781597](http://shang.qq.com/wpa/qunwpa?idkey=8eab0b6402096266a62263c1cd452149926adb5cba7a2b7a98a5adc65869addf)

### Online IDE
[![在 Gitpod 中打开](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io#https://github.com/nick2834/python12306)

Expand Down
File renamed without changes.
4 changes: 4 additions & 0 deletions env.py copy.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ USER_ACCOUNTS = [
# 'password': 'wangwu'
# }
]
# 需配置chromeDriver路径,下载地址http://chromedriver.storage.googleapis.com/index.html
# chromedriver配置版本只要和chrome的大版本匹配就行
# CHROME_PATH = "/Users/nico/Downloads/chromedriver"
CHROME_PATH = './chromedriver'

# 查询间隔(指每一个任务中每一个日期的间隔 / 单位秒)
# 默认取间隔/2 到 间隔之间的随机数 如设置为 1 间隔则为 0.5 ~ 1 之间的随机数
Expand Down
6 changes: 1 addition & 5 deletions py12306/user/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
from py12306.log.order_log import OrderLog
from py12306.log.user_log import UserLog
from py12306.log.common_log import CommonLog
PATH = lambda p: os.path.abspath(
os.path.join(os.path.dirname(__file__), p)
)
CHROME_PATH = PATH('../chromedriver')

class UserJob:
# heartbeat = 60 * 2 # 心跳保持时长
Expand Down Expand Up @@ -185,7 +181,7 @@ def request_device_id(self):
:return:
"""
print("cookie获取中")
driver = webdriver.Chrome(executable_path=CHROME_PATH)
driver = webdriver.Chrome(executable_path=Config.CONFIG_FILE.CHROME_PATH)
driver.get("https://www.12306.cn/index/index.html")
time.sleep(10)

Expand Down

0 comments on commit 3f628b0

Please sign in to comment.