473,225 Members | 1,274 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,225 software developers and data experts.

urllib error on urlopen

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:

Traceback (most recent call last):
File "<pyshell#13>", line 1, in <module>
response = urllib2.urlopen(req).read().strip()
File "c:\python25\lib\urllib2.py", line 124, in urlopen
return _opener.open(url, data)
File "c:\python25\lib\urllib2.py", line 381, in open
response = self._open(req, data)
File "c:\python25\lib\urllib2.py", line 399, in _open
'_open', req)
File "c:\python25\lib\urllib2.py", line 360, 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)
URLError: <urlopen error (1, 'error:140770FC:SSL
routines:SSL23_GET_SERVER_HELLO:unknown protocol')>
I tried my Google Fu on this error, but there's not much out there. I
tried using a proxy in Python, but that returned the same traceback.
If I copy the URL into my browser, it resolves correctly. Does anyone
have any advice on how to troubleshoot this error?

I am using Python 2.5.2 on Windows XP.

Thanks,

Mike

Sep 24 '08 #1
4 5499
On Sep 24, 11:46 am, Mike Driscoll <kyoso...@gmail.comwrote:
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:

Traceback (most recent call last):
File "<pyshell#13>", line 1, in <module>
response = urllib2.urlopen(req).read().strip()
File "c:\python25\lib\urllib2.py", line 124, in urlopen
return _opener.open(url, data)
File "c:\python25\lib\urllib2.py", line 381, in open
response = self._open(req, data)
File "c:\python25\lib\urllib2.py", line 399, in _open
'_open', req)
File "c:\python25\lib\urllib2.py", line 360, 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)
URLError: <urlopen error (1, 'error:140770FC:SSL
routines:SSL23_GET_SERVER_HELLO:unknown protocol')>

I tried my Google Fu on this error, but there's not much out there. I
tried using a proxy in Python, but that returned the same traceback.
If I copy the URL into my browser, it resolves correctly. Does anyone
have any advice on how to troubleshoot this error?

I am using Python 2.5.2 on Windows XP.

Thanks,

Mike
Could it just be a misconfiguration at the other end? Can you open
other https urls?
Sep 25 '08 #2
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
Sep 25 '08 #3
On Sep 24, 7:08*pm, Michael Palmer <m_palme...@yahoo.cawrote:
On Sep 24, 11:46 am, Mike Driscoll <kyoso...@gmail.comwrote:
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:
Traceback (most recent call last):
* File "<pyshell#13>", line 1, in <module>
* * response = urllib2.urlopen(req).read().strip()
* File "c:\python25\lib\urllib2.py", line 124, in urlopen
* * return _opener.open(url, data)
* File "c:\python25\lib\urllib2.py", line 381, in open
* * response = self._open(req, data)
* File "c:\python25\lib\urllib2.py", line 399, in _open
* * '_open', req)
* File "c:\python25\lib\urllib2.py", line 360, 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)
URLError: <urlopen error (1, 'error:140770FC:SSL
routines:SSL23_GET_SERVER_HELLO:unknown protocol')>
I tried my Google Fu on this error, but there's not much out there. I
tried using a proxy in Python, but that returned the same traceback.
If I copy the URL into my browser, it resolves correctly. Does anyone
have any advice on how to troubleshoot this error?
I am using Python 2.5.2 on Windows XP.
Thanks,
Mike

Could it just be a misconfiguration at the other end? Can you open
other https urls?
This is really weird. Now it works this morning. I've spoken with our
webmaster/system admin and he said he didn't change anything on his
end. We're both befuddled. Sorry for the noise.

Mike
Sep 25 '08 #4
On Sep 24, 9:36*pm, Steven D'Aprano <st...@REMOVE-THIS-
cybersource.com.auwrote:
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
As I mentioned to Mr. Palmer, the error has mysteriously gone away
this morning. I'll keep your advice handy though, in case it happens
again.

Thanks,

Mike
Sep 25 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Pater Maximus | last post by:
I am trying to implement the recipe listed at http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/211886 However, I can not get to first base. When I try to run import urllib...
0
by: Pieter Edelman | last post by:
Hi all, I'm trying to submit some data using a POST request to a HTTP server with BASIC authentication with python, but I can't get it to work. Since it's driving me completely nuts, so here's...
1
by: Timothy Wu | last post by:
Hi, I'm trying to fill the form on page http://www.cbs.dtu.dk/services/TMHMM/ using urllib. There are two peculiarities. First of all, I am filling in incorrect key/value pairs in the...
11
by: Johnny Lee | last post by:
Hi, I was using urllib to grab urls from web. here is the work flow of my program: 1. Get base url and max number of urls from user 2. Call filter to validate the base url 3. Read the source...
4
by: william | last post by:
I've got a strange problem on windows (not very familiar with that OS). I can ping a host, but cannot get it via urllib (see here under). I can even telnet the host on port 80. Thus network...
6
by: JabaPyth | last post by:
Hello, I'm trying to use the urllib module, but when i try urllib.urlopen, it gives me a socket error: >>import urllib >>print urllib.urlopen('http://www.google.com/').read() Traceback (most...
0
by: Ali.Sabil | last post by:
hello all, I just maybe hit a bug in both urllib and urllib2, actually urllib doesn't support proxy authentication, and if you setup the http_proxy env var to...
4
by: kgrafals | last post by:
Hi, I'm just trying to read from a webpage with urllib but I'm getting IOErrors. This is my code: import urllib sock = urllib.urlopen("http://www.google.com/") and this is the error:
1
by: John Nagle | last post by:
If you try to open a password protected page with "urllib.urlopen()", you get "Enter username for EnterPassword at example.com:" on standard output, followed by a read for input! This seems to...
2
by: Iain Dalton | last post by:
In Emacs, using run-python, import urllib urllib.urlopen('http://www.google.com/') results in this traceback: Traceback (most recent call last): File "<stdin>", line 1, in <module> File...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.