aboutsummaryrefslogtreecommitdiffstats
path: root/python/download_markit_quotes.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/download_markit_quotes.py')
-rw-r--r--python/download_markit_quotes.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/python/download_markit_quotes.py b/python/download_markit_quotes.py
index 1823c16b..561f8b6d 100644
--- a/python/download_markit_quotes.py
+++ b/python/download_markit_quotes.py
@@ -7,6 +7,7 @@ from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
import time, os
from config import markit_login, markit_password
+from insert_tranche_quotes import insert_quotes
profile = FirefoxProfile()
profile.set_preference('browser.download.folderList', 2) # custom location
@@ -17,7 +18,6 @@ profile.set_preference('browser.helperApps.neverAsk.saveToDisk', 'text/csv')
driver = Firefox(profile)
driver.get("https://markit.com/")
driver.find_element_by_css_selector("a.loginLink").click()
-wh = driver.current_window_handle
driver.find_element_by_css_selector("input[name=username]").send_keys(markit_login)
driver.find_element_by_css_selector("input[name=password]").send_keys(markit_password)
driver.find_element_by_css_selector("input[name=Login]").click()
@@ -34,10 +34,13 @@ WebDriverWait(driver, 10).until(EC.frame_to_be_available_and_switch_to_it((By.NA
link = driver.find_element_by_css_selector(".searchBg_bottom span:nth-child(1) table:nth-child(1) tbody:nth-child(1) tr:nth-child(1) td:nth-child(2) a:nth-child(1)")
link.click()
-while(True):
- total_wait = 0
- while (not os.path.exits("Quotes.csv") or total_wait==10):
- time.sleep(1)
- total_wait += 1
+total_wait = 0
+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")
+else:
+ insert_quotes(quote_dir="/tmp")
driver.close()