Authentication into podaac earth server

Hi - I’m running a notebook to access podaac LP2 sat data with xarray. I have it working in one 2i2c jupyterhub that we’re using for GridSST hackathon this week. However, when I try to run this exact same notebook in staging.pangeo jupyter hub (for larger RAM) I am not getting any credentials returning from temp_creds. The credentials returned are used to access an AWS S3 bucket. See below for the snippet used with the GET request:

import requests

s3_cred_endpoint = {
    'podaac':'https://archive.podaac.earthdata.nasa.gov/s3credentials',
    'lpdaac':'https://data.lpdaac.earthdatacloud.nasa.gov/s3credentials',
    'ornldaac':'https://data.ornldaac.earthdata.nasa.gov/s3credentials',
    'gesdisc':'https://data.gesdisc.earthdata.nasa.gov/s3credentials'
}

def get_temp_creds():
    temp_creds_url = s3_cred_endpoint['podaac']
    return requests.get(temp_creds_url).json()

temp_creds = get_temp_creds()
temp_creds

I also tried using the auth param in the GET request as follows, but this didn’t work:

from requests.auth import HTTPBasicAuth

def get_temp_creds():
    temp_creds_url = s3_cred_endpoint['podaac']
    return requests.get(temp_creds_url, auth=HTTPBasicAuth("username", "password")).json()

I should also note that others have been reporting the same issue while others can run the notebook successfully on the same 2i2c jupyterhub. Not sure why there is this inconsistency. Any help would be very much appreciated, thanks!

The gridsst JupyterHub is running on AWS, while the pangeo one is running on GCP - so possible that podaac is handling the response differently based on where the requrest is coming from.

1 Like

NASA only allows direct access to S3 buckets in us-west-2, if we are not running in this region we can use the HTTP links but access will be slower. :crying_cat_face:

1 Like

Yes, I just realized that was the issue. Thank you so much for the responses!

1 Like