Skip to content

Commit

Permalink
Merge pull request #17 from wpreimes/smos_l2
Browse files Browse the repository at this point in the history
Update dotrc file structure
  • Loading branch information
wpreimes authored Oct 10, 2024
2 parents e4bb8ee + 1177524 commit dfc2ff5
Showing 1 changed file with 8 additions and 8 deletions.
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

0 comments on commit dfc2ff5

Please sign in to comment.