urllib error on urlopen

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mike Driscoll

    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.companywebs ite.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#1 3>", line 1, in <module>
    response = urllib2.urlopen (req).read().st rip()
    File "c:\python25\li b\urllib2.py", line 124, in urlopen
    return _opener.open(ur l, data)
    File "c:\python25\li b\urllib2.py", line 381, in open
    response = self._open(req, data)
    File "c:\python25\li b\urllib2.py", line 399, in _open
    '_open', req)
    File "c:\python25\li b\urllib2.py", line 360, in _call_chain
    result = func(*args)
    File "c:\python25\li b\urllib2.py", line 1115, in https_open
    return self.do_open(ht tplib.HTTPSConn ection, req)
    File "c:\python25\li b\urllib2.py", line 1082, in do_open
    raise URLError(err)
    URLError: <urlopen error (1, 'error:140770FC :SSL
    routines:SSL23_ GET_SERVER_HELL O: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

  • Michael Palmer

    #2
    Re: urllib error on urlopen

    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.companywebs ite.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#1 3>", line 1, in <module>
    response = urllib2.urlopen (req).read().st rip()
    File "c:\python25\li b\urllib2.py", line 124, in urlopen
    return _opener.open(ur l, data)
    File "c:\python25\li b\urllib2.py", line 381, in open
    response = self._open(req, data)
    File "c:\python25\li b\urllib2.py", line 399, in _open
    '_open', req)
    File "c:\python25\li b\urllib2.py", line 360, in _call_chain
    result = func(*args)
    File "c:\python25\li b\urllib2.py", line 1115, in https_open
    return self.do_open(ht tplib.HTTPSConn ection, req)
    File "c:\python25\li b\urllib2.py", line 1082, in do_open
    raise URLError(err)
    URLError: <urlopen error (1, 'error:140770FC :SSL
    routines:SSL23_ GET_SERVER_HELL O: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 misconfiguratio n at the other end? Can you open
    other https urls?

    Comment

    • Steven D'Aprano

      #3
      Re: urllib error on urlopen

      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.companywebs ite.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_HELL O: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_suppor t = urllib2.ProxyHa ndler({})
      opener = urllib2.build_o pener(no_proxy_ support)
      f = opener.open('ht tps://www.companywebs ite.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

      Comment

      • Mike Driscoll

        #4
        Re: urllib error on urlopen

        On Sep 24, 7:08 pm, Michael Palmer <m_palme...@yah oo.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.companywebs ite.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#1 3>", line 1, in <module>
            response = urllib2.urlopen (req).read().st rip()
          File "c:\python25\li b\urllib2.py", line 124, in urlopen
            return _opener.open(ur l, data)
          File "c:\python25\li b\urllib2.py", line 381, in open
            response = self._open(req, data)
          File "c:\python25\li b\urllib2.py", line 399, in _open
            '_open', req)
          File "c:\python25\li b\urllib2.py", line 360, in _call_chain
            result = func(*args)
          File "c:\python25\li b\urllib2.py", line 1115, in https_open
            return self.do_open(ht tplib.HTTPSConn ection, req)
          File "c:\python25\li b\urllib2.py", line 1082, in do_open
            raise URLError(err)
        URLError: <urlopen error (1, 'error:140770FC :SSL
        routines:SSL23_ GET_SERVER_HELL O: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 misconfiguratio n 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

        Comment

        • Mike Driscoll

          #5
          Re: urllib error on urlopen

          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.companywebs ite.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_HELL O: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_suppor t = urllib2.ProxyHa ndler({})
          opener = urllib2.build_o pener(no_proxy_ support)
          f = opener.open('ht tps://www.companywebs ite.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

          Comment

          Working...