[ https://issues.apache.org/jira/browse/CLIMATE-611?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Lewis John McGibbney resolved CLIMATE-611. ------------------------------------------ Resolution: Cannot Reproduce If someone else can reproduce then feel free to reopen and address. > SSL certificate verify error > ---------------------------- > > Key: CLIMATE-611 > URL: https://issues.apache.org/jira/browse/CLIMATE-611 > Project: Apache Open Climate Workbench > Issue Type: Task > Components: data sources > Affects Versions: 0.5 > Reporter: Huikyo Lee > Priority: Blocker > Fix For: 1.1 > > > 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 + "¶m_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'? -- This message was sent by Atlassian JIRA (v6.3.4#6332)