Note that there are some explanatory texts on larger screens.

plurals
  1. PODoes urllib2 in Python 2.6.1 support proxy via https
    text
    copied!<p>Does <a href="http://docs.python.org/library/urllib2.html" rel="noreferrer">urllib2</a> in Python 2.6.1 support proxy via https?</p> <p>I've found the following at <a href="http://www.voidspace.org.uk/python/articles/urllib2.shtml" rel="noreferrer">http://www.voidspace.org.uk/python/articles/urllib2.shtml</a>:</p> <blockquote> <p>NOTE</p> <p>Currently urllib2 does not support fetching of https locations through a proxy. This can be a problem.</p> </blockquote> <p>I'm trying automate login in to web site and downloading document, I have valid username/password.</p> <pre><code>proxy_info = { 'host':"axxx", # commented out the real data 'port':"1234" # commented out the real data } proxy_handler = urllib2.ProxyHandler( {"http" : "http://%(host)s:%(port)s" % proxy_info}) opener = urllib2.build_opener(proxy_handler, urllib2.HTTPHandler(debuglevel=1),urllib2.HTTPCookieProcessor()) urllib2.install_opener(opener) fullurl = 'https://correct.url.to.login.page.com/user=a&amp;pswd=b' # example req1 = urllib2.Request(url=fullurl, headers=headers) response = urllib2.urlopen(req1) </code></pre> <p>I've had it working for similar pages but not using HTTPS and I suspect it does not get through proxy - it just gets stuck in the same way as when I did not specify proxy. I need to go out through proxy.</p> <p>I need to authenticate but not using basic authentication, will urllib2 figure out authentication when going via https site (I supply username/password to site via url)?</p> <p>EDIT: Nope, I tested with </p> <pre><code> proxies = { "http" : "http://%(host)s:%(port)s" % proxy_info, "https" : "https://%(host)s:%(port)s" % proxy_info } proxy_handler = urllib2.ProxyHandler(proxies) </code></pre> <p>And I get error:</p> <blockquote> <p>urllib2.URLError: urlopen error [Errno 8] _ssl.c:480: EOF occurred in violation of protocol</p> </blockquote>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload