1

Using Python 3.4, I installed the below geolocation package
https://pypi.python.org/pypi/geolocation-python/0.2.2

I tested it in IDLE using the code below

key = 'myGoogleKey'
google = GoogleMaps(api_key=key)
addr = 'Boston MA'
location = google.search(location=addr)

it fails at the last line, generating an SSL Error

Traceback (most recent call last):
  File "c:\python34\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 559, in urlopen
    body=body, headers=headers)
  File "c:\python34\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 345, in _make_request
    self._validate_conn(conn)
  File "c:\python34\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 782, in _validate_conn
    conn.connect()
  File "c:\python34\lib\site-packages\requests\packages\urllib3\connection.py", line 250, in connect
    ssl_version=resolved_ssl_version)
  File "c:\python34\lib\site-packages\requests\packages\urllib3\util\ssl_.py", line 285, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File "c:\python34\lib\ssl.py", line 365, in wrap_socket
    _context=self)
  File "c:\python34\lib\ssl.py", line 583, in __init__
    self.do_handshake()
  File "c:\python34\lib\ssl.py", line 810, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\python34\lib\site-packages\requests\adapters.py", line 370, in send
    timeout=timeout
  File "c:\python34\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 588, in urlopen
    raise SSLError(e)
requests.packages.urllib3.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<pyshell#9>", line 1, in <module>
    location = google.search(location=addr)
  File "c:\python34\lib\site-packages\geolocation\main.py", line 18, in search
    return self.geocode.search(location, lat, lng)
  File "c:\python34\lib\site-packages\geolocation\geocode\main.py", line 48, in search
    data = self.client.get_data(address=address, latitude=latitude, longitude=longitude)
  File "c:\python34\lib\site-packages\geolocation\geocode\client.py", line 40, in get_data
    return self.send_data(self.API_URL, self.query_parameters)
  File "c:\python34\lib\site-packages\geolocation\client.py", line 22, in send_data
    response = requests.get(url, params=params)
  File "c:\python34\lib\site-packages\requests\api.py", line 69, in get
    return request('get', url, params=params, **kwargs)
  File "c:\python34\lib\site-packages\requests\api.py", line 50, in request
    response = session.request(method=method, url=url, **kwargs)
  File "c:\python34\lib\site-packages\requests\sessions.py", line 468, in request
    resp = self.send(prep, **send_kwargs)
  File "c:\python34\lib\site-packages\requests\sessions.py", line 576, in send
    r = adapter.send(request, **kwargs)
  File "c:\python34\lib\site-packages\requests\adapters.py", line 433, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600)

I used this same package and code using python 2.7 in a linux environment and it worked fine. Any ideas on how I can fix this?

4

0 に答える 0