Skip to content

Commit

Permalink
- 优化已知bug
Browse files Browse the repository at this point in the history
- 开启cdn查询
- 自动识别查询接口
  • Loading branch information
testerSunshine committed Dec 26, 2018
1 parent 75f88a4 commit cf2e8f8
Show file tree
Hide file tree
Showing 9 changed files with 28,623 additions and 959 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@
- 测试邮箱是否可用
- 测试下单接口是否可用,有两个下单接口,随便用哪个都ok
- 如果下载验证码过期或者下载失败的问题,应该是12306封ip的策略,多重试几次,12306现在封服务器(阿里云和腾讯云)ip比较严重,尽量不要放在服务器里面
- 感谢一下小伙伴对本项目提供的帮助
- @读,◢
- @才
- [更新日志](Update.md)
5 changes: 5 additions & 0 deletions Update.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,8 @@
- 优化随机查询1-3秒,经测试很稳定,不会封ip
- 增加余票不足优先提交功能(当余票小于乘车人,如果选择优先提交,则删减联系人和余票数一致在提交)
- 开关为ticket_config.yaml配置文件中is_more_ticket参数
- 2018.12.26更新
- 优化已知bug
- 开启cdn查询
- 自动识别查询接口
16 changes: 10 additions & 6 deletions agency/cdn_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,15 @@ def get_city_id(self):
pass

def open_cdn_file(self):
f = open("./cdn_list", "a+")
return f
cdn = []
cdn_re = re.compile("CONNECT (\S+) HTTP/1.1")
with open("./cdn_list", "r") as f:
for i in f.readlines():
# print(i.replace("\n", ""))
cdn_list = re.findall(cdn_re, i)
if cdn_list and "kyfw.12306.cn:443" not in cdn_list:
cdn.append(cdn_list[0].split(":")[0])
return cdn

def get_cdn_list(self):
"""
Expand Down Expand Up @@ -101,9 +108,6 @@ def par_csv(self):
print(cdn_ip[0])





if __name__ == '__main__':
cdn = CDNProxy()
cdn.get_cdn_list()
cdn.open_cdn_file()
Loading

0 comments on commit cf2e8f8

Please sign in to comment.