Igor Savinkin
Igor Savinkin

Reputation: 6267

Way to test IP proxies

I want to test a proxy [gateway] service. What might be a simplest way to check proxies IP speed, quality [not being banned by data aggregators and providers like Google, Facebook], and other parameters)?

What I know so far:

import urllib.request
import time
opener = urllib.request.build_opener(
    urllib.request.ProxyHandler(
         {'http': 'http://127.0.0.1:9999'}))
start =  time.time()
print(opener.open('http://example.com').read())
print ('total time: {0}'.format(time.time()-start))

Upvotes: 0

Views: 201

Answers (1)

Igor Savinkin
Igor Savinkin

Reputation: 6267

Proxy speed test

import requests, time
proxies = {
  'http': 'http://50.31.10.131:8800',
  'https': 'http://50.31.10.131:8800',
}
start =  time.time()
res = requests.get('http://ipinfo.io', proxies=proxies)
print 'total time with proxies: {0} sec.'.format(round(time.time()-start, 2))

Upvotes: 1

Related Questions