diff options
Diffstat (limited to 'python/baml.py')
| -rw-r--r-- | python/baml.py | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/python/baml.py b/python/baml.py index b2916417..a8923d8b 100644 --- a/python/baml.py +++ b/python/baml.py @@ -13,19 +13,20 @@ logger = logging.getLogger(__name__) def download_messages(em): - # Need to fix path - for msg in em.get_msgs(path=["NYops", "Mercury"], subject__startswith="Positions-"): + for msg in em.get_msgs( + path=["NYops", "Mercury"], count=20, subject__startswith="Positions-" + ): if msg.sender == "mercury-reports@baml.com": date = msg.subject.split("-", 1)[1] save_dir = DAILY_DIR / date / "Reports" - if msg.body.body_type == "HTML": - read_secure_message(msg, save_dir, logger) - else: - for attach in msg.attachments: - if attach.name.endswith("csv"): - p = save_dir / attach.name - if not p.exists(): - p.write_bytes(attach.content) + for attach in msg.attachments: + if attach.name.endswith("html"): + read_secure_message(msg, save_dir, logger) + continue + if attach.name.endswith("csv"): + p = save_dir / attach.name + if not p.exists(): + p.write_bytes(attach.content) def load_cash_report(workdate: datetime.date): |
