企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
#### 为什么爬虫需要使用代理? ``` 让目标服务器以为不是同一个客户端在请求,放置因为ip发送请求过多而被反爬 防止我们的真实地址被泄露,防止被追究 ``` #### 使用代理 ``` headers = { "User-Agent":"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36" } proxies = { "http": "http://124.152.32.140:53281", } response = requests.get("http://www.baidu.com", proxies=proxies, headers=headers) print(response.content.decode("utf8")) ```