title: MacOS High OSierra 10.13.6, Python3.7, GeocoderServiceError: [SSL: CERTIFICATE_VERIFY_FAILED]
body: <p>I recently installed python 3.7 on macOS High OSierra and spent ages trying to get it working. That question is <a href="https://stackoverflow.com/questions/52154682/macos-high-sierra-10-13-6-python3-7-installation-install-certificate-command-re?noredirect=1#comment91267651_52154682">here</a>. Currently I am having problems with the below code and wondered if anyone can help.</p>
  
  <pre><code>import geopy
  geocoder = geopy.geocoders.GoogleV3(domain = "maps.google.co.uk")
  geocoder.geocode("Cambridge", exactly_one = False)
  </code></pre>
  
  <p>Results in the following error:</p>
  
  <blockquote>
    <p>SSLCertVerificationError                  Traceback (most recent call last)
    /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py
    in do_open(self, http_class, req, **http_conn_args)    1316<br>
    h.request(req.get_method(), req.selector, req.data, headers,
    -> 1317                           encode_chunked=req.has_header('Transfer-encoding'))    1318<br>
    except OSError as err: # timeout error</p>
    
    <blockquote>
      <p>/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py
      in request(self, method, url, body, headers, encode_chunked)    1228<br>
      """Send a complete request to the server."""
      -> 1229         self._send_request(method, url, body, headers, encode_chunked)    1230 </p>
      
      <p>/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py
      in _send_request(self, method, url, body, headers, encode_chunked)<br>
      1274             body = _encode(body, 'body')
      -> 1275         self.endheaders(body, encode_chunked=encode_chunked)    1276 </p>
      
      <p>/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py
      in endheaders(self, message_body, encode_chunked)    1223<br>
      raise CannotSendHeader()
      -> 1224         self._send_output(message_body, encode_chunked=encode_chunked)    1225 </p>
      
      <p>/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py
      in _send_output(self, message_body, encode_chunked)    1015<br>
      del self._buffer[:]
      -> 1016         self.send(msg)    1017 </p>
      
      <p>/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py
      in send(self, data)
          955             if self.auto_open:
      --> 956                 self.connect()
          957             else:</p>
      
      <p>/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py
      in connect(self)    1391             self.sock =
      self._context.wrap_socket(self.sock,
      -> 1392                                                   server_hostname=server_hostname)    1393 </p>
    </blockquote>
    
    <p>/Library/Frameworks/Python.framework/Versions/3.7/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         )</p>
    
    <p>/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py
    in _create(cls, sock, server_side, do_handshake_on_connect,
    suppress_ragged_eofs, server_hostname, context, session)
        849                         raise ValueError("do_handshake_on_connect should not be specified for
    non-blocking sockets")
    --> 850                     self.do_handshake()
        851             except (OSError, ValueError):</p>
    
    <p>/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py
    in do_handshake(self, block)    1107<br>
    self.settimeout(None)
    -> 1108             self._sslobj.do_handshake()    1109         finally:</p>
    
    <blockquote>
      <p>SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate
      chain (_ssl.c:1045)</p>
    </blockquote>
  </blockquote>
  
  <p>During handling of the above exception, another exception occurred:</p>
  
  <blockquote>
    <p>URLError                                  Traceback (most recent call last)
    /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/geopy/geocoders/base.py
    in _call_geocoder(self, url, timeout, raw, requester, deserializer,
    **kwargs)
        314         try:
    --> 315             page = requester(req, timeout=timeout, **kwargs)
        316         except Exception as error:</p>
    
    <blockquote>
      <p>/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py
      in open(self, fullurl, data, timeout)
          524 
      --> 525         response = self._open(req, data)
          526 </p>
      
      <p>/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py
      in _open(self, req, data)
          542         result = self._call_chain(self.handle_open, protocol, protocol +
      --> 543                                   '_open', req)
          544         if result:</p>
      
      <p>/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py
      in _call_chain(self, chain, kind, meth_name, *args)
          502             func = getattr(handler, meth_name)
      --> 503             result = func(*args)
          504             if result is not None:</p>
      
      <p>/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py
      in https_open(self, req)    1359             return
      self.do_open(http.client.HTTPSConnection, req,
      -> 1360                 context=self._context, check_hostname=self._check_hostname)    1361 </p>
      
      <p>/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py
      in do_open(self, http_class, req, **http_conn_args)    1318<br>
      except OSError as err: # timeout error
      -> 1319                 raise URLError(err)    1320             r = h.getresponse()</p>
    </blockquote>
    
    <p>URLError: </p>
    
    <p>During handling of the above exception, another exception occurred:</p>
    
    <p>GeocoderServiceError                      Traceback (most recent call last)
     in ()
    ----> 1 geocoder.geocode("Cambridge", exactly_one = False)</p>
    
    <p>/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/geopy/geocoders/googlev3.py
    in geocode(self, query, exactly_one, timeout, bounds, region,
    components, language, sensor)
        240         logger.debug("%s.geocode: %s", self.<strong>class</strong>.<strong>name</strong>, url)
        241         return self._parse_json(
    --> 242             self._call_geocoder(url, timeout=timeout), exactly_one
        243         )
        244 </p>
    
    <p>/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/geopy/geocoders/base.py
    in _call_geocoder(self, url, timeout, raw, requester, deserializer,
    **kwargs)
        340                 if "timed out" in message:
        341                     raise GeocoderTimedOut('Service timed out')
    --> 342             raise GeocoderServiceError(message)
        343 
        344         if hasattr(page, 'getcode'):</p>
    
    <p>GeocoderServiceError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain
    (_ssl.c:1045)</p>
  </blockquote>