Python Check Proxy Speed

Python Check Proxy Speed

Proxy Check in python – Stack Overflow

The simplest was is to simply catch the IOError exception from urllib:
try:
urllib. urlopen(
“,
proxies={”:”})
except IOError:
print “Connection error! (Check proxy)”
else:
print “All was fine”
Also, from this blog post – “check status proxy address” (with some slight improvements):
for python 2
import urllib2
import socket
def is_bad_proxy(pip):
proxy_handler = oxyHandler({”: pip})
opener = _opener(proxy_handler)
dheaders = [(‘User-agent’, ‘Mozilla/5. 0’)] stall_opener(opener)
quest(”) # change the URL to test here
sock=urllib2. urlopen(req)
except TPError, e:
print ‘Error code: ‘,
return
except Exception, detail:
print “ERROR:”, detail
return True
return False
def main():
tdefaulttimeout(120)
# two sample proxy IPs
proxyList = [‘125. 76. 226. 9:80’, ‘213. 55. 87. 162:6588’] for currentProxy in proxyList:
if is_bad_proxy(currentProxy):
print “Bad Proxy%s”% (currentProxy)
print “%s is working”% (currentProxy)
if __name__ == ‘__main__’:
main()
for python 3
import quest
import
quest. urlopen(req)
except as e:
print(‘Error code: ‘, )
except Exception as detail:
print(“ERROR:”, detail)
proxyList = [‘125. 9:80′, ’25. 176. 126. 9:80’] print(“Bad Proxy%s”% (currentProxy))
print(“%s is working”% (currentProxy))
Remember this could double the time the script takes, if the proxy is down (as you will have to wait for two connection-timeouts).. Unless you specifically have to know the proxy is at fault, handling the IOError is far cleaner, simpler and quicker..
proxy-checker - PyPI

proxy-checker – PyPI

Project description
A proxy checker in Python using PycURL, a Python interface to libcurl.
Description
The proxy checker takes a proxy as input and uses it to send a request to a proxy judge (a website that outputs the information that was sent to it). If the request succeeds, the proxy checker will use the information it receives from the proxy judge to determine the proxy’s:
Country
Protocol
Anonymity
Speed
Installation
pip install proxy-checker
Usage
from proxy_checker import ProxyChecker
checker = ProxyChecker()
eck_proxy(‘:‘)
{
“country”: “United States”,
“country_code”: “US”,
“protocols”: [“socks4”, “socks5”],
“anonymity”: “Elite”,
“timeout”: 1649}
Parameters
Name
Type
Default
proxy
str
The proxy to test
check_country
bool
True
If true, the proxy’s country will be looked up
check_address
False
If true, the proxy’s remote address will looked up
user
None
The proxy’s username
password
The proxy’s password
Requirements
Python 3. *
PycURL – A Python interface to libcurl *
* If you have trouble installing PycURL on Windows, try to use Christoph Gohlke’s collection of Python Extension Package for Windows.
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
License
MIT
Download files
Download the file for your platform. If you’re not sure which to choose, learn more about installing packages.
Files for proxy-checker, version 0. 6
Filename, size
File type
Python version
Upload date
Hashes
(4. 6 kB)
Wheel
py3
Oct 19, 2020
View
(3. 6 kB)
Source
View
proxy-scraper-checker - PythonRepo

proxy-scraper-checker – PythonRepo

Fast and configurable script to get and check free HTTP, SOCKS4 and SOCKS5 proxies from different sources and save them to files. Script can also get geolocation for each proxy and check if proxies are anonymous.
You can get proxies obtained using this script in monosans/proxy-list (updated every ~15 minutes).
Requirements
maxminddb
requests
PySocks
Using this script
Make sure your Python version is >= 3. 6.
Install libraries from
Edit according to your needs.
Run
Folders description
proxies – proxies with any anonymity level.
proxies_anonymous – anonymous proxies.
proxies_geolocation – same as proxies but including geolocation info.
proxies_geolocation_anonymous – same as proxies_anonymous but including geolocation info.
Buy me a coffee
If you want to thank me financially, ask for details in Telegram or VK.
License
Licensed under the MIT license.
This product includes GeoLite2 data created by MaxMind, available from.

Frequently Asked Questions about python check proxy speed

Share this post

Leave a Reply

Your email address will not be published. Required fields are marked *