1

I am currently just following a tutorial showing how to use the pandas library and I can across this error. I'm still new to the whole scene so I'm not entirely sure what's going on or how to interpret this error:

---------------------------------------------------------------------------
SSLCertVerificationError                  Traceback (most recent call last)
/snap/jupyter/6/lib/python3.7/urllib/request.py in do_open(self, http_class, req, **http_conn_args)
   1316                 h.request(req.get_method(), req.selector, req.data, headers,
-> 1317                           encode_chunked=req.has_header('Transfer-encoding'))
   1318             except OSError as err: # timeout error

/snap/jupyter/6/lib/python3.7/http/client.py in request(self, method, url, body, headers, encode_chunked)
   1228         """Send a complete request to the server."""
-> 1229         self._send_request(method, url, body, headers, encode_chunked)
   1230 

/snap/jupyter/6/lib/python3.7/http/client.py in _send_request(self, method, url, body, headers, encode_chunked)
   1274             body = _encode(body, 'body')
-> 1275         self.endheaders(body, encode_chunked=encode_chunked)
   1276 

/snap/jupyter/6/lib/python3.7/http/client.py in endheaders(self, message_body, encode_chunked)
   1223             raise CannotSendHeader()
-> 1224         self._send_output(message_body, encode_chunked=encode_chunked)
   1225 

/snap/jupyter/6/lib/python3.7/http/client.py in _send_output(self, message_body, encode_chunked)
   1015         del self._buffer[:]
-> 1016         self.send(msg)
   1017 

/snap/jupyter/6/lib/python3.7/http/client.py in send(self, data)
    955             if self.auto_open:
--> 956                 self.connect()
    957             else:

/snap/jupyter/6/lib/python3.7/http/client.py in connect(self)
   1391             self.sock = self._context.wrap_socket(self.sock,
-> 1392                                                   server_hostname=server_hostname)
   1393 

/snap/jupyter/6/lib/python3.7/ssl.py in wrap_socket(self, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, session)
    411             context=self,
--> 412             session=session
    413         )

/snap/jupyter/6/lib/python3.7/ssl.py in _create(cls, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, context, session)
    852                         raise ValueError("do_handshake_on_connect should not be specified for non-blocking sockets")
--> 853                     self.do_handshake()
    854             except (OSError, ValueError):

/snap/jupyter/6/lib/python3.7/ssl.py in do_handshake(self, block)
   1116                 self.settimeout(None)
-> 1117             self._sslobj.do_handshake()
   1118         finally:

SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)

During handling of the above exception, another exception occurred:

URLError                                  Traceback (most recent call last)
<ipython-input-3-dc8b64eb545d> in <module>
----> 1 df = pd.read_html('http://www.fdic.gov/bank/individual/failed/banklist.html')

/home/paul/snap/jupyter/common/lib/python3.7/site-packages/pandas/io/html.py in read_html(io, match, flavor, header, index_col, skiprows, attrs, parse_dates, thousands, encoding, decimal, converters, na_values, keep_default_na, displayed_only)
   1098         na_values=na_values,
   1099         keep_default_na=keep_default_na,
-> 1100         displayed_only=displayed_only,
   1101     )

/home/paul/snap/jupyter/common/lib/python3.7/site-packages/pandas/io/html.py in _parse(flavor, io, match, attrs, encoding, displayed_only, **kwargs)
    893 
    894         try:
--> 895             tables = p.parse_tables()
    896         except ValueError as caught:
    897             # if `io` is an io-like object, check if it's seekable

/home/paul/snap/jupyter/common/lib/python3.7/site-packages/pandas/io/html.py in parse_tables(self)
    211         list of parsed (header, body, footer) tuples from tables.
    212         """
--> 213         tables = self._parse_tables(self._build_doc(), self.match, self.attrs)
    214         return (self._parse_thead_tbody_tfoot(table) for table in tables)
    215         """

/home/paul/snap/jupyter/common/lib/python3.7/site-packages/pandas/io/html.py in _build_doc(self)
    731                     pass
    732             else:
--> 733                 raise e
    734         else:
    735             if not hasattr(r, "text_content"):

/home/paul/snap/jupyter/common/lib/python3.7/site-packages/pandas/io/html.py in _build_doc(self)
    712         try:
    713             if is_url(self.io):
--> 714                 with urlopen(self.io) as f:
    715                     r = parse(f, parser=parser)
    716             else:

/home/paul/snap/jupyter/common/lib/python3.7/site-packages/pandas/io/common.py in urlopen(*args, **kwargs)
    139     import urllib.request
    140 
--> 141     return urllib.request.urlopen(*args, **kwargs)
    142 
    143 

/snap/jupyter/6/lib/python3.7/urllib/request.py in urlopen(url, data, timeout, cafile, capath, cadefault, context)
    220     else:
    221         opener = _opener
--> 222     return opener.open(url, data, timeout)
    223 
    224 def install_opener(opener):

/snap/jupyter/6/lib/python3.7/urllib/request.py in open(self, fullurl, data, timeout)
    529         for processor in self.process_response.get(protocol, []):
    530             meth = getattr(processor, meth_name)
--> 531             response = meth(req, response)
    532 
    533         return response

/snap/jupyter/6/lib/python3.7/urllib/request.py in http_response(self, request, response)
    639         if not (200 <= code < 300):
    640             response = self.parent.error(
--> 641                 'http', request, response, code, msg, hdrs)
    642 
    643         return response

/snap/jupyter/6/lib/python3.7/urllib/request.py in error(self, proto, *args)
    561             http_err = 0
    562         args = (dict, proto, meth_name) + args
--> 563         result = self._call_chain(*args)
    564         if result:
    565             return result

/snap/jupyter/6/lib/python3.7/urllib/request.py in _call_chain(self, chain, kind, meth_name, *args)
    501         for handler in handlers:
    502             func = getattr(handler, meth_name)
--> 503             result = func(*args)
    504             if result is not None:
    505                 return result

/snap/jupyter/6/lib/python3.7/urllib/request.py in http_error_302(self, req, fp, code, msg, headers)
    753         fp.close()
    754 
--> 755         return self.parent.open(new, timeout=req.timeout)
    756 
    757     http_error_301 = http_error_303 = http_error_307 = http_error_302

/snap/jupyter/6/lib/python3.7/urllib/request.py in open(self, fullurl, data, timeout)
    523             req = meth(req)
    524 
--> 525         response = self._open(req, data)
    526 
    527         # post-process response

/snap/jupyter/6/lib/python3.7/urllib/request.py in _open(self, req, data)
    541         protocol = req.type
    542         result = self._call_chain(self.handle_open, protocol, protocol +
--> 543                                   '_open', req)
    544         if result:
    545             return result

/snap/jupyter/6/lib/python3.7/urllib/request.py in _call_chain(self, chain, kind, meth_name, *args)
    501         for handler in handlers:
    502             func = getattr(handler, meth_name)
--> 503             result = func(*args)
    504             if result is not None:
    505                 return result

/snap/jupyter/6/lib/python3.7/urllib/request.py in https_open(self, req)
   1358         def https_open(self, req):
   1359             return self.do_open(http.client.HTTPSConnection, req,
-> 1360                 context=self._context, check_hostname=self._check_hostname)
   1361 
   1362         https_request = AbstractHTTPHandler.do_request_

/snap/jupyter/6/lib/python3.7/urllib/request.py in do_open(self, http_class, req, **http_conn_args)
   1317                           encode_chunked=req.has_header('Transfer-encoding'))
   1318             except OSError as err: # timeout error
-> 1319                 raise URLError(err)
   1320             r = h.getresponse()
   1321         except:

URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)>

I attached the whole thing just in case. I ran the following code:

df = pd.read_html('http://www.fdic.gov/bank/individual/failed/banklist.html')

I've seen a few things about installing something called certifi but it says that that requirement is already satisfied. I'm currently running Ubuntu. I noticed that this is a prominent error on MacOS so I'm not sure what it is here.

Thank you for your time!

pimler
  • 61
  • 7
  • 1
    Does this answer your question? [Scraping: SSL: CERTIFICATE\_VERIFY\_FAILED error for http://en.wikipedia.org](https://stackoverflow.com/questions/50236117/scraping-ssl-certificate-verify-failed-error-for-http-en-wikipedia-org) – AMC Apr 14 '20 at 00:59
  • @AMC Good idea but it's the wrong duplicate question. That question is about a Mac and this user is using Linux. As mentioned in the question: *I noticed that this is a prominent error on Mac so I'm not sure what it is here.*. – karel Apr 14 '20 at 01:05
  • 1
    @karel Yes, you're right, can't believe I missed that part. *facepalm* – AMC Apr 14 '20 at 01:11
  • Follow [this steps](https://docs.anaconda.com/ae-notebooks/admin-guide/install/config/config-ssl/) to configure your SSL key – Henrique Branco Apr 14 '20 at 01:37
  • 1
    @HenriqueBranco I'm afraid that that seem sto be going right over my head in terms of what that's supposed to do. I was reading what you sent and it says that this comes after "[my] gateway node has been installed and registered with the server node." Is this something that I have to do or not? I also downloaded pycharm and used the anaconda installation of python in order to run and it worked if that changes anything. I will update the post accordingly if it does. – pimler Apr 14 '20 at 02:31

1 Answers1

0

SSL is used in the https protocol, the link you are trying to access uses unsecured http and most applications will try to keep you away from http sites. Try changing 'http://' to 'https://'

Joe Smith
  • 1
  • 1