开发者

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

开发者 https://www.devze.com 2023-01-16 23:05 出处:网络
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

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

精彩评论

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

关注公众号