python获取代理需要账户和密码代码模板

from urllib import request
#网上很多说的urllib2,在python3中其实就是urllib.request
proxy_support = request.ProxyHandler({'http':'http://username:password@IP:port'})
auth = request.HTTPBasicAuthHandler()
opener = request.build_opener(proxy_support, auth, request.HTTPHandler)
request.install_opener(opener)
response = request.urlopen("你访问的rul")
html = response.read()
上一篇:Python网络爬虫学习笔记(二)基本库的使用


下一篇:Python网络爬虫