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()
posted @ 2020-06-02 20:47  小小咸鱼YwY  阅读(1023)  评论(0编辑  收藏  举报