Created
March 22, 2017 16:28
-
-
Save KrustyHack/a2de08b3867675abfb16a366badf0913 to your computer and use it in GitHub Desktop.
Simple Proxies Checking with Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests, random | |
from termcolor import colored | |
from multiprocessing.dummy import Pool as ThreadPool | |
def get(proxy): | |
#print('Trying %s' % proxy) | |
try: | |
proxies = { | |
'http': 'http://%s' % (proxy) , | |
'https': 'http://%s' % (proxy), | |
} | |
r = requests.get("http://v4.ifconfig.co/ip", proxies=proxies, timeout=5) | |
if r.status_code == requests.codes.ok: | |
print(colored(proxy, 'green')) | |
else: | |
print(colored(proxy, 'red')) | |
except: | |
print(colored(proxy, 'red')) | |
with open('proxies.txt') as f: | |
d = [str(proxy).strip() for proxy in f] | |
pool = ThreadPool(50) | |
results = pool.map(get, d) | |
#get(d) | |
pool.close() | |
pool.join() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment