From c84581aeca95c08e017bb4d0d883199c83ed51db Mon Sep 17 00:00:00 2001 From: Dan Howe Date: Fri, 15 Feb 2019 15:19:29 +1100 Subject: [PATCH] Update docstrings --- waternsw_grabber/waternsw_grabber.py | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/waternsw_grabber/waternsw_grabber.py b/waternsw_grabber/waternsw_grabber.py index 19ae156..d9feec7 100644 --- a/waternsw_grabber/waternsw_grabber.py +++ b/waternsw_grabber/waternsw_grabber.py @@ -53,16 +53,13 @@ def wait_for_element(driver, by, x, timeout=60): def get_telemetered_bore(driver, bore_id, start_date, end_date): - """Download records from telemetered bore. + """Download single record from telemetered bore. Args: driver: selenium webdriver object - bore_id: bore id (string) + bore_id: bore ID (string) start_date: start date (string in ISO-8601 format) end_date: end date (string in ISO-8601 format) - - Returns: - input values in model scale """ url = 'https://realtimedata.waternsw.com.au/water.stm' @@ -158,6 +155,15 @@ def get_telemetered_bore(driver, bore_id, start_date, end_date): def open_browser(download_dir): + """Opens an automated Firefox browser instance. + + Args: + download_dir: path to where downloaded files will be saved + + Returns: + A selenium web browser object + """ + # Make download directory absolute download_dir = os.path.abspath(download_dir) @@ -182,6 +188,17 @@ def open_browser(download_dir): def telemetered_bore_downloader(bore_ids, start_date, end_date, download_dir): + """Download multiple records from telemetered bore. + + Args: + bore_ids: bore ID values (array-like) + start_date: start date (string in ISO-8601 format) + end_date: end date (string in ISO-8601 format) + download_dir: path to where downloaded files will be saved + + Raises: + ValueError when bore ID is invalid + """ driver = open_browser(download_dir) # Set up log File