Answer the question
In order to leave comments, you need to log in
How to check the proxy for validity?
I'm trying to check the proxy from the "http_proxy" list using the following code:
from colorama import Fore
import requests
http_proxy = ["87.107.18.83:8080","104.245.228.65:8080","0.0.0.1:80"]
class checker(object):
def check(self,x):
url='http://google.com'
try:
requests.get(url,proxies={'http':'http://'+x},timeout=(20.05,27), verify=False)
except requests.exceptions.ConnectionError as e:
print(Fore.BLUE+'ОШИБКА!!!',e)
return e
except requests.exceptions.ConnectTimeout as e:
print(Fore.BLUE+'ОШИБКА!!! Connection timeout',e)
return e
except requests.exceptions.HTTPError as e:
print(Fore.BLUE+'ОШИБКА!!! code',e.code)
return e.code
except requests.exceptions.Timeout as e:
print(Fore.BLUE+'ОШИБКА!!! Connection Timeout!',e)
return e
except urllib3.exceptions.ProxySchemeUnknown as e:
print(Fore.BLUE+'ОШИБКА!!!',e)
return e
c = checker()
for i in http_proxy:
if c.check(i):
print(Fore.RED + 'Bad proxy', i)
else:
print(Fore.GREEN + 'Good proxy', i)
ОШИБКА!!! HTTPConnectionPool(host='87.107.18.83', port=8080): Max retries exceeded with url: http://google.com/ (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x0000000003FB8340>, 'Connection to 87.107.18.83 timed out. (connect timeout=20.05)'))
Bad proxy 87.107.18.83:8080
ОШИБКА!!! HTTPConnectionPool(host='104.245.228.65', port=8080): Max retries exceeded with url: http://google.com/ (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x0000000003FB8D90>, 'Connection to 104.245.228.65 timed out. (connect timeout=20.05)'))
Bad proxy 104.245.228.65:8080
ОШИБКА!!! HTTPConnectionPool(host='0.0.0.1', port=80): Max retries exceeded with url: http://google.com/ (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0000000003FB8CD0>: Failed to establish a new connection: [WinError 10051] Сделана попытка выполнить операцию на сокете при отключенной сети')))
Bad proxy 0.0.0.1:80
Answer the question
In order to leave comments, you need to log in
the first proxy is invalid, the second works fully only in the connect (tunneling) mode,
both are not anonymous (the client's ip shines) and is not available in the standard https support mode,
respectively, from http google.com redirect to https www.google.com does not work
list of live (update every 10 minutes)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question