title: By Example Chapter 5. urllib.error.URLError
body: <p>I am stuck on chapter 5 on the bookmarks tools that I followed in the book.
  I am using Django 3.1 and following (I have checked everything almost 10 times) this version on</p>
  <p>GitHub: [https://github.com/PacktPublishing/Django-3-by-Example/tree/master/Chapter05]</p>
  <p>But I still have this error: <code>urllib.error.URLError: &lt;urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)&gt;</code></p>
  <pre><code>File &quot;/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py&quot;, line 1319, in do_open
  
  h.request(req.get_method(), req.selector, req.data, headers,
  
  File &quot;/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py&quot;, line 1230, in request
  
  self._send_request(method, url, body, headers, encode_chunked)
  
  File &quot;/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py&quot;, line 1276, in _send_request
  
  self.endheaders(body, encode_chunked=encode_chunked)
  
  File &quot;/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py&quot;, line 1225, in endheaders
  
  self._send_output(message_body, encode_chunked=encode_chunked)
  
  File &quot;/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py&quot;, line 1004, in _send_output
  
          A message_body may be specified, to be appended to the request.
  
          &quot;&quot;&quot;
  
          self._buffer.extend((b&quot;&quot;, b&quot;&quot;))
  
          msg = b&quot;\r\n&quot;.join(self._buffer)
  
          del self._buffer[:]
  
          self.send(msg)
  
   
  
          if message_body is not None:
  
   
  
              # create a consistent interface to message_body
  
              if hasattr(message_body, 'read'):
  
  File &quot;/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py&quot;, line 944, in send
  
  self.connect()
  
  File &quot;/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py&quot;, line 1399, in connect
  
  self.sock = self._context.wrap_socket(self.sock,
  
  File &quot;/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py&quot;, line 500, in wrap_socket
  
  return self.sslsocket_class._create(
  
  File &quot;/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py&quot;, line 1040, in _create
  
  self.do_handshake()
  
  File &quot;/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py&quot;, line 1309, in do_handshake
  
  self._sslobj.do_handshake()
  
  During handling of the above exception, another exception occurred:
  File &quot;/Users/ricardoponce/Documents/WebSocial/venv/lib/python3.8/site-packages/django/contrib/staticfiles/handlers.py&quot;, line 76, in __call__
  
  return self.application(environ, start_response)
  
  File &quot;/Users/ricardoponce/Documents/WebSocial/venv/lib/python3.8/site-packages/django/core/handlers/wsgi.py&quot;, line 133, in __call__
  
  response = self.get_response(request)
  
  File &quot;/Users/ricardoponce/Documents/WebSocial/venv/lib/python3.8/site-packages/django/core/handlers/base.py&quot;, line 128, in get_response
  
  response = self._middleware_chain(request)
  
  File &quot;/Users/ricardoponce/Documents/WebSocial/venv/lib/python3.8/site-packages/django/core/handlers/exception.py&quot;, line 49, in inner
  
  response = response_for_exception(request, exc)
  
  File &quot;/Users/ricardoponce/Documents/WebSocial/venv/lib/python3.8/site-packages/django/core/handlers/exception.py&quot;, line 103, in response_for_exception
  
  response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
  
  File &quot;/Users/ricardoponce/Documents/WebSocial/venv/lib/python3.8/site-packages/django/core/handlers/exception.py&quot;, line 138, in handle_uncaught_exception
  
  return debug.technical_500_response(request, *exc_info)
  
  File &quot;/Users/ricardoponce/Documents/WebSocial/venv/lib/python3.8/site-packages/django_extensions/management/technical_response.py&quot;, line 37, in null_technical_500_response
  
  six.reraise(exc_type, exc_value, tb)
  
  File &quot;/Users/ricardoponce/Documents/WebSocial/venv/lib/python3.8/site-packages/six.py&quot;, line 702, in reraise
  
  raise value.with_traceback(tb)
  
  File &quot;/Users/ricardoponce/Documents/WebSocial/venv/lib/python3.8/site-packages/django/core/handlers/exception.py&quot;, line 47, in inner
  
  response = get_response(request)
  
  File &quot;/Users/ricardoponce/Documents/WebSocial/venv/lib/python3.8/site-packages/django/core/handlers/base.py&quot;, line 179, in _get_response
  
  response = wrapped_callback(request, *callback_args, **callback_kwargs)
  
  File &quot;/Users/ricardoponce/Documents/WebSocial/venv/lib/python3.8/site-packages/django/contrib/auth/decorators.py&quot;, line 21, in _wrapped_view
  
  return view_func(request, *args, **kwargs)
  
  File &quot;/Users/ricardoponce/Documents/WebSocial/bookmarks/images/views.py&quot;, line 23, in image_create
  
  new_item = form.save(commit=False)
  
  File &quot;/Users/ricardoponce/Documents/WebSocial/bookmarks/images/forms.py&quot;, line 35, in save
  
  response = request.urlopen(image_url)
  
  File &quot;/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py&quot;, line 222, in urlopen
  
  return opener.open(url, data, timeout)
  
  File &quot;/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py&quot;, line 525, in open
  
  response = self._open(req, data)
  
  File &quot;/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py&quot;, line 542, in _open
  
  result = self._call_chain(self.handle_open, protocol, protocol +
  
  File &quot;/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py&quot;, line 502, in _call_chain
  
  result = func(*args)
  
  File &quot;/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py&quot;, line 1362, in https_open
  
  return self.do_open(http.client.HTTPSConnection, req,
  
  File &quot;/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py&quot;, line 1322, in do_open
  
  raise URLError(err)
  
  urllib.error.URLError: &lt;urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)&gt;
  </code></pre>
  <p>The <strong>debugger</strong> caught an <strong>exception</strong> in your <strong>WSGI application</strong>. You can now look at the <strong>traceback</strong> which led to the error.</p>
  <p>To switch between the interactive traceback and the plaintext one, you can click on the &quot;Traceback&quot; headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side.</p>
  <p>You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection:</p>
  <pre><code>dump() shows all variables in the frame
  dump(obj) dumps all that's known about the object
  
  Brought to you by DON'T PANIC, your friendly Werkzeug powered traceback interpreter.
  </code></pre>