blob: ebb06a272e8d15e3a741847f3a79e59944e843c0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
import pandas as pd
from . import DAILY_DIR
def download_files(count=20):
from exchange import ExchangeMessage
em = ExchangeMessage()
emails = em.get_msgs(
path=["NYops", "Margin Calls CS"], count=count, subject__contains="Margin"
)
DATA_DIR = DAILY_DIR / "CS_reports"
for msg in emails:
for attach in msg.attachments:
fname = attach.name
if fname.endswith("xlsx"):
p = DATA_DIR / fname
if not p.exists():
p.write_bytes(attach.content)
|