From 2155e856e1c912078f456018b1dffa490fbb3ff2 Mon Sep 17 00:00:00 2001 From: Dan Howe Date: Thu, 14 Feb 2019 13:14:58 +1100 Subject: [PATCH] Don't warn if user is not an administrator --- waternsw_grabber/waternsw_grabber.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/waternsw_grabber/waternsw_grabber.py b/waternsw_grabber/waternsw_grabber.py index a83bdaa..07e7e24 100644 --- a/waternsw_grabber/waternsw_grabber.py +++ b/waternsw_grabber/waternsw_grabber.py @@ -116,10 +116,7 @@ def get_telemetered_bore(driver, bore_id, start_date, end_date): def open_browser(download_dir): - # Warn if user does not have admin privileges - if not has_admin(): - warnings.warn('This program should be run as an administrator.') - + # Set up Firefox to silently download files to specified folder profile = webdriver.FirefoxProfile() profile.set_preference('browser.download.folderList', 2) profile.set_preference('browser.download.manager.showWhenStarting', False) @@ -130,9 +127,11 @@ def open_browser(download_dir): 'application/x-zip-compressed,' 'multipart/x-zip')) + # Create download folder if it does not exist + os.makedirs(download_dir, exist_ok=True) + # Open browser driver = webdriver.Firefox(firefox_profile=profile) - url = 'https://realtimedata.waternsw.com.au/water.stm' driver.get(url)