说明:

1. 好像是这个网站的代理http://www.xicidaili.com/

2. 第2,3行的模块不用导入,之前的忘删了。。

3. http://www.whatismyip.com.tw/这个网站可以查看本机ip

4. 指定代理,创建代理,安装代理,打开链接,over。。

5. urllib.request.ProxyHandler({"http":"110.72.20.12:8123"}) -> urllib.request.build_opener -> request.install_opener -> urllib.request.urlopen

 import urllib.request
import urllib.parse
import json iplist = ["110.72.20.12:8123","180.76.154.5:8888"]
proxies = {
"http": "http://10.10.1.10:3128",
"https": "http://10.10.1.10:1080",
}
url = "http://www.whatismyip.com.tw/"
# url = "http://www.tuwenclub.com" proxy_support = urllib.request.ProxyHandler({"http":"110.72.20.12:8123"})
opener = urllib.request.build_opener(proxy_support)
opener.addheaders = [("User-Agent","Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.22 Safari/537.36 SE 2.X MetaSr 1.0")]
urllib.request.install_opener(opener)
response = urllib.request.urlopen(url)
html = response.read().decode("utf-8") print(html)

最新文章

  1. 【转】c3p0详细配置
  2. 字符输入流Reader简要概括
  3. JSONModel 嵌套字典数组 JSONModel nest NSDictionary NSArray
  4. cocos2d-x内存管理(见解)
  5. 批量 kill mysql 中运行时间长的sql
  6. 用定时器令P0(或其它IO口)产生多路方波
  7. uLua 学习笔记 之一 lua脚本 打包与读取
  8. bzoj 3242: [Noi2013]快餐店 章鱼图
  9. python学习随笔
  10. 跟我学android-常用控件之 TextView
  11. dage手法之 头部和banner ad tpl_header
  12. SQLite:自学笔记(1)——快速入门
  13. vmware fusion 10/pro 10序列号
  14. 开源IMDG之GridGain
  15. 距离度量以及python实现(一)
  16. 基于Windows服务的WCF
  17. 神经网络架构pytorch-MSELoss损失函数
  18. intelij idea设置和使用git
  19. Zabbix告警脚本-微信
  20. SQL Server中的数据类型

热门文章

  1. mysql的正则表达式
  2. 小课堂week18 编程范式巡礼第三季 谈谈依赖反转
  3. Oracle spatial抽稀函数(SDO_UTIL.SIMPLIFY)
  4. .NET破解之爱奇迪(三)
  5. Ext.encode 与 Ext.decode .
  6. python环境变量的配置
  7. jquery prop('checked', true)解决attr('checked', true)不能选中radio问题
  8. 一对一关系数据库表 java类描述
  9. MySQL学习记录一
  10. Postman+Postman interceptor的安装和使用-解决把chrome浏览器登录状态同步到postman进行有依赖的接口测试 Postman 使用方法详解