XMLWordPrintableJSON

    Details

    • Type: Task
    • Status: Resolved
    • Priority: Blocker
    • Resolution: Cannot Reproduce
    • Affects Version/s: 0.5
    • Fix Version/s: 1.1.0
    • Component/s: data sources
    • Labels:
      None

      Description

      Error messages below while running example/knmi_to_cru31_full_bias.py.

      #########################################################
      Working with the rcmed interface to get CRU3.1 Daily-Max Temp
      Traceback (most recent call last):
      File "knmi_to_cru31_full_bias.py", line 54, in <module>
      metadata = rcmed.get_parameters_metadata()
      File "/net/san-a1-ib/data/keeling/a/atmos-kyo/climate/ocw/data_source/rcmed.py", line 45, in get_parameters_metadata
      string = urllib2.urlopen(url)
      File "/data/keeling/a/atmos-kyo/RCMES/anaconda/lib/python2.7/urllib2.py", line 154, in urlopen
      return opener.open(url, data, timeout)
      File "/data/keeling/a/atmos-kyo/RCMES/anaconda/lib/python2.7/urllib2.py", line 437, in open
      response = meth(req, response)
      File "/data/keeling/a/atmos-kyo/RCMES/anaconda/lib/python2.7/urllib2.py", line 550, in http_response
      'http', request, response, code, msg, hdrs)
      File "/data/keeling/a/atmos-kyo/RCMES/anaconda/lib/python2.7/urllib2.py", line 469, in error
      result = self._call_chain(*args)
      File "/data/keeling/a/atmos-kyo/RCMES/anaconda/lib/python2.7/urllib2.py", line 409, in _call_chain
      result = func(*args)
      File "/data/keeling/a/atmos-kyo/RCMES/anaconda/lib/python2.7/urllib2.py", line 656, in http_error_302
      return self.parent.open(new, timeout=req.timeout)
      File "/data/keeling/a/atmos-kyo/RCMES/anaconda/lib/python2.7/urllib2.py", line 431, in open
      response = self._open(req, data)
      File "/data/keeling/a/atmos-kyo/RCMES/anaconda/lib/python2.7/urllib2.py", line 449, in _open
      '_open', req)
      File "/data/keeling/a/atmos-kyo/RCMES/anaconda/lib/python2.7/urllib2.py", line 409, in _call_chain
      result = func(*args)
      File "/data/keeling/a/atmos-kyo/RCMES/anaconda/lib/python2.7/urllib2.py", line 1240, in https_open
      context=self._context)
      File "/data/keeling/a/atmos-kyo/RCMES/anaconda/lib/python2.7/urllib2.py", line 1197, in do_open
      raise URLError(err)
      urllib2.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)>
      #########################################################

      This was resolved temporarily by adding ssl context.
      The following shows git diff.
      #########################################################
      diff --git a/ocw/data_source/rcmed.py b/ocw/data_source/rcmed.py
      index baeb326..b1ef963 100644
      — a/ocw/data_source/rcmed.py
      +++ b/ocw/data_source/rcmed.py
      @@ -21,6 +21,7 @@ Classes:
      '''

      import urllib, urllib2
      +import ssl
      import re
      import json
      import numpy as np
      @@ -42,7 +43,7 @@ def get_parameters_metadata():

      param_info_list = []
      url = URL + "&param_info=yes"

      • string = urllib2.urlopen(url)
        + string = urllib2.urlopen(url, context=ssl._create_unverified_context())
        data_string = string.read()
        json_format_data = json.loads(data_string)
        fields_name = json_format_data['fields_name']
        @@ -159,7 +160,7 @@ def _get_data(url):
        :rtype: (Numpy array, Numpy array, Numpy array, Numpy array)
        '''
      • string = urllib2.urlopen(url)
        + string = urllib2.urlopen(url, context=ssl._create_unverified_context())

      #################################################

      Is this a problem of "keeling.atmos.uiuc.edu"? Is it worth to add context whenever OCW uses 'urlopen'?

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              huikyole Huikyo Lee
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Due:
                Created:
                Updated:
                Resolved: