开发者

How to open a link with different proxy IP adresses in python?

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)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜