Google python Geolocator : SSL CERTIFICATE_VERIFY_FAILED -
i got ssl error when try use google geolocator. strange because same project works fine on other computers.
here code :
from geopy.geocodersimport googlev3 geolocator = googlev3(my_key) location = geolocator.geocode("1 rue martel, 75010 paris")
here issue :
traceback (most recent call last): file "/library/frameworks/python.framework/versions/3.6/lib/python3.6/urllib/request.py", line 1318, in do_open encode_chunked=req.has_header('transfer-encoding')) file "/library/frameworks/python.framework/versions/3.6/lib/python3.6/http/client.py", line 1239, in request self._send_request(method, url, body, headers, encode_chunked) file "/library/frameworks/python.framework/versions/3.6/lib/python3.6/http/client.py", line 1285, in _send_request self.endheaders(body, encode_chunked=encode_chunked) file "/library/frameworks/python.framework/versions/3.6/lib/python3.6/http/client.py", line 1234, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) file "/library/frameworks/python.framework/versions/3.6/lib/python3.6/http/client.py", line 1026, in _send_output self.send(msg) file "/library/frameworks/python.framework/versions/3.6/lib/python3.6/http/client.py", line 964, in send self.connect() file "/library/frameworks/python.framework/versions/3.6/lib/python3.6/http/client.py", line 1400, in connect server_hostname=server_hostname) file "/library/frameworks/python.framework/versions/3.6/lib/python3.6/ssl.py", line 401, in wrap_socket _context=self, _session=session) file "/library/frameworks/python.framework/versions/3.6/lib/python3.6/ssl.py", line 808, in __init__ self.do_handshake() file "/library/frameworks/python.framework/versions/3.6/lib/python3.6/ssl.py", line 1061, in do_handshake self._sslobj.do_handshake() file "/library/frameworks/python.framework/versions/3.6/lib/python3.6/ssl.py", line 683, in do_handshake self._sslobj.do_handshake() ssl.sslerror: [ssl: certificate_verify_failed] certificate verify failed (_ssl.c:749)
here config : macos, geopy 1.11.0, python 3.6.1
thanks lot help!
you may try add code below before geolocator=
assignment disable ssl certificate verification temporary measure.
import ssl # disable ssl certificate verification try: _create_unverified_https_context = ssl._create_unverified_context except attributeerror: # legacy python doesn't verify https certificates default pass else: # handle target environment doesn't support https verification ssl._create_default_https_context = _create_unverified_https_context
hope help.
Comments
Post a Comment