diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/bowdst.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/python/bowdst.py b/python/bowdst.py new file mode 100644 index 00000000..ff3b7574 --- /dev/null +++ b/python/bowdst.py @@ -0,0 +1,19 @@ +import datetime +from env import DAILY_DIR +from exchange import ExchangeMessage + +em = ExchangeMessage() +for msg in em.get_msgs( + 20, path=["BowdoinOps", "Reports"], subject__startswith="Document(s) from Reporting" +): + if msg.sender == "notify@bnymellon.com": + for attach in msg.attachments: + fname = attach.name + if fname.endswith("csv") and fname.startswith("Asset Detail"): + date = datetime.datetime.strptime( + fname.split("_")[1].split(".")[0], "%d %b %Y" + ).date() + p = DAILY_DIR / str(date) / "Reports" / fname + if not p.parent.exists(): + p.parent.mkdir(parents=True) + p.write_bytes(attach.content) |
