SSLCertVerificationError: CERTIFICATE_VERIFY_FAILED

I am getting the error while using following code after importing the library:

urlretrieve(‘https://hub.jovian.ml/wp-content/uploads/2020/09/countries.csv’, **
** ‘countries.csv’)

URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1131)>

The whole Error Message:


SSLCertVerificationError Traceback (most recent call last)
c:\programdata\anaconda3\lib\urllib\request.py in do_open(self, http_class, req, **http_conn_args)
1353 try:
→ 1354 h.request(req.get_method(), req.selector, req.data, headers,
1355 encode_chunked=req.has_header(‘Transfer-encoding’))

c:\programdata\anaconda3\lib\http\client.py in request(self, method, url, body, headers, encode_chunked)
1255 “”“Send a complete request to the server.”""
→ 1256 self._send_request(method, url, body, headers, encode_chunked)
1257

c:\programdata\anaconda3\lib\http\client.py in _send_request(self, method, url, body, headers, encode_chunked)
1301 body = _encode(body, ‘body’)
→ 1302 self.endheaders(body, encode_chunked=encode_chunked)
1303

c:\programdata\anaconda3\lib\http\client.py in endheaders(self, message_body, encode_chunked)
1250 raise CannotSendHeader()
→ 1251 self._send_output(message_body, encode_chunked=encode_chunked)
1252

c:\programdata\anaconda3\lib\http\client.py in _send_output(self, message_body, encode_chunked)
1010 del self._buffer[:]
→ 1011 self.send(msg)
1012

c:\programdata\anaconda3\lib\http\client.py in send(self, data)
950 if self.auto_open:
→ 951 self.connect()
952 else:

c:\programdata\anaconda3\lib\http\client.py in connect(self)
1424
→ 1425 self.sock = self._context.wrap_socket(self.sock,
1426 server_hostname=server_hostname)

c:\programdata\anaconda3\lib\ssl.py in wrap_socket(self, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, session)
499 # ctx._wrap_socket()
→ 500 return self.sslsocket_class._create(
501 sock=sock,

c:\programdata\anaconda3\lib\ssl.py in _create(cls, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, context, session)
1039 raise ValueError(“do_handshake_on_connect should not be specified for non-blocking sockets”)
→ 1040 self.do_handshake()
1041 except (OSError, ValueError):

c:\programdata\anaconda3\lib\ssl.py in do_handshake(self, block)
1308 self.settimeout(None)
→ 1309 self._sslobj.do_handshake()
1310 finally:

SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1131)

During handling of the above exception, another exception occurred:

URLError Traceback (most recent call last)
C:\Users\MITESW~1\AppData\Local\Temp/ipykernel_18572/2651446027.py in
1 from urllib.request import urlretrieve
2
----> 3 urlretrieve(‘https://hub.jovian.ml/wp-content/uploads/2020/09/countries.csv’,
4 ‘countries.csv’)

c:\programdata\anaconda3\lib\urllib\request.py in urlretrieve(url, filename, reporthook, data)
245 url_type, path = _splittype(url)
246
→ 247 with contextlib.closing(urlopen(url, data)) as fp:
248 headers = fp.info()
249

c:\programdata\anaconda3\lib\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):

c:\programdata\anaconda3\lib\urllib\request.py in open(self, fullurl, data, timeout)
523
524 sys.audit(‘urllib.Request’, req.full_url, req.data, req.headers, req.get_method())
→ 525 response = self._open(req, data)
526
527 # post-process response

c:\programdata\anaconda3\lib\urllib\request.py in _open(self, req, data)
540
541 protocol = req.type
→ 542 result = self._call_chain(self.handle_open, protocol, protocol +
543 ‘_open’, req)
544 if result:

c:\programdata\anaconda3\lib\urllib\request.py in _call_chain(self, chain, kind, meth_name, *args)
500 for handler in handlers:
501 func = getattr(handler, meth_name)
→ 502 result = func(*args)
503 if result is not None:
504 return result

c:\programdata\anaconda3\lib\urllib\request.py in https_open(self, req)
1395
1396 def https_open(self, req):
→ 1397 return self.do_open(http.client.HTTPSConnection, req,
1398 context=self._context, check_hostname=self._check_hostname)
1399

c:\programdata\anaconda3\lib\urllib\request.py in do_open(self, http_class, req, **http_conn_args)
1355 encode_chunked=req.has_header(‘Transfer-encoding’))
1356 except OSError as err: # timeout error
→ 1357 raise URLError(err)
1358 r = h.getresponse()
1359 except:

URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1131)>