Skip to content

Commit

Permalink
Merge pull request #51 from avalentino/feature/ask-credentisals
Browse files Browse the repository at this point in the history
Improve credentials management
  • Loading branch information
scottstanie authored Nov 6, 2023
2 parents efcf14c + bd8c256 commit b5150c7
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions eof/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@
"--asf-password",
help="ASF password. If not provided the program asks for it",
)
@click.option(
"--ask-password",
is_flag=True,
help="ask for passwords interactively if needed",
)
@click.option(
"--update-netrc",
is_flag=True,
Expand All @@ -100,6 +105,7 @@ def cli(
asf_password: str = "",
cdse_user: str = "",
cdse_password: str = "",
ask_password: bool = False,
update_netrc: bool = False,
):
"""Download Sentinel precise orbit files.
Expand All @@ -111,11 +117,12 @@ def cli(
With no arguments, searches current directory for Sentinel 1 products
"""
log._set_logger_handler(level=logging.DEBUG if debug else logging.INFO)
dryrun = not update_netrc
if not (asf_user and asf_password):
asf_user, asf_password = setup_netrc(host=NASA_HOST, dryrun=dryrun)
if not (cdse_user and cdse_password):
cdse_user, cdse_password = setup_netrc(host=DATASPACE_HOST, dryrun=dryrun)
if ask_password:
dryrun = not update_netrc
if not force_asf and not (cdse_user and cdse_password):
cdse_user, cdse_password = setup_netrc(host=DATASPACE_HOST, dryrun=dryrun)
if not (cdse_user and cdse_password) and not (asf_user and asf_password):
asf_user, asf_password = setup_netrc(host=NASA_HOST, dryrun=dryrun)

download.main(
search_path=search_path,
Expand Down

0 comments on commit b5150c7

Please sign in to comment.