A simple and beautiful blog
爬取内容时,我们的ip可能会被网站封掉。这个时候就需要用代理来爬。下面是使用代理的简单例子
12345678910
import requestsproxies = { "https": "112.47.3.53:3128", # "http": "112.47.3.53:3128",}response = requests.get("https://www.baidu.com", proxies=proxies)response.encoding = 'utf-8'print(response.text)
Seraching...