tracek / gee_asset_manager

Google Earth Engine Batch Asset Manager
Apache License 2.0
73 stars 35 forks source link

SSL certificate verify failed #33

Closed jhelcq closed 7 years ago

jhelcq commented 7 years ago

When using geebam upload and provide the password for my google account, an SLL error is displayed.

Traceback (most recent call last):
  File "/home/jhelcq/fao_fra/entorno_virtual_faofra/bin/geebam", line 11, in <module>
    load_entry_point('geebam', 'console_scripts', 'geebam')()
  File "/home/jhelcq/fao_fra/gee_asset_manager/geebam.py", line 65, in main
    args.func(args)
  File "/home/jhelcq/fao_fra/gee_asset_manager/geebam.py", line 35, in upload_from_parser
    nodata_value=args.nodata)
  File "/home/jhelcq/fao_fra/gee_asset_manager/gee_asset_manager/batch_uploader.py", line 55, in upload
    google_session = __get_google_auth_session(user, password)
  File "/home/jhelcq/fao_fra/gee_asset_manager/gee_asset_manager/batch_uploader.py", line 174, in __get_google_auth_session
    login_html = session.get(google_accounts_url)
  File "/home/jhelcq/fao_fra/entorno_virtual_faofra/local/lib/python2.7/site-packages/requests/sessions.py", line 526, in get
    return self.request('GET', url, **kwargs)
  File "/home/jhelcq/fao_fra/entorno_virtual_faofra/local/lib/python2.7/site-packages/requests/sessions.py", line 513, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/jhelcq/fao_fra/entorno_virtual_faofra/local/lib/python2.7/site-packages/requests/sessions.py", line 623, in send
    r = adapter.send(request, **kwargs)
  File "/home/jhelcq/fao_fra/entorno_virtual_faofra/local/lib/python2.7/site-packages/requests/adapters.py", line 514, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: ("bad handshake: Error([('SSL routines', 'SSL3_GET_SERVER_CERTIFICATE', 'certificate verify failed')],)",)

If I execute this code:

import requests
session = requests.session()
login_html = session.get('https://accounts.google.com')

The same error is shown, but if the url is https://www.agetic.gob.bo or http://slack.com the SSL error is not displayed

tracek commented 7 years ago

It does not seem to be related to geebam (as you have noticed yourself), but I can try to help you with troubleshooting. Can you paste output of this: pip show requests ?

jhelcq commented 7 years ago
(entorno_virtual_faofra) jhelcq@pc-j:~$ pip show requests
Name: requests
Version: 2.17.3
Summary: Python HTTP for Humans.
Home-page: http://python-requests.org
Author: Kenneth Reitz
Author-email: me@kennethreitz.org
License: Apache 2.0
Location: /home/jhelcq/fao_fra/entorno_virtual_faofra/lib/python2.7/site-packages
Requires: urllib3, idna, certifi, chardet
tracek commented 7 years ago

Some people report problem with certifi. Can you check it? If it does not work, please post also Python and OS version.

jhelcq commented 7 years ago

I could not install certifi==2015.04.28, because requests requires certifi>=2017.4.17.

Then export the result of certifi.old_where() Here it is mentioned: export REQUESTS_CA_BUNDLE = /home/.../local/lib/python2.7/site-packages/certifi/weak.pem

Now the SLL error is not displayed:

2017-06-05 17:22:11,577 :: oauth2client.transport :: INFO :: Attempting refresh to obtain initial access_token
2017-06-05 17:22:11,578 :: oauth2client.client :: INFO :: Refreshing access_token
Password: 
2017-06-05 17:23:04,012 :: root :: INFO :: Processing image 1 out of 2: 2010/n35_05_2010lc030.tif
2017-06-05 17:27:04,384 :: root :: INFO :: Processing image 2 out of 2: 2010/n41_40_2010lc030.tif

Thanks @tracek