urllib2中使用http、https代理

urllib2中使用http、https代理 - liukeforever的专栏 - 博客频道 - CSDN.NET

urllib2中使用http、https代理

分类: Python 743人阅读 评论(0) 收藏 举报

urllib2中使用http、https代理

proxy=urllib2.ProxyHandler({'https': 'http://lk:[email protected]:80'})
opener=urllib2.build_opener(proxy)
urllib2.install_opener(opener)

proxy=urllib2.ProxyHandler({'http': 'http://lk:[email protected]:80'})
opener=urllib2.build_opener(proxy)
urllib2.install_opener(opener)

 

>>> urllib2.urlopen('https://ajax.googleapis.com/ajax/services/search/images?v=1.0&q=monkey&as_filetype=png&imgtype=clipart&imgc=color&rsz=8')
send: 'GET https://ajax.googleapis.com/ajax/services/search/images?v=1.0&q=monkey&as_filetype=png&imgtype=clipart&imgc=color&rsz=8 HTTP/1.1/r/nAccept-Encoding: identity/r/nHost: ajax.googleapis.com/r/nProxy-Authorization: Basic bGs6MjAwMg==/r/nConnection: close/r/nUser-Agent: Python-urllib/2.6/r/n/r/n'
reply: 'HTTP/1.0 200 OK/r/n'
header: Content-Type: text/html

header: Refresh: 0; URL=https://ajax.googleapis.com/ajax/services/search/images?v=1.0&q=monkey&as_filetype=png&imgtype=clipart&imgc=color&rsz=8

你可能感兴趣的:(https)