我打开网址:
site = urllib2.urlopen('http://google.com')
我想要做的是用同样的方式连接我在某个地方告诉我:
site = urllib2.urlopen('http://google.com', proxies={'http':'127.0.0.1'})
但那也不起作用.
我知道urllib2有类似代理处理程序的东西,但我不记得那个功能.
我制作了一个网络抓取工具,python以向我提供有关各种Bookie网站的免费投注优惠何时更改或添加了新信息的信息。
但是,博彩公司倾向于记录与IP交通和MAC地址有关的信息,以便标出匹配的商品。
IP使用模块中的Request()方法时,我该如何欺骗我的地址urllib.request?
我的代码如下:
req = Request('https://www.888sport.com/online-sports-betting-promotions/', headers={'User-Agent': 'Mozilla/5.0'})
site = urlopen(req).read()
content = bs4.BeautifulSoup(site, 'html.parser')
Run Code Online (Sandbox Code Playgroud) 我想知道如何使用 NordVPN 服务器在使用 Python 进行 Web 自动化期间更改 IP 地址。假设以这种方式将其与 mechanize 一起使用:
br.open("url", proxies="nordvpn proxy")
Run Code Online (Sandbox Code Playgroud)
提前致谢。