使用高匿代理访问西刺代理(假如ip被封可用高匿ip访问网站)

import requests

url='http://www.xicidaili.com'

#代理池
proxy = {
    'http':'http://140.205.222.3:80'
}

headers = {
    'User-Agent':'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36'
}
response = requests.get(url,headers=headers,proxies=proxy)
#输出西刺首页
print(response.content.decode('utf-8'))

猜你喜欢

转载自blog.csdn.net/weixin_38920937/article/details/81711683