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

Update dotrc file structure #17

Merged
merged 1 commit into from
Oct 10, 2024
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
16 changes: 8 additions & 8 deletions src/smos/smos_l2/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ def load_dotrc(path=None) -> dict:
config = {}
with open(path) as f:
for line in f.readlines():
if ":" in line:
k, v = line.strip().split(":", 1)
if k in ("disseo_username", "disseo_password"):
config[k] = v.strip()
if "=" in line:
k, v = line.strip().split("=", 1)
if k in ("DISSEO_USERNAME", "DISSEO_PASSWORD"):
config[k] = v.strip(f""" "'""""")
return config


Expand All @@ -66,8 +66,8 @@ def __init__(self, local_root, username=None, password=None, dotrc=None,
dotrc: str, optional (default: None)
Path to the .smosapirc file containing the FTP username and password.
If None, then the file is assumed to be at $HOME/.smosapirc
disseo_username: xxxx
disseo_password: xxxx
DISSEO_USERNAME=xxxx
DISSEO_PASSWORD=xxxx
Create an account at https://eoiam-idp.eo.esa.int
skip_lftp_verify: bool, optional (default: False)
Skip checking if lftp is available (for testing).
Expand All @@ -84,9 +84,9 @@ def __init__(self, local_root, username=None, password=None, dotrc=None,
if self.username is None or self.password is None:
config = load_dotrc(dotrc)
if self.username is None:
self.username = config['disseo_username']
self.username = config['DISSEO_USERNAME']
if self.password is None:
self.password = config['disseo_password']
self.password = config['DISSEO_PASSWORD']

if not skip_lftp_verify:
self.verify_lftp_installed()
Expand Down
Loading