diff options
Diffstat (limited to 'python/parse_gs_exchange.py')
| -rw-r--r-- | python/parse_gs_exchange.py | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/python/parse_gs_exchange.py b/python/parse_gs_exchange.py index 9f22ac0f..a39b034a 100644 --- a/python/parse_gs_exchange.py +++ b/python/parse_gs_exchange.py @@ -1,33 +1,16 @@ from db import dbconn -from exchangelib import Credentials, Mailbox, Configuration, Account, DELEGATE +from exchange import get_msgs from pytz import timezone from parse_emails import write_todb import datetime -import json import logging -import os import pandas as pd import re class ParseError(Exception): pass -def get_msgs(email_address='ghorel@lmcg.com', count=None): - with open(os.path.join('.credentials', email_address + '.json')) as fh: - creds = json.load(fh) - credentials = Credentials(**creds) - config = Configuration(server='autodiscover.lmcg.com', credentials=credentials) - account = Account(primary_smtp_address=email_address, config=config, - autodiscover=False, access_type=DELEGATE) - folder = account.root.get_folder_by_name('GS').get_folder_by_name('Swaptions') - if count: - for msg in folder.all().order_by('-datetime_sent')[:count]: - yield msg - else: - for msg in folder.all().order_by('-datetime_sent'): - yield msg - def parse_email(email, fwd_index): m = re.search("(IG|HY)(\d{2}) 5y (?:.*)SWAPTION (?:UPDATE|CLOSES|CLOSE) - Ref\D+(.+)$", email.subject) |
