|
@@ -40,14 +40,9 @@ def timeOutValidator(proxy):
|
|
|
'Connection': 'keep-alive',
|
|
'Connection': 'keep-alive',
|
|
|
'Accept-Language': 'zh-CN,zh;q=0.8'}
|
|
'Accept-Language': 'zh-CN,zh;q=0.8'}
|
|
|
try:
|
|
try:
|
|
|
- r=requests.get(url='http://myip.ipip.net',proxies=proxies,timeout=conf.verifyTimeout, verify=False)
|
|
|
|
|
- proxies = re.findall(r'(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})',
|
|
|
|
|
- r.text)
|
|
|
|
|
- if len(proxies)>0:
|
|
|
|
|
|
|
+ r = requests.head(conf.verifyUrl, headers=headers, proxies=proxies, timeout=conf.verifyTimeout, verify=False)
|
|
|
|
|
+ if r.status_code == 200:
|
|
|
return True
|
|
return True
|
|
|
- # r = requests.head(conf.verifyUrl, headers=headers, proxies=proxies, timeout=conf.verifyTimeout, verify=False)
|
|
|
|
|
- # if r.status_code == 200:
|
|
|
|
|
- # return True
|
|
|
|
|
except Exception as e:
|
|
except Exception as e:
|
|
|
pass
|
|
pass
|
|
|
return False
|
|
return False
|
|
@@ -60,5 +55,11 @@ def customValidator(proxy):
|
|
|
:param proxy:
|
|
:param proxy:
|
|
|
:return:
|
|
:return:
|
|
|
"""
|
|
"""
|
|
|
-
|
|
|
|
|
- return True
|
|
|
|
|
|
|
+ proxies = {"http": "http://{proxy}".format(proxy=proxy), "https": "https://{proxy}".format(proxy=proxy)}
|
|
|
|
|
+ r = requests.get(url='http://myip.ipip.net', proxies=proxies, timeout=conf.verifyTimeout, verify=False)
|
|
|
|
|
+ proxies = re.findall(r'(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})',
|
|
|
|
|
+ r.text)
|
|
|
|
|
+ if len(proxies) > 0:
|
|
|
|
|
+ return True
|
|
|
|
|
+ else:
|
|
|
|
|
+ return False
|