diff options
Diffstat (limited to 'python/bowdst.py')
| -rw-r--r-- | python/bowdst.py | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/python/bowdst.py b/python/bowdst.py index 5ca685d5..389e1146 100644 --- a/python/bowdst.py +++ b/python/bowdst.py @@ -2,7 +2,6 @@ import datetime import pandas as pd from dates import bus_day from env import DAILY_DIR -from exchange import ExchangeMessage from exchangelib import FileAttachment from io import StringIO from remote import SftpClient @@ -19,17 +18,9 @@ def download_messages(em): 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) - if not p.exists(): - p.write_bytes(attach.content) - if fname.endswith("csv") and fname.startswith( - "Net Investment Earned Income by Security" + if fname.endswith("csv") and ( + fname.startswith("Asset Detail") + or fname.startswith("Net Investment") ): date = datetime.datetime.strptime( fname.split("_")[1].split(".")[0], "%d %b %Y" @@ -271,6 +262,7 @@ def send_email( if __name__ == "__main__": import argparse + from exchange import ExchangeMessage parser = argparse.ArgumentParser() parser.add_argument( |
