![]() |
Problem when applying Patch from issue1424152 to get https overauthenticating proxies working with urllib2 in Python 2.5
Hi,
I'm trying to get https requests working through an authenticating proxy with urllib2 in Python 2.5, I'm aware that this isn't supported "out of the box", so applied the patch http://bugs.python.org/file9753/http-tunnel-urllib linked from http://bugs.python.org/issue1424152 , my baseline test program is the following: p = "user:pass@proxy:port" proxy_handler = urllib2.ProxyHandler({"http": p, "https": p}) urllib2.install_opener( urllib2.build_opener( urllib2.HTTPHandler, urllib2.HTTPSHandler, proxy_handler)) request = urllib2.Request( "https://groups.google.com") response = urllib2.urlopen(request) Unfortunately this doesn't work, the call stack being: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "D:\p4\depot\Development\HEAD\Build\ReleaseSystem\ DownloadSystem \urllib2.py", line 121, in urlopen return _opener.open(url, data) File "D:\p4\depot\Development\HEAD\Build\ReleaseSystem\ DownloadSystem \urllib2.py", line 374, in open response = self._open(req, data) File "D:\p4\depot\Development\HEAD\Build\ReleaseSystem\ DownloadSystem \urllib2.py", line 392, in _open '_open', req) File "D:\p4\depot\Development\HEAD\Build\ReleaseSystem\ DownloadSystem \urllib2.py", line 353, in _call_chain result = func(*args) File "D:\p4\depot\Development\HEAD\Build\ReleaseSystem\ DownloadSystem \urllib2.py", line 1108, in https_open return self.do_open(httplib.HTTPSConnection, req) File "D:\p4\depot\Development\HEAD\Build\ReleaseSystem\ DownloadSystem \urllib2.py", line 1075, in do_open raise URLError(err) urllib2.URLError: <urlopen error (1, 'error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol')> Does anyone know why I might be hitting this issue? Any help is greatly appreciated, thanks |
Re: Problem when applying Patch from issue1424152 to get https overauthenticating proxies working with urllib2 in Python 2.5
On Jul 20, 11:11*pm, tvashtar <tvash...@gmail.com> wrote:
> Hi, > I'm trying to get https requests working through an authenticating > proxy with urllib2 in Python 2.5, I'm aware that this isn't supported > "out of the box", so applied the patchhttp://bugs.python.org/file9753/http-tunnel-urllib > linked fromhttp://bugs.python.org/issue1424152, my baseline test > program is the following: > > p = "user:pass@proxy:port" > proxy_handler = urllib2.ProxyHandler({"http": p, "https": p}) > urllib2.install_opener( urllib2.build_opener( urllib2.HTTPHandler, > > urllib2.HTTPSHandler, > > proxy_handler)) > > request = urllib2.Request( "https://groups.google.com") > response = urllib2.urlopen(request) > > Unfortunately this doesn't work, the call stack being: > > Traceback (most recent call last): > * File "<stdin>", line 1, in <module> > * File "D:\p4\depot\Development\HEAD\Build\ReleaseSystem\ DownloadSystem > \urllib2.py", line 121, in urlopen > * * return _opener.open(url, data) > * File "D:\p4\depot\Development\HEAD\Build\ReleaseSystem\ DownloadSystem > \urllib2.py", line 374, in open > * * response = self._open(req, data) > * File "D:\p4\depot\Development\HEAD\Build\ReleaseSystem\ DownloadSystem > \urllib2.py", line 392, in _open > * * '_open', req) > * File "D:\p4\depot\Development\HEAD\Build\ReleaseSystem\ DownloadSystem > \urllib2.py", line 353, in _call_chain > * * result = func(*args) > * File "D:\p4\depot\Development\HEAD\Build\ReleaseSystem\ DownloadSystem > \urllib2.py", line 1108, in https_open > * * return self.do_open(httplib.HTTPSConnection, req) > * File "D:\p4\depot\Development\HEAD\Build\ReleaseSystem\ DownloadSystem > \urllib2.py", line 1075, in do_open > * * raise URLError(err) > urllib2.URLError: <urlopen error (1, 'error:140770FC:SSL > routines:SSL23_GET_SERVER_HELLO:unknown protocol')> > > Does anyone know why I might be hitting this issue? > Any help is greatly appreciated, > thanks hi! It's looks like a ssl error . Under the following step to help u : 1. takes a simple code to confirm your pupose without ssl protocol. 2. to confirm python version and extended libs work well 3. to confirm ssl work well. goog luck! nikekoo |
Re: Problem when applying Patch from issue1424152 to get https overauthenticating proxies working with urllib2 in Python 2.5
On Jul 20, 4:42*pm, Nike <nike...@gmail.com> wrote:
> hi! > *It's looks like a ssl error . Under the following step to help u : > * 1. takes a simple code to confirm your pupose without ssl protocol. > * 2. to confirm python version and extended libs work well > * 3. to confirm ssl work well. > > goog luck! > > nikekoo I've reduced my code to the following: import urllib2 p = "https://user:pass@myproxy:port" proxy_handler = urllib2.ProxyHandler({"https": p}) urllib2.install_opener(urllib2.build_opener(proxy_ handler)) request = urllib2.Request( "https://groups.google.com") response = urllib2.urlopen(request) and it is now failing with: Traceback (most recent call last): File "D:\p4\depot\Development\HEAD\Build\ReleaseSystem\ DownloadSystem \test.py", line 12, in <module> response = urllib2.urlopen(request) File "C:\Python25\lib\urllib2.py", line 121, in urlopen return _opener.open(url, data) File "C:\Python25\lib\urllib2.py", line 379, in open response = self._open(req, data) File "C:\Python25\lib\urllib2.py", line 397, in _open '_open', req) File "C:\Python25\lib\urllib2.py", line 358, in _call_chain result = func(*args) File "C:\Python25\lib\urllib2.py", line 1115, in https_open return self.do_open(httplib.HTTPSConnection, req) File "C:\Python25\lib\urllib2.py", line 1082, in do_open raise URLError(err) urllib2.URLError: <urlopen error Tunnel connection failed: 407 Proxy Authentication Required> I thought the proxy_handler should take care of the authentication? Thanks for your help |
| All times are GMT. The time now is 10:26 PM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.