From f2958e95c2a837be7bd1f4a3dbb31344d001e667 Mon Sep 17 00:00:00 2001 From: Dan Howe Date: Thu, 14 Feb 2019 13:43:03 +1100 Subject: [PATCH] Use absolute paths for Firefox download directory --- waternsw_grabber/waternsw_grabber.py | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/waternsw_grabber/waternsw_grabber.py b/waternsw_grabber/waternsw_grabber.py index 27524e4..af8c308 100644 --- a/waternsw_grabber/waternsw_grabber.py +++ b/waternsw_grabber/waternsw_grabber.py @@ -117,6 +117,9 @@ def get_telemetered_bore(driver, bore_id, start_date, end_date): def open_browser(download_dir): + # Make download directory absolute + download_dir = os.path.abspath(download_dir) + # Set up Firefox to silently download files to specified folder profile = webdriver.FirefoxProfile() profile.set_preference('browser.download.folderList', 2) @@ -137,23 +140,3 @@ def open_browser(download_dir): driver.get(url) return driver - - -def main(): - driver = open_browser() - bore_ids = [ - 'GW036367.1.1', - 'GW036211.1.1', - 'GW036588.4.4', - 'GW036572.1.1', - ] - - start_date = '2018-01-01' - end_date = '2018-06-01' - - # Download bore logs - for bore_id in bore_ids: - print('Downloading {}...'.format(bore_id)) - get_telemetered_bore(driver, bore_id, start_date, end_date) - - driver.quit()