From 2df57447d3a809d9458c172529daa4f0c9d39296 Mon Sep 17 00:00:00 2001 From: wenxianping <931128603@qq.com> Date: Mon, 7 Jan 2019 11:54:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96cdn=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- agency/cdn_utils.py | 17 +++++++++++++---- inter/GetRandCode.py | 27 --------------------------- 2 files changed, 13 insertions(+), 31 deletions(-) diff --git a/agency/cdn_utils.py b/agency/cdn_utils.py index f081a6e..6559259 100755 --- a/agency/cdn_utils.py +++ b/agency/cdn_utils.py @@ -53,14 +53,23 @@ class CDNProxy: def open_cdn_file(self): cdn = [] - cdn_re = re.compile("CONNECT (\S+) HTTP/1.1") + # cdn_re = re.compile("CONNECT (\S+) HTTP/1.1") + # path = os.path.join(os.path.dirname(__file__), '../cdn_list') + # with open(path, "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: + # print(cdn_list[0].split(":")[0]) + # cdn.append(cdn_list[0].split(":")[0]) + # return cdn path = os.path.join(os.path.dirname(__file__), '../cdn_list') with open(path, "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]) + if i and "kyfw.12306.cn:443" not in i: + cdn.append(i.replace("\n", "")) + print(cdn) return cdn def get_cdn_list(self): diff --git a/inter/GetRandCode.py b/inter/GetRandCode.py index b7517b5..8d496e4 100644 --- a/inter/GetRandCode.py +++ b/inter/GetRandCode.py @@ -53,33 +53,6 @@ def codexy(Ofset=None, is_raw_input=True): post = [] offsetsX = 0 # 选择的答案的left值,通过浏览器点击8个小图的中点得到的,这样基本没问题 offsetsY = 0 # 选择的答案的top值 - # for ofset in select: - # if ofset == '1': - # offsetsY = 46 - # offsetsX = 42 - # elif ofset == '2': - # offsetsY = 46 - # offsetsX = 105 - # elif ofset == '3': - # offsetsY = 45 - # offsetsX = 184 - # elif ofset == '4': - # offsetsY = 48 - # offsetsX = 256 - # elif ofset == '5': - # offsetsY = 36 - # offsetsX = 117 - # elif ofset == '6': - # offsetsY = 112 - # offsetsX = 115 - # elif ofset == '7': - # offsetsY = 114 - # offsetsX = 181 - # elif ofset == '8': - # offsetsY = 111 - # offsetsX = 252 - # else: - # pass for ofset in select: if ofset == '1': offsetsY = 77