Documentation for Auth
Bases: object
Authentication class for operations that require Earthdata login (EDL).
get_s3_credentials(daac=None, provider=None, endpoint=None)
Gets AWS S3 credentials for a given NASA cloud provider.
The easier way is to use the DAAC short name; provider is optional if we know it.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
daac
|
Optional[str]
|
The name of a NASA DAAC, e.g. NSIDC or PODAAC. |
None
|
provider
|
Optional[str]
|
A valid cloud provider. Each DAAC has a provider code for their cloud distributions. |
None
|
endpoint
|
Optional[str]
|
Getting the credentials directly from the S3Credentials URL. |
None
|
Returns:
Type | Description |
---|---|
Dict[str, str]
|
A Python dictionary with the temporary AWS S3 credentials. |
get_session(bearer_token=True)
Returns a new request session instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bearer_token
|
bool
|
whether to include bearer token |
True
|
Returns:
Type | Description |
---|---|
Session
|
class Session instance with Auth and bearer token headers |
login(strategy='netrc', persist=False, system=None)
Authenticate with Earthdata login.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
strategy
|
str
|
The authentication method.
|
'netrc'
|
persist
|
bool
|
Will persist username and password credentials in a |
False
|
system
|
Optional[System]
|
the EDL endpoint to log in to Earthdata, defaults to PROD |
None
|
Returns:
Type | Description |
---|---|
Any
|
An instance of Auth. |
Raises:
Type | Description |
---|---|
LoginAttemptFailure
|
If the NASA Earthdata Login service rejects credentials. |
refresh_tokens()
Refresh CMR tokens.
Tokens are used to do authenticated queries on CMR for restricted and early access datasets. This method renews the tokens to make sure we can query the collections allowed to our EDL user.