aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/mtm_status.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/python/mtm_status.py b/python/mtm_status.py
index 26351879..8020b71a 100644
--- a/python/mtm_status.py
+++ b/python/mtm_status.py
@@ -3,6 +3,7 @@ import datetime
import pandas as pd
from serenitas.utils.db import dbconn
from psycopg2.errors import UniqueViolation
+from zipfile import ZipFile
def latest(f):
@@ -19,11 +20,10 @@ def run(conn):
]
target_file = max(files, key=latest)
- sftp.client.get(
- f"outbound/{target_file.filename}",
- localpath=f"/home/serenitas/flint/{target_file.filename}",
+ fh = ZipFile(sftp.client.open(f"outbound/{target_file.filename}")).open(
+ f'{target_file.filename.removesuffix(".zip")}'
)
- df = pd.read_csv(f"/home/serenitas/flint/{target_file.filename}", skiprows=2)
+ df = pd.read_csv(fh, skiprows=2)
df = df[(df["SwapType"] == "NEW") & (df["Executed"])]
with conn.cursor() as c:
for row in df.itertuples():