website2022 icon indicating copy to clipboard operation
website2022 copied to clipboard

Cloud access for section of earthdata library notebook no longer working

Open scottyhq opened this issue 2 years ago • 5 comments

This code used to return "5" but now results in a traceback. Is the Cloud access no longer an option @mikala-nsidc @betolink ?

https://icesat-2.hackweek.io/tutorials/data_access/data_access_2_earthdata.html#cloud-access

# We can create a collections object from our query.

collections = Query.fields(['ShortName','Abstract']).get()

print(len(collections))
---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
File /srv/conda/envs/notebook/lib/python3.9/site-packages/earthdata/search.py:142, in DataCollections.get(self, limit)
    141 try:
--> 142     response.raise_for_status()
    143 except exceptions.HTTPError as ex:

File /srv/conda/envs/notebook/lib/python3.9/site-packages/requests/models.py:960, in Response.raise_for_status(self)
    959 if http_error_msg:
--> 960     raise HTTPError(http_error_msg, response=self)

HTTPError: 401 Client Error: Unauthorized for url: https://cmr.earthdata.nasa.gov/search/collections.umm_json?has_granules=true&include_granule_counts=true&keyword=land%20ice&bounding_box=-134.7,58.9,-133.9,59.2&provider=NSIDC_CPRD&&page_size=200&page_num=1

During handling of the above exception, another exception occurred:

RuntimeError                              Traceback (most recent call last)
Input In [18], in <cell line: 3>()
      1 # We can create a collections object from our query.
----> 3 collections = Query.fields(['ShortName','Abstract']).get()
      5 print(len(collections))

File /srv/conda/envs/notebook/lib/python3.9/site-packages/earthdata/search.py:144, in DataCollections.get(self, limit)
    142     response.raise_for_status()
    143 except exceptions.HTTPError as ex:
--> 144     raise RuntimeError(ex.response.text)
    146 if self._format == "json":
    147     latest = response.json()["feed"]["entry"]

RuntimeError: {"errors":["Token [Bearer EDLXXX2b1b2] has expired. Note the token value has been partially redacted."]}

scottyhq avatar Apr 14 '22 23:04 scottyhq