aboutsummaryrefslogtreecommitdiffstats
path: root/python/report_ops/custodians.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/report_ops/custodians.py')
-rw-r--r--python/report_ops/custodians.py25
1 files changed, 10 insertions, 15 deletions
diff --git a/python/report_ops/custodians.py b/python/report_ops/custodians.py
index bb939e86..51993979 100644
--- a/python/report_ops/custodians.py
+++ b/python/report_ops/custodians.py
@@ -100,25 +100,21 @@ def upload_to_custodian(account, trade_date, upload):
class Custodian:
date: datetime.date
account: ClassVar[str]
+ em = ExchangeMessage()
def __init_subclass__(cls, account):
cls.account = account
- @staticmethod
- def em_date_filter(em, date):
- return em_date_filter(em, date, date)
-
class NT(Custodian, account="NT"):
@classmethod
def download_reports(cls, date=datetime.date.today()):
- em = ExchangeMessage()
- for msg in em.get_msgs(
- path=["SeleneOps", "Passport"], **cls.em_date_filter(em, date)
+ for msg in cls.em.get_msgs(
+ path=["SeleneOps", "Passport"], start_date=date, end_date=date
):
for attach in msg.attachments:
message_time = attach.last_modified_time.replace(
- tzinfo=em._account.default_timezone
+ tzinfo=cls.em._account.default_timezone
)
if attach.name == "Attachment1.pgp":
dest = get_dir(message_time.date(), archived=False)
@@ -141,13 +137,12 @@ class NT(Custodian, account="NT"):
class UMB(Custodian, account="UMB"):
@classmethod
def download_reports(cls, date=datetime.date.today()):
- em = ExchangeMessage()
- for msg in em.get_msgs(
- count=20, path=["NYops", "Powerstation"], **cls.em_date_filter(em, date)
+ for msg in cls.em.get_msgs(
+ count=20, path=["NYops", "Powerstation"], start_date=date, end_date=date
):
for attach in msg.attachments:
ts = attach.last_modified_time.replace(
- tzinfo=em._account.default_timezone
+ tzinfo=cls._account.default_timezone
)
dest = get_dir(date, archived=False)
dest.mkdir(exist_ok=True, parents=True)
@@ -164,12 +159,12 @@ class UMB(Custodian, account="UMB"):
class BNY(Custodian, account="BONY2"):
@classmethod
def download_reports(cls, date=datetime.date.today()):
- em = ExchangeMessage()
- for msg in em.get_msgs(
+ for msg in cls.em.get_msgs(
20,
path=["BowdoinOps", "Reports"],
subject__startswith="Document(s) from Reporting",
- **cls.em_date_filter(em, date),
+ start_date=date,
+ end_date=date,
):
if msg.sender == "notify@bnymellon.com":
for attach in msg.attachments: