From 1177524774296302668c159c9c1f4ef5df41bb62 Mon Sep 17 00:00:00 2001 From: Wolfgang Preimesberger Date: Thu, 10 Oct 2024 14:18:26 +0200 Subject: [PATCH] Update dotrc file structure --- src/smos/smos_l2/download.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/smos/smos_l2/download.py b/src/smos/smos_l2/download.py index 888d5b8..ffa3f37 100644 --- a/src/smos/smos_l2/download.py +++ b/src/smos/smos_l2/download.py @@ -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 @@ -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). @@ -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()