How do I check the proxy for performance?

Here I have no idea how to check the proxy for performance. There is no need to check anonymity, or take into account the delay time. You just need to check whether the proxy is working or not. I was looking for sources - I found examples with the use of on-line checkers, and this is not an option.

We need the simplest ProxyCheker to Python. Give me an idea.

Author: Deleted, 2012-07-05

1 answers

I think you're talking about HTTP proxy. Here is the discussion

Hi,

Thank you all for your help. I tried urllib, httplib and sockets.

With urllib:

F = urllib.urlopen("http://www.python.org/index.html")

I get:

.... invalid proxy for http: 'cache.ilt.fhg.de:81'

Httplib works:

conn = httplib.HTTPConnection("cache.ilt.fhg.de", 81)
conn.request("GET", "http://www.python.org/index.html")
r = conn.getresponse()
print r.status, r.reason
print r.msg
while 1:
data = r.read(1024)
if len(data) < 1024: break
print data

And so do sockets:

HOST = 'cache.ilt.fhg.de'
PORT = 81
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
s.send('GET http://www.python.org/index.html HTTP/1.1\r\nAccept:
text/plain\r\n\r\n')
while 1:
data = s.recv(1024)
print data
if len(data) < 1024: break
s.close()

Thanks again

Rolf Wester.

 2
Author: moden, 2012-07-05 08:15:10