urllib error on urlopen
Steven D'Aprano
steve at REMOVE-THIS-cybersource.com.au
Wed Sep 24 22:36:22 EDT 2008
On Wed, 24 Sep 2008 08:46:56 -0700, Mike Driscoll wrote:
> Hi,
>
> I have been using the following code for over a year in one of my
> programs:
>
> f = urllib2.urlopen('https://www.companywebsite.com/somestring')
>
> It worked great until the middle of the afternoon yesterday. Now I get
> the following traceback:
...
> URLError: <urlopen error (1, 'error:140770FC:SSL
> routines:SSL23_GET_SERVER_HELLO:unknown protocol')>
Have you recently set a proxy where Python can auto-detect it? I
understand that urllib2 doesn't work well with https proxies.
If so, you can instruct urllib2 not to use a proxy-handler, but it's more
work. What I do is construct an opener without a proxyhandler:
# untested...
no_proxy_support = urllib2.ProxyHandler({})
opener = urllib2.build_opener(no_proxy_support)
f = opener.open('https://www.companywebsite.com/somestring')
If that doesn't work, you may need to build a Request object from the URL
before passing it to opener.open.
--
Steven
More information about the Python-list
mailing list