aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/baml.py29
1 files changed, 18 insertions, 11 deletions
diff --git a/python/baml.py b/python/baml.py
index d07233f6..688e1a77 100644
--- a/python/baml.py
+++ b/python/baml.py
@@ -17,17 +17,24 @@ def download_messages(em):
date = msg.subject.split("-", 1)[1]
save_dir = DAILY_DIR / date / "Reports"
soup = BeautifulSoup(msg.body, features="lxml")
- a = soup.find("a")
- url = urlsplit(a["href"])
- query = parse_qs(url.query)
- base_url = urlunsplit(url[:2] + ("",) * 3)
- try:
- download_from_secure_id(
- query["id"][0], query["brand"][0], save_dir, base_url
- )
- except ValueError as e:
- logger.error(e)
- continue
+ if title.text == "Proofpoint Encryption":
+ a = soup.find("a")
+ url = urlsplit(a["href"])
+ query = parse_qs(url.query)
+ base_url = urlunsplit(url[:2] + ("",) * 3)
+ try:
+ download_from_secure_id(
+ query["id"][0], query["brand"][0], save_dir, base_url
+ )
+ except ValueError as e:
+ logger.error(e)
+ continue
+ 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)
def load_cash_report(workdate: datetime.date):