aboutsummaryrefslogtreecommitdiffstats
path: root/python/test_gpg.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/test_gpg.py')
-rw-r--r--python/test_gpg.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/python/test_gpg.py b/python/test_gpg.py
index 2b346559..6d8cdcd0 100644
--- a/python/test_gpg.py
+++ b/python/test_gpg.py
@@ -1,9 +1,13 @@
import gpg
from serenitas.utils.exchange import ExchangeMessage
-
+import datetime
em = ExchangeMessage()
-for msg in em.get_msgs(path=["SeleneOps", "Passport"]):
+for msg in em.get_msgs(
+ path=["SeleneOps", "Passport"],
+ filters={"last_modification_time": datetime.date.today()},
+):
+ print(msg)
for attach in msg.attachments:
if attach.name == "Attachment1.pgp":
try:
@@ -11,5 +15,12 @@ for msg in em.get_msgs(path=["SeleneOps", "Passport"]):
plaintext, result, verify_result = gpg.Context().decrypt(
fp.read(), passphrase="Serenitas1"
)
+ with open(
+ f"/home/serenitas/flint/{attach.last_modified_time.strftime('%Y%m%d')}_ISOSEL.csv",
+ "w",
+ ) as csvFile:
+ text = plaintext.decode("utf-8").replace("\t", ",")
+ csvFile.write(text)
+ break
except gpg.errors.GPGMEError as e:
print(e)