Compare commits
1 commit
master
...
nin/automa
Author | SHA1 | Date | |
---|---|---|---|
|
e8dec4a228 |
1 changed files with 28 additions and 0 deletions
28
data-ingest/fetch-axione-data.py
Normal file
28
data-ingest/fetch-axione-data.py
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
import subprocess
|
||||||
|
import configparser
|
||||||
|
|
||||||
|
class Config(TypedDict):
|
||||||
|
hostname: str
|
||||||
|
user: str
|
||||||
|
password: str
|
||||||
|
|
||||||
|
def parseConfig() -> Config:
|
||||||
|
cfg_path = os.environ.get("CONFIG", "/etc/ftth-ipe-map/conf.ini")
|
||||||
|
cfg = configparser.ConfigParser()
|
||||||
|
with open(cfg_path, "r") as f:
|
||||||
|
cfg.read_file(f)
|
||||||
|
return {
|
||||||
|
'hostname':cfg.get("AXIONE_FTP","hostname"),
|
||||||
|
'user':cfg.get("AXIONE_FTP","user"),
|
||||||
|
'password':cfg.get("AXIONE_FTP","password"),
|
||||||
|
}
|
||||||
|
|
||||||
|
def call_lftp(args):
|
||||||
|
return subprocess.run(["lftp", "-u", f"{cfg.user},{cfg.password}", hostname]
|
||||||
|
+ args).stdout.decode("utf8")
|
||||||
|
|
||||||
|
def retrieve_ipe_list(cfg: Config):
|
||||||
|
return call_lftp(["-e", "set ssl:verify-certificate no; find /; bye"])
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
cfg = parseConfig
|
Loading…
Reference in a new issue