python HTMLParser代理访问的通用写法
2018-01-23 13:53
148 查看
from urllib import request
proxyConfig="http://%s:%s@%s"%("hui.zhang",'123456','10.110.5.235:8080')
proxyHandler=request.ProxyHandler({'http':proxyConfig})
url='https://www.python.org/events/python-events/'
req=request.Request(url)
opener=request.build_opener(proxyHandler)
with opener.open(req) as f:
data=f.read().decode('utf-8')
proxyConfig="http://%s:%s@%s"%("hui.zhang",'123456','10.110.5.235:8080')
proxyHandler=request.ProxyHandler({'http':proxyConfig})
url='https://www.python.org/events/python-events/'
req=request.Request(url)
opener=request.build_opener(proxyHandler)
with opener.open(req) as f:
data=f.read().decode('utf-8')
相关文章推荐
- python3.0学习七: 用代理访问网页
- python selenium Frefox使 用代理访问网页
- python3使用多代理访问网站
- python3 使用代理访问
- python]用urllib2设置代理访问网页
- Python 设置 IP 代理 访问网页 ( 用户名密码验证代理 )
- [python]通过urllib2设置代理访问网址
- python 使用代理访问网站
- Python 通过ISA 代理访问互联网报错 HTTP Error 407
- python使用代理ip访问网站
- python,使用代理模式访问淘宝,百度,京东,阿里
- python3使用多代理访问网站
- python使用代理ip访问网站的实例
- Python中实现通用代理对象
- iOS 通用代理的写法 一个代理添加多个执行函数
- Nginx反向代理使用IIS,使其可以同时在同一端口上访问ASP.NET MVC和Python
- python3使用多代理访问网站
- python3使用多代理访问网站
- 一个简单的使用代理访问百度页面内容的python脚本
- Python2设置用户代理User Agent访问网页