Documentation for Auth
Bases: object
Authentication class for operations that require Earthdata login (EDL).
Source code in earthaccess/auth.py
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. |
Source code in earthaccess/auth.py
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 |
Source code in earthaccess/auth.py
login(strategy='netrc', persist=False)
Authenticate with Earthdata login.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
strategy |
str
|
The authentication method.
|
'netrc'
|
persist |
bool
|
Will persist credentials in a |
False
|
Returns:
Type | Description |
---|---|
Any
|
An instance of Auth. |
Source code in earthaccess/auth.py
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.