python爬虫学习(十九)IP代理

import requests
url = 'https://www.baidu.com/s?wd=ip'
headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.87 Safari/537.36',
    'Connection':'close',
     'verify':'False'
}


page = requests.get(url=url,headers=headers,proxies= {'https':'114.239.29.169'})
print(page.status_code)
page.encoding='utf-8'
page_text=page.text
with open ('ip.html','w',encoding='UTF-8') as fp:
    fp.write(page_text)

#透明
#匿名
#高匿
#针对ip封锁
发布了23 篇原创文章 · 获赞 0 · 访问量 661

猜你喜欢

转载自blog.csdn.net/haimian_baba/article/details/104773574