dont retry known-good hosts

master
Felix Pankratz 3 years ago
parent cea5062d10
commit cfe8e578b8

@ -31,6 +31,9 @@ def test_proxy(prx):
try: try:
result = opener.open(target, timeout=6) result = opener.open(target, timeout=6)
content = result.read().decode() content = result.read().decode()
if prx.split(':')[0] not in content:
print(srv_string + 'bait.')
return False
print(srv_string + 'ok. \u2705') print(srv_string + 'ok. \u2705')
return True return True
except error.HTTPError: except error.HTTPError:
@ -47,12 +50,12 @@ def test_proxy(prx):
return False return False
def get_proxies(): def get_proxies():
proxy_list = get_list_from_api() proxy_list = get_list_from_api()
working_list = [] working_list = []
start_length = len(proxy_list) start_length = len(proxy_list)
try: try:
for entry in proxy_list: for entry in proxy_list:
if entry not in working_list:
if test_proxy(entry): if test_proxy(entry):
working_list.append(entry) working_list.append(entry)
else: else:

Loading…
Cancel
Save