aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/download_markit_quotes.py8
-rw-r--r--python/insert_tranche_quotes.py2
2 files changed, 7 insertions, 3 deletions
diff --git a/python/download_markit_quotes.py b/python/download_markit_quotes.py
index ca8298db..2070a7bd 100644
--- a/python/download_markit_quotes.py
+++ b/python/download_markit_quotes.py
@@ -8,6 +8,10 @@ from selenium.webdriver.support.ui import WebDriverWait
import time, os
from config import markit_login, markit_password
from insert_tranche_quotes import insert_quotes
+import logging
+logging.basicConfig(filename='/home/share/CorpCDOs/logs/download_tranche_quotes.log',
+ level=logging.INFO,
+ format='%(asctime)s %(message)s')
profile = FirefoxProfile()
profile.set_preference('browser.download.folderList', 2) # custom location
@@ -39,9 +43,9 @@ while (not os.path.exists("/tmp/Quotes.csv") or total_wait==10):
time.sleep(1)
total_wait += 1
if total_wait==10:
- print("failed to download quotes")
+ logging.info("failed to download quotes")
else:
- print("download worked")
+ logging.info("download worked")
insert_quotes(quote_dir="/tmp")
driver.close()
diff --git a/python/insert_tranche_quotes.py b/python/insert_tranche_quotes.py
index e680aee2..934313a2 100644
--- a/python/insert_tranche_quotes.py
+++ b/python/insert_tranche_quotes.py
@@ -151,7 +151,7 @@ def insert_quotes(year=2014, quote_dir=None):
try:
conn.execute(ins, l)
except (IntegrityError, DataError) as e:
- print(e.orig)
+ logging.debug(e.orig)
t.rollback()
os.unlink(os.path.join(quote_dir, quotefile))