小编Dir*_*ran的帖子

网页抓取时欺骗IP地址(python)

我制作了一个网络抓取工具,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)

python tcp web-scraping

5
推荐指数
3
解决办法
1791
查看次数

标签 统计

python ×1

tcp ×1

web-scraping ×1