-
-
Save Lh4cKg/1142e9b5d52e4eee7b2c to your computer and use it in GitHub Desktop.
Python Proxy Tester
This file contains 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 | |
nList= [] | |
nProxL = '' | |
file = open('proxy.txt') | |
for line in file: | |
try: | |
aproxy = line.strip('\n') | |
user_agent = {'User-agent': 'Mozilla/5.0'} | |
print aproxy | |
proxies = { | |
"http": aproxy | |
} | |
r = requests.get("http://www.google.com", proxies=proxies, headers=user_agent, timeout=1) | |
aproxy = aproxy + " \n" | |
nList.append(aproxy) | |
nProxL = ''.join(nList) | |
f = open('WorkingProxy.txt', 'w') | |
f.write(nProxL) | |
f.close() | |
print aproxy, " Added" | |
except Exception, e: | |
print "Connection Error ", e | |
file.close() | |
print "Proxy list cleaned and updated!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment