Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve credentials management #51

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading