icesat2py / icepyx

Python tools for obtaining and working with ICESat-2 data
https://icepyx.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
207 stars 106 forks source link

SSLError #407

Closed manmeet3591 closed 1 year ago

manmeet3591 commented 1 year ago

I am trying to run the following:

region_a.earthdata_login(earthdata_uid, earthdata_email)

and am getting the following error

KeyError                                  Traceback (most recent call last)
[/usr/local/lib/python3.8/dist-packages/icepyx/core/Earthdata.py](https://localhost:8080/#) in login(self, attempts)
    131             self.uid, _, self.pswd = netrc.netrc(self.netrc).authenticators(url)
--> 132             self._start_session()
    133 

20 frames
KeyError: 'token'

During handling of the above exception, another exception occurred:

SSLCertVerificationError                  Traceback (most recent call last)
SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1131)

During handling of the above exception, another exception occurred:

MaxRetryError                             Traceback (most recent call last)
MaxRetryError: HTTPSConnectionPool(host='n5eil02u.ecs.nsidc.org', port=443): Max retries exceeded with url: /egi/capabilities/ATL03.005.xml (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1131)')))

During handling of the above exception, another exception occurred:

SSLError                                  Traceback (most recent call last)
[/usr/local/lib/python3.8/dist-packages/requests/adapters.py](https://localhost:8080/#) in send(self, request, stream, timeout, verify, cert, proxies)
    512             if isinstance(e.reason, _SSLError):
    513                 # This branch is for urllib3 v1.22 and later.
--> 514                 raise SSLError(e, request=request)
    515 
    516             raise ConnectionError(e, request=request)

SSLError: HTTPSConnectionPool(host='n5eil02u.ecs.nsidc.org', port=443): Max retries exceeded with url: /egi/capabilities/ATL03.005.xml (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1131)')))
weiji14 commented 1 year ago

I think the SSL certificate expired on 28 Feb 2023, looking at the screenshot in https://github.com/icesat2py/icepyx/issues/288#issuecomment-1060842078. This needs to be fixed on the NSIDC side, cc @betolink?

anaprietonem commented 1 year ago

Hello! I am also seeing the same error when trying to download some Icesat-2 ATL08 data: requests.exceptions.SSLError: HTTPSConnectionPool(host='n5eil02u.ecs.nsidc.org', port=443): Max retries exceeded with url: /egi/capabilities/ATL08.005.xml (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1131)'))) so thanks in advance for looking into this bug!

betolink commented 1 year ago

It's an expired SSL certificate like @weiji14 mentioned, I heard it will be fixed ASAP (today)

manmeet3591 commented 1 year ago

@betolink can you please let me know if it has been fixed ?

betolink commented 1 year ago

@manmeet3591 As far as I know this got fixed yesterday.

weiji14 commented 1 year ago

Tried accessing https://n5eil02u.ecs.nsidc.org/egi/capabilities/ATL14.001.xml (had to enter my Earthdata username/password) and it looks like the certificate was updated on Thu, 02 Mar 2023 00:00:00 GMT.

NSIDC SSL certificate for Mar 2023

FYI, next expiry date is Sun, 31 Mar 2024 23:59:59 GMT, just in case this issue pops up again next year :laughing: I'll close this issue for now, let us know though if things still aren't working.