-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use temp .netrc file for integration tests
- Loading branch information
1 parent
699cc4e
commit 2e1af6a
Showing
16 changed files
with
273 additions
and
297 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ htmlcov | |
dist | ||
site | ||
.coverage | ||
.coverage.* | ||
coverage.xml | ||
.netlify | ||
test.db | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,90 @@ | ||
## Authenticate with Earthdata Login | ||
# Authenticate with Earthdata Login | ||
|
||
The first step to use NASA Earthdata is to create an account with Earthdata Login, please follow the instructions at [NASA EDL](https://urs.earthdata.nasa.gov/) | ||
The first step to use NASA Earthdata is to create an account with Earthdata | ||
Login, please follow the instructions at | ||
[NASA EDL](https://urs.earthdata.nasa.gov/) | ||
|
||
Once registered, earthaccess can use environment variables, a `.netrc` file or interactive input from a user to login with NASA EDL. | ||
Once registered, earthaccess can use environment variables, a `.netrc` file or | ||
interactive input from a user to login with NASA EDL. | ||
|
||
If a strategy is not especified, env vars will be used first, then netrc and finally user's input. | ||
If a strategy is not specified, environment variables will be used first, then | ||
a `.netrc` (if found, see below), and finally a user's input. | ||
|
||
```py | ||
import earthaccess | ||
|
||
auth = earthaccess.login() | ||
``` | ||
|
||
If you have a .netrc file with your Earthdata Login credentials | ||
If you have a `.netrc` file (see below) with your Earthdata Login credentials, | ||
you can explicitly specify its use: | ||
|
||
```py | ||
auth = earthaccess.login(strategy="netrc") | ||
``` | ||
|
||
If your Earthdata Login credentials are set as environment variables: EARTHDATA_USERNAME, EARTHDATA_PASSWORD | ||
If your Earthdata Login credentials are set as the environment variables | ||
`EARTHDATA_USERNAME` and `EARTHDATA_PASSWORD`, you can explicitly specify their | ||
use: | ||
|
||
```py | ||
auth = earthaccess.login(strategy="environment") | ||
``` | ||
|
||
If you wish to enter your Earthdata Login credentials when prompted with optional persistence to .netrc | ||
If you wish to enter your Earthdata Login credentials when prompted, with | ||
optional persistence to your `.netrc` file (see below), specify the interactive | ||
strategy: | ||
|
||
```py | ||
auth = earthaccess.login(strategy="interactive", persist=True) | ||
``` | ||
|
||
## Authentication | ||
|
||
By default, `earthaccess` with automatically look for your EDL account | ||
credentials in two locations: | ||
|
||
### **Authentication** | ||
1. A `.netrc` file: By default, this is either `~/_netrc` (on a Windows system) | ||
or `~/.netrc` (on a non-Windows system). On *any* system, you may override | ||
the default location by setting the `NETRC` environment variable to the path | ||
of your desired `.netrc` file. | ||
|
||
By default, `earthaccess` with automatically look for your EDL account credentials in two locations: | ||
|
||
1. A `~/.netrc` file | ||
**NOTE**: When setting the `NETRC` environment variable, there is no | ||
requirement to use a specific filename. The name `.netrc` is common, but | ||
used throughout documentation primarily for convenience. The only | ||
requirement is that the *contents* of the file adhere to the | ||
[`.netrc` file format](https://www.gnu.org/software/inetutils/manual/html_node/The-_002enetrc-file.html). | ||
2. `EARTHDATA_USERNAME` and `EARTHDATA_PASSWORD` environment variables | ||
|
||
If neither of these options are configured, you can authenticate by calling the `earthaccess.login()` method | ||
and manually entering your EDL account credentials. | ||
If neither of these options are configured, you can authenticate by calling the | ||
`earthaccess.login()` method and manually entering your EDL account credentials. | ||
|
||
```python | ||
import earthaccess | ||
|
||
earthaccess.login() | ||
``` | ||
|
||
Note you can pass `persist=True` to `earthaccess.login()` to have the EDL account credentials you enter | ||
automatically saved to a `~/.netrc` file for future use. | ||
|
||
Note you can pass `persist=True` to `earthaccess.login()` to have the EDL | ||
account credentials you enter automatically saved to your `.netrc` file (see | ||
above) for future use. | ||
|
||
Once you are authenticated with NASA EDL you can: | ||
|
||
* Get a file from a DAAC using a `fsspec` session. | ||
* Request temporary S3 credentials from a particular DAAC (needed to download or stream data from an S3 bucket in the cloud). | ||
* Request temporary S3 credentials from a particular DAAC (needed to download or | ||
stream data from an S3 bucket in the cloud). | ||
* Use the library to download or stream data directly from S3. | ||
* Regenerate CMR tokens (used for restricted datasets). | ||
|
||
## Earthdata User Acceptance Testing (UAT) environment | ||
|
||
### Earthdata User Acceptance Testing (UAT) environment | ||
|
||
If your EDL account is authorized to access the User Acceptance Testing (UAT) system, | ||
you can set earthaccess to work with its EDL and CMR endpoints | ||
by setting the `system` argument at login, as follows: | ||
If your EDL account is authorized to access the User Acceptance Testing (UAT) | ||
system, you can set earthaccess to work with its EDL and CMR endpoints by | ||
setting the `system` argument at login, as follows: | ||
|
||
```python | ||
import earthaccess | ||
|
||
earthaccess.login(system=earthaccess.UAT) | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.