《Python学习课件---055论一只爬虫的自我修养3:隐藏》由会员分享,可在线阅读,更多相关《Python学习课件---055论一只爬虫的自我修养3:隐藏(4页珍藏版)》请在金锄头文库上搜索。
零基础入门学习Python 作者:小甲鱼 让编程改变世界 Change the world by program 论一只爬虫的自我修养3 隐藏 修改 headers 通过Request的headers参数修改 通过Request.add_header()方法修改 代理 步骤: 1. 参数是一个字典 类型:代理ip:端口号 proxy_support = urllib.request.ProxyHandler() 2. 定制、创建一个 opener opener = urllib.request.build_opener(proxy_support) 3a. 安装 opener urllib.request.install_opener(opener) 3b. 调用 opener opener.open(url)