Use http and HTTPS proxies in urllib2
Proxy = urllib2.proxyhandler ({'https': 'http: // LK: 2002@172.17.5.53: 80 '})
Opener = urllib2.build _ opener (proxy)
Urllib2.install _ opener (opener)
Proxy = urllib2.proxyhandler ({'HTTP ': 'http: // LK: 2002@172.17.5.53: 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