I want to click a link over and over again while different proxies are enabled to trick the host into thinking I am doing it on different IP adresses. Wha开发者_开发问答t is the simples way to do this in python?
Thanks!
First, get a list of proxies, then use something like
import socks
import socket
import urllib2
proxies = ['127.0.0.1:1080', 'someproxy:1888', ... ] # you could load a file here
for proxy in proxies:
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, *proxy.split(':', 1))
socket.socket = socks.socksocket
urllib2.urlopen(URL)
精彩评论